@Test public void testProcessFormSubmissionWithoutUser() throws Exception { securedController = (SecuredController) context.getBean("tasksController"); ModelAndView mav = securedController.processFormSubmission(request, response, null, null); Assert.assertTrue(mav.getView().toString().contains(Constants.LOGIN_URL)); }
@Override protected final ModelAndView processFormSubmission(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { ApplicationState state = getApplicationState(request); User currentUser = state.getCurrentUser(); if (currentUser != null) { return super.processFormSubmission(request, response, command, errors); } state.setPreviousAction(request.getRequestURL().toString()); return Constants.REDIRECTION_TO_LOGIN; }
SecuredController extends UIController { @Override protected final ModelAndView processFormSubmission(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { ApplicationState state = getApplicationState(request); User currentUser = state.getCurrentUser(); if (currentUser != null) { return super.processFormSubmission(request, response, command, errors); } state.setPreviousAction(request.getRequestURL().toString()); return Constants.REDIRECTION_TO_LOGIN; } }
SecuredController extends UIController { @Override protected final ModelAndView processFormSubmission(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { ApplicationState state = getApplicationState(request); User currentUser = state.getCurrentUser(); if (currentUser != null) { return super.processFormSubmission(request, response, command, errors); } state.setPreviousAction(request.getRequestURL().toString()); return Constants.REDIRECTION_TO_LOGIN; }  }
SecuredController extends UIController { @Override protected final ModelAndView processFormSubmission(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { ApplicationState state = getApplicationState(request); User currentUser = state.getCurrentUser(); if (currentUser != null) { return super.processFormSubmission(request, response, command, errors); } state.setPreviousAction(request.getRequestURL().toString()); return Constants.REDIRECTION_TO_LOGIN; }  static String getCurrentUserName(HttpServletRequest request); }
SecuredController extends UIController { @Override protected final ModelAndView processFormSubmission(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { ApplicationState state = getApplicationState(request); User currentUser = state.getCurrentUser(); if (currentUser != null) { return super.processFormSubmission(request, response, command, errors); } state.setPreviousAction(request.getRequestURL().toString()); return Constants.REDIRECTION_TO_LOGIN; }  static String getCurrentUserName(HttpServletRequest request);  }