If you want to get hold on the actual exception that has been thrown you
need to override the ExceptionResponseStrategy in
DefaultWebRequestCycleProcessor. Do something like this:
In you WebApplication extended class:
@Override
protected IRequestCycleProcessor newRequestCycleProcessor() {
return new MyDefaultWebRequestCycleProcessor();
}
MyDefaultWebRequestCycleProcessor.java:
public class MyDefaultWebRequestCycleProcessor extends
DefaultWebRequestCycleProcessor {
@Override
protected IExceptionResponseStrategy newExceptionResponseStrategy() {
return new IExceptionResponseStrategy() {
public void respond(RequestCycle requestCycle,
RuntimeException e) {
requestCycle.setResponsePage(new
MyExceptionPage(e));
}
};
}
}
And then you can have your exception page:
public class MyExceptionPage extends WebPage {
private static final long serialVersionUID = 1L;
public MyExceptionPage(Throwable throwable) {
add(new Label("title", throwable.getMessage()));
// and whatever you like
}
@Override
protected void configureResponse() {
super.configureResponse();
getWebRequestCycle().getWebResponse().getHttpServletResponse()
.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
@Override
public boolean isErrorPage() {
return true;
}
@Override
public boolean isVersioned() {
return false;
}
}
Regards
Frank Bille
On Tue, 2006-07-11 at 09:30 +0200, Frank Bille Jensen wrote:
> Yes, take a look at IApplicationSettings.setInternalErrorPage().
>
> Frank Bille
>
>
> On Tue, 2006-07-11 at 09:46 +0300, Tymur Porkuyan wrote:
> > Is it possible to override standard Wicket exception page?
> >
> > I would like to throw exceptions on lower levels and have a generic
> > error page that will display messages from custom exceptions and
> > something like "internal error" for system exception.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user