Hello,
We have in our application the following code:
    /**
     * @see
org.apache.wicket.Application#newRequestCycle(org.apache.wicket.Request,
     *      org.apache.wicket.Response)
     */
    @Override
    public RequestCycle newRequestCycle(final Request request,
            final Response response) {
        return new WebRequestCycle(this, (WebRequest) request,
                (WebResponse) response) {

            @Override
            public Page onRuntimeException(Page page, RuntimeException e) {
                if (DEPLOYMENT.equalsIgnoreCase(getConfigurationType())) {
                    if
(PageExpiredException.class.isAssignableFrom(e.getClass())) {
                        return null;
                    } else {
                        e.printStackTrace();
                        System.out.println(e.getMessage());
                        return new InternalErrorPage(getErrorDisplay(e));
                    }
                } else {
                    // In development we want to see the exception
                    return null;
                }

            }
        };
    }

Also, in our base page we have this
    protected void verifyAccess(PageParameters pageParameters) {
        // Redirect to Login page on invalid access.
        if (!isUserLoggedIn()) {
            throw new RestartResponseAtInterceptPageException(Login.class);
        }
        else if (! isPageAllowed(pageParameters)) {
            String url = pageParameters.getString("url");
            if (url != null) {
                throw new
AbortWithWebErrorCodeException(HttpServletResponse.SC_FORBIDDEN, url);
            }
            else {
                throw new
AbortWithWebErrorCodeException(HttpServletResponse.SC_FORBIDDEN);
            }
        }
    }

'verifyAccess' is called in the construction of the page.

The problem I'm having is when the page is not allowed.
We throw AbortWithWebErrorCodeException.

The user gets a 403 error page.
As expected, the onRuntimeException that configured in the WebApp is not
reached.

I thought to create a RuntimeException that will be thrown instead of the
AbortWithWebErrorCodeException(...) and to analyze it in the
onRuntimeException.
But, is there a way to map the 403 error page to another page? A setting of
the Application or even in the web.xml?

Thanks,



Eyal Golan
egola...@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary

Reply via email to