You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Meier (JIRA)" <ji...@apache.org> on 2017/03/14 12:31:41 UTC

[jira] [Resolved] (WICKET-4433) Exception (Header was already written to response!) when setting response page in IRequestCycleListener

     [ https://issues.apache.org/jira/browse/WICKET-4433?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sven Meier resolved WICKET-4433.
--------------------------------
    Resolution: Won't Fix

A custom IRequestMapper should be used to map requests to specific handlers.

IRequestCycleListener#onBeginRequest() may not throw a ReplaceHandlerException, and with a custom mapper there's no need to change that.

> Exception (Header was already written to response!) when setting response page in IRequestCycleListener
> -------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4433
>                 URL: https://issues.apache.org/jira/browse/WICKET-4433
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.5.4
>            Reporter: Neil Curzon
>         Attachments: myproject.zip, myproject.zip
>
>
> We have an IRequestCycleListener implementation that's basically:
> 	@Override
> 	public void onBeginRequest(RequestCycle cycle) {
> 		if (<condition>)) {
> 			cycle.setResponsePage(SpecificPage.class);
> 		}
> 	}
> This results in an exception when the condition is true, and the response page is set:
> java.lang.IllegalStateException: Header was already written to response!
> 	at org.apache.wicket.protocol.http.HeaderBufferingWebResponse.checkHeader(HeaderBufferingWebResponse.java:64)
> 	at org.apache.wicket.protocol.http.HeaderBufferingWebResponse.setDateHeader(HeaderBufferingWebResponse.java:134)
> 	at org.apache.wicket.protocol.http.BufferedWebResponse$SetDateHeaderAction.invoke(BufferedWebResponse.java:310)
> 	at org.apache.wicket.protocol.http.BufferedWebResponse.writeTo(BufferedWebResponse.java:580)
> 	at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:185)
> 	at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
> 	at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:781)
> 	at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> 	at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:304)
> 	at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:313)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)