use of com.developmentontheedge.be5.api.Request in project be5 by DevelopmentOnTheEdge.
the class DownloadComponentTest method test.
@Test
@Ignore
public void test() {
Response response = mock(Response.class);
Request req = getSpyMockRequest("", ImmutableMap.<String, String>builder().put("_t_", "attachments").put("_typeColumn_", "mimeType").put("_charsetColumn_", "mimeCharset").put("_filenameColumn_", "name").put("_dataColumn_", "data").put("_download_", "no").put("ID", "7326").build());
component.generate(req, response, injector);
}
use of com.developmentontheedge.be5.api.Request in project be5 by DevelopmentOnTheEdge.
the class AuthenticationPropagationListener method requestInitialized.
@Override
public void requestInitialized(ServletRequestEvent event) {
HttpServletRequest request = (HttpServletRequest) event.getServletRequest();
HttpSession session = request.getSession(false);
if (session == null) {
return;
}
UserInfo user = (UserInfo) session.getAttribute(SessionConstants.USER_INFO);
UserInfoHolder.setUserInfo(user);
}
use of com.developmentontheedge.be5.api.Request in project be5 by DevelopmentOnTheEdge.
the class TestUtils method getMockRequest.
protected Request getMockRequest(String requestUri) {
Request request = mock(Request.class);
when(request.getRequestUri()).thenReturn(requestUri);
return request;
}
use of com.developmentontheedge.be5.api.Request in project be5 by DevelopmentOnTheEdge.
the class UserHelper method initGuest.
public void initGuest(Request req) {
Locale locale = Locale.US;
String remoteAddr = "";
Session session;
if (req != null) {
locale = req.getLocale();
remoteAddr = req.getRemoteAddr();
session = req.getSession();
} else {
session = new TestSession();
}
if (ModuleLoader2.getDevRoles().size() > 0) {
saveUser("dev", ModuleLoader2.getDevRoles(), ModuleLoader2.getDevRoles(), locale, remoteAddr, session);
} else {
List<String> roles = Collections.singletonList(RoleType.ROLE_GUEST);
saveUser(RoleType.ROLE_GUEST, roles, roles, locale, remoteAddr, session);
}
}
use of com.developmentontheedge.be5.api.Request in project be5 by DevelopmentOnTheEdge.
the class Document method sendError.
private void sendError(Request req, Response res, HashUrl url, Be5Exception e) {
String message = "";
// message += GroovyRegister.getErrorCodeLine(e, query.getQuery());
res.sendErrorAsJson(new ErrorModel(e, message, Collections.singletonMap(SELF_LINK, url.toString())), req.getDefaultMeta());
}
Aggregations