@Test public void testProcessFormSubmissionInvalidActionWithUser() throws Exception { MockHttpServletRequest mockRequest = new MockHttpServletRequest(); mockRequest.addParameter("actionName", "getTaskList"); request = mockRequest; FakeUIFWApplicationState state = new FakeUIFWApplicationState(); User currentUser = new User("test1", new String[] { "test/test1" }, "token1"); state.setCurrentUser(currentUser); request.getSession().setAttribute("APPLICATION_STATE", state); securedController = (SecuredController) context.getBean("tasksController"); try { ModelAndView mav = securedController.processFormSubmission(request, response, null, new BindException(currentUser, "test")); Assert.fail("Invalid Action exception expected"); } catch (Exception e) { } }
@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);  }