Search in sources :

Example 6 with Response

use of org.apache.wicket.request.Response in project wicket by apache.

the class AjaxBehaviorEnabledTest method before.

/**
 */
@Before
public void before() {
    final IAuthorizationStrategy strategy = new CustomStrategy();
    tester = new WicketTester(new MockApplication() {

        @Override
        public Session newSession(Request request, Response response) {
            return new WebSession(request) {

                private static final long serialVersionUID = 1L;

                @Override
                public IAuthorizationStrategy getAuthorizationStrategy() {
                    return strategy;
                }
            };
        }
    });
}
Also used : Response(org.apache.wicket.request.Response) WebSession(org.apache.wicket.protocol.http.WebSession) MockApplication(org.apache.wicket.mock.MockApplication) Request(org.apache.wicket.request.Request) WicketTester(org.apache.wicket.util.tester.WicketTester) IAuthorizationStrategy(org.apache.wicket.authorization.IAuthorizationStrategy) Before(org.junit.Before)

Example 7 with Response

use of org.apache.wicket.request.Response in project wicket by apache.

the class ResponseIOExceptionTest method before.

/**
 * @throws Exception
 */
@Before
public void before() throws Exception {
    tester = new WicketTester() {

        @Override
        protected Response newServletWebResponse(ServletWebRequest servletWebRequest) {
            return new ProblematicResponse(servletWebRequest, getResponse());
        }
    };
    tester.setExposeExceptions(false);
}
Also used : HttpServletResponse(javax.servlet.http.HttpServletResponse) ServletWebResponse(org.apache.wicket.protocol.http.servlet.ServletWebResponse) Response(org.apache.wicket.request.Response) WicketTester(org.apache.wicket.util.tester.WicketTester) ServletWebRequest(org.apache.wicket.protocol.http.servlet.ServletWebRequest) Before(org.junit.Before)

Example 8 with Response

use of org.apache.wicket.request.Response in project wicket by apache.

the class PartialPageUpdate method writeHeaderContribution.

/**
 * @param response
 *      the response to write to
 * @param component
 *      to component which will contribute to the header
 */
protected void writeHeaderContribution(final Response response, final Component component) {
    headerRendering = true;
    // create the htmlheadercontainer if needed
    if (header == null) {
        header = new PartialHtmlHeaderContainer(this);
        page.addOrReplace(header);
    }
    RequestCycle requestCycle = component.getRequestCycle();
    // save old response, set new
    Response oldResponse = requestCycle.setResponse(headerBuffer);
    try {
        headerBuffer.reset();
        IHeaderRenderStrategy strategy = AbstractHeaderRenderStrategy.get();
        strategy.renderHeader(header, null, component);
    } finally {
        // revert to old response
        requestCycle.setResponse(oldResponse);
    }
    writeHeaderContribution(response);
    headerRendering = false;
}
Also used : WebResponse(org.apache.wicket.request.http.WebResponse) Response(org.apache.wicket.request.Response) HeaderResponse(org.apache.wicket.markup.head.internal.HeaderResponse) IHeaderResponse(org.apache.wicket.markup.head.IHeaderResponse) RequestCycle(org.apache.wicket.request.cycle.RequestCycle) IRequestCycle(org.apache.wicket.request.IRequestCycle) IHeaderRenderStrategy(org.apache.wicket.markup.renderStrategy.IHeaderRenderStrategy)

Example 9 with Response

use of org.apache.wicket.request.Response in project wicket by apache.

the class CookieUtils method getWebResponse.

/**
 * Convenience method to get the http response.
 *
 * @return WebResponse related to the RequestCycle
 */
private WebResponse getWebResponse() {
    RequestCycle cycle = RequestCycle.get();
    Response response = cycle.getResponse();
    if (!(response instanceof WebResponse)) {
        response = cycle.getOriginalResponse();
    }
    return (WebResponse) response;
}
Also used : WebResponse(org.apache.wicket.request.http.WebResponse) Response(org.apache.wicket.request.Response) WebResponse(org.apache.wicket.request.http.WebResponse) RequestCycle(org.apache.wicket.request.cycle.RequestCycle)

Example 10 with Response

use of org.apache.wicket.request.Response in project wicket by apache.

the class NonResettingRestartException method transferResponseMetaData.

private void transferResponseMetaData() {
    RequestCycle cycle = RequestCycle.get();
    Response response = cycle.getResponse();
    if (response instanceof IMetaDataBufferingWebResponse) {
        WebResponse originalResponse = (WebResponse) cycle.getOriginalResponse();
        if (originalResponse != response) {
            IMetaDataBufferingWebResponse bufferingWebResponse = (IMetaDataBufferingWebResponse) response;
            bufferingWebResponse.writeMetaData(originalResponse);
        }
    }
}
Also used : HttpServletResponse(javax.servlet.http.HttpServletResponse) WebResponse(org.apache.wicket.request.http.WebResponse) IMetaDataBufferingWebResponse(org.apache.wicket.protocol.http.IMetaDataBufferingWebResponse) Response(org.apache.wicket.request.Response) IMetaDataBufferingWebResponse(org.apache.wicket.protocol.http.IMetaDataBufferingWebResponse) WebResponse(org.apache.wicket.request.http.WebResponse) IMetaDataBufferingWebResponse(org.apache.wicket.protocol.http.IMetaDataBufferingWebResponse) RequestCycle(org.apache.wicket.request.cycle.RequestCycle)

Aggregations

Response (org.apache.wicket.request.Response)30 IHeaderResponse (org.apache.wicket.markup.head.IHeaderResponse)9 WebResponse (org.apache.wicket.request.http.WebResponse)9 StringResponse (org.apache.wicket.response.StringResponse)9 Request (org.apache.wicket.request.Request)8 RequestCycle (org.apache.wicket.request.cycle.RequestCycle)8 HeaderResponse (org.apache.wicket.markup.head.internal.HeaderResponse)5 HttpServletResponse (javax.servlet.http.HttpServletResponse)4 WicketRuntimeException (org.apache.wicket.WicketRuntimeException)4 MockApplication (org.apache.wicket.mock.MockApplication)4 Before (org.junit.Before)4 Session (org.apache.wicket.Session)3 IRequestCycle (org.apache.wicket.request.IRequestCycle)3 WicketTester (org.apache.wicket.util.tester.WicketTester)3 Test (org.junit.Test)3 Component (org.apache.wicket.Component)2 WebSession (org.apache.wicket.protocol.http.WebSession)2 Member (com.hazelcast.core.Member)1 MemberAttributeEvent (com.hazelcast.core.MemberAttributeEvent)1 MembershipEvent (com.hazelcast.core.MembershipEvent)1