use of com.agiletec.aps.system.services.controller.ControllerManager in project entando-core by entando.
the class ControllerServlet method controlRequest.
protected int controlRequest(HttpServletRequest request, RequestContext reqCtx) {
ControllerManager controller = (ControllerManager) ApsWebApplicationUtils.getBean(SystemConstants.CONTROLLER_MANAGER, request);
int status = controller.service(reqCtx);
return status;
}
use of com.agiletec.aps.system.services.controller.ControllerManager in project entando-core by entando.
the class TestControllerManager method testService_2.
public void testService_2() throws ApsSystemException {
RequestContext reqCtx = this.getRequestContext();
ControllerManager controller = (ControllerManager) this.getService(SystemConstants.CONTROLLER_MANAGER);
MockHttpServletRequest request = (MockHttpServletRequest) reqCtx.getRequest();
request.setServletPath("/it/customers_page.page");
int status = controller.service(reqCtx);
assertEquals(ControllerManager.REDIRECT, status);
request.setParameter("username", "admin");
request.setParameter("password", "admin");
request.setServletPath("/it/customers_page.page");
status = controller.service(reqCtx);
assertEquals(ControllerManager.OUTPUT, status);
}
use of com.agiletec.aps.system.services.controller.ControllerManager in project entando-core by entando.
the class TestControllerManager method testService_1.
public void testService_1() throws ApsSystemException {
RequestContext reqCtx = this.getRequestContext();
ControllerManager controller = (ControllerManager) this.getService(SystemConstants.CONTROLLER_MANAGER);
MockHttpServletRequest request = (MockHttpServletRequest) reqCtx.getRequest();
request.setServletPath("/it/homepage.page");
int status = controller.service(reqCtx);
assertEquals(ControllerManager.OUTPUT, status);
request.setParameter("username", "admin");
request.setParameter("password", "admin");
status = controller.service(reqCtx);
assertEquals(ControllerManager.OUTPUT, status);
}
use of com.agiletec.aps.system.services.controller.ControllerManager in project entando-core by entando.
the class TestControllerManager method testService_3.
public void testService_3() throws ApsSystemException {
RequestContext reqCtx = this.getRequestContext();
ControllerManager controller = (ControllerManager) this.getService(SystemConstants.CONTROLLER_MANAGER);
MockHttpServletRequest request = (MockHttpServletRequest) reqCtx.getRequest();
request.setServletPath("/it/administrators_page.page");
request.setRequestURI("/Entando/it/customers_page.page");
int status = controller.service(reqCtx);
assertEquals(ControllerManager.REDIRECT, status);
String redirectUrl = (String) reqCtx.getExtraParam(RequestContext.EXTRAPAR_REDIRECT_URL);
assertTrue(redirectUrl.contains("/Entando/it/login.page?"));
assertTrue(redirectUrl.contains("redirectflag=1"));
assertTrue(redirectUrl.contains("returnUrl="));
assertTrue(redirectUrl.contains("customers_page.page"));
request.setParameter(RequestContext.PAR_REDIRECT_FLAG, "1");
status = controller.service(reqCtx);
assertEquals(ControllerManager.REDIRECT, status);
redirectUrl = (String) reqCtx.getExtraParam(RequestContext.EXTRAPAR_REDIRECT_URL);
assertEquals("http://www.entando.com/Entando/it/errorpage.page", redirectUrl);
}
Aggregations