The WOApplication class (WebApplication in Java) provides the following methods that you can override to show your own error page.
public Response handleException(java.lang.Throwable anException) { Response response = new Response(); Request request = context().request(); String newURL = "http://" + request.applicationHost() + request.adaptorPrefix() + "/" + request.applicationName() + ".woa/-/ErrorPage.wo"; response.setHeader(newURL, "location"); response.setHeader("text/html", "content-type"); response.setHeader("0", "content-length"); response.setStatus(302); return response; }Notice that this method, and all of the error-handling methods, return a WOResponse object instead of a WOComponent object. It creates the response by directly setting the URL in the HTTP header to point to the component that it wants to return (in this case, the component is named ErrorPage). Notice how you can retrieve much of the information about the application URL through the current request object, which you can access from the current context object.
Table of Contents Next Section