I recently moved authentication for our project in method advice for the 
ComponentEventLinkEncoder method decodePageRenderRequest() because some other 
method advice to the same method has some modified URL processing and it saves 
duplicating it in an authentication dispatcher. In some situations this method 
advice needs to redirect to a single sign on server rather than render a page, 
so I have had to override the standard T5 PageRenderDispatcher to allow this.

Does anyone else think this is more generally useful and might be a good 
enhancement to the standard T5 PageRenderDispatcher? Or is this a very specific 
edge case? I'm tempted to raise a JIRA issue, but thought I'd test the water 
first.


The code uses an extension of EmptyEventContext called RedirectEventContext to 
indicate a redirect should take place (bit of hack to avoid API change) and 
looks like this:

public boolean dispatch(Request request, Response response) throws IOException
{
                PageRenderRequestParameters parameters = 
linkEncoder.decodePageRenderRequest(request);

                if (parameters == null)  return false;

                if (parameters.getActivationContext() instanceof 
RedirectEventContext)           // New block
                {
                                
response.sendRedirect(parameters.getLogicalPageName());
                                return true;
                }

                componentRequestHandler.handlePageRender(parameters);

                return true;
}

Reply via email to