/** * Create the request using the supplied session object. Note that in order for temporary * sessions to work, the supplied session must be an instance of {@link MockHttpSession} * * @param application * The application that this request is for * @param session * The session object * @param context * The current servlet context */ public MockHttpServletRequest(final Application application, final HttpSession session, final ServletContext context) { this.application = application; this.session = session; this.context = context; initialize(); }
/** * Create the request using the supplied session object. Note that in order for temporary * sessions to work, the supplied session must be an instance of {@link MockHttpSession} * * @param application * The application that this request is for * @param session * The session object * @param context * The current servlet context */ public MockHttpServletRequest(final Application application, final HttpSession session, final ServletContext context) { this.application = application; this.session = session; this.context = context; initialize(); }
/** * Reset the request and the response back to a starting state and recreate the necessary wicket * request, response and session objects. The request and response objects can be accessed and * Initialized at this point. * * @param isAjax * indicates whether the request should be initialized as an ajax request (ajax * header "Wicket-Ajax" is set) */ public WebRequestCycle setupRequestAndResponse(boolean isAjax) { servletRequest.initialize(); servletResponse.initialize(); servletRequest.setParameters(parametersForNextRequest); if (isAjax) { servletRequest.addHeader("Wicket-Ajax", "Yes"); } parametersForNextRequest.clear(); wicketRequest = application.newWebRequest(servletRequest); wicketResponse = application.newWebResponse(servletResponse); WebRequestCycle requestCycle = createRequestCycle(); if (!initializeHttpSessionAsTemporary()) application.getSessionStore().bind(wicketRequest, wicketSession); wicketResponse.setAjax(wicketRequest.isAjax()); return requestCycle; }
servletRequest.initialize(); servletResponse.initialize(); servletRequest.addCookies(cookiesOfThisSession);