private MockHttpSession httpSession(MockHttpServletRequest request, final String sessionid) { MockHttpSession session; synchronized (this.sessions) { session = this.sessions.get(sessionid); if (session == null) { session = new HtmlUnitMockHttpSession(request, sessionid); session.setNew(true); synchronized (this.sessions) { this.sessions.put(sessionid, session); } addSessionCookie(request, sessionid); } else { session.setNew(false); } } return session; }
private MockHttpSession httpSession(MockHttpServletRequest request, final String sessionid) { MockHttpSession session; synchronized (this.sessions) { session = this.sessions.get(sessionid); if (session == null) { session = new HtmlUnitMockHttpSession(request, sessionid); session.setNew(true); synchronized (this.sessions) { this.sessions.put(sessionid, session); } addSessionCookie(request, sessionid); } else { session.setNew(false); } } return session; }
private MockHttpSession httpSession(MockHttpServletRequest request, final String sessionid) { MockHttpSession session; synchronized (this.sessions) { session = this.sessions.get(sessionid); if (session == null) { session = new HtmlUnitMockHttpSession(request, sessionid); session.setNew(true); synchronized (this.sessions) { this.sessions.put(sessionid, session); } addSessionCookie(request, sessionid); } else { session.setNew(false); } } return session; }
public void testHandleValidatorError() { HttpServletRequest request = getMockRequest(); RequestContextHolder ctx = getRequestContext(); MockHttpSession session = (MockHttpSession) request.getSession(); session.setNew(false); // mark as not new sesssion clearSession(); MockHttpServletResponse response = getMockResponse(); ValidatorError error = new ValidatorError(HDIVErrorCodes.NOT_RECEIVED_ALL_REQUIRED_PARAMETERS); List<ValidatorError> errors = Collections.singletonList(error); validatorErrorHandler.handleValidatorError(ctx, errors); String redirectUrl = response.getRedirectedUrl(); assertEquals(getConfig().getErrorPage(), redirectUrl); }