You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Blower, Andy" <An...@proquest.co.uk> on 2009/06/12 22:23:37 UTC

T5 enhancement: Redirecting from ComponentEventLinkEncoder.decodePageRenderRequest()

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;
}

Re: T5 enhancement: Redirecting from ComponentEventLinkEncoder.decodePageRenderRequest()

Posted by Massimo Lusetti <ml...@gmail.com>.
On Fri, Jun 12, 2009 at 10:23 PM, Blower,
Andy<An...@proquest.co.uk> wrote:

> 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;
> }
>

Why not extend the pipeline of dispatchers to accomplish this?

I'm very interested in a totally T5 generally available solution to
access/authorization mechanism..

-- 
Massimo
http://meridio.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org