Hello, all wicket users!
I receive HTTP Status 500 error in this situation:
I have a page with empty html-file and page's onRender() looks like:
OutputStreamWriter writer = null;
try {
writer = new OutputStreamWriter(getResponse().getOutputStream(),
encoding);
String enc = getRequestCycle().getResponse().getCharacterEncoding();
writer.append("<!--" + enc + "-->\n");
writer.append(".....");
} catch (UnsupportedEncodingException ex) {
throw new WicketRuntimeException("Invalid charset: " + ex.getMessage());
} catch (IOException ex) {
throw new WicketRuntimeException("IOException: " + ex.getMessage());
} finally {
if (writer != null) {
try {
writer.close();
} catch (IOException ex) {
}
}
}
The problem is when this first catch is reached (because encoding
desired is sent as a parameter that could be errouneous) and
new WicketRuntimeException("Invalid charset: " + ex.getMessage());
is thrown I see HTTP Status 500 error with this:
ERROR - WicketFilter - closing the buffer error
java.lang.IllegalStateException: getOutputStream() has already been
called for this response
at org.apache.catalina.connector.Response.getWriter(Response.java:610)
at
org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:198)
at
org.apache.wicket.protocol.http.WebResponse.write(WebResponse.java:365)
at
org.apache.wicket.protocol.http.BufferedWebResponse.close(BufferedWebResponse.java:73)
at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:471)
at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
I would like to know is it proper to throw WicketRuntimeException in
such situation.
For example I want to show standart Wicket Error page.
Thank you very much.
-- Tony
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]