On Thu, 01 Aug 2013 16:18:53 -0300, Nomen Nominus <geribi...@outlook.com> wrote:

Hi Thiago!

Hi!

My code handles properly all event URL's, however not in the following scenario:

So it doesn't handles all scenarios. :) You're contradicting yourself in a single sentence. :P

Also, how could I change to ComponentEventLinkEncoder, change what?

Just inject it and Request and use the ComponentEventLinkEncoder.decode() methods instead of your URl parsing code. They'll tell you, in their return values, what page was requested. Again, don't implement something that is already implemented. You're just wasting your time in this case.


To: users@tapestry.apache.org
Subject: Re: Index broken reference
Date: Mon, 29 Jul 2013 07:56:18 -0300
From: thiag...@gmail.com

On Sun, 28 Jul 2013 17:15:08 -0300, Nomen Nominus <geribi...@outlook.com>
wrote:

> My code for links is just fine, and I see no reason why it's not working
> in the one case, and works in the next.

Your Dispatcher may not be working in 100% of the situations.

> Maybe, following code is
> public class ProtectPageService implements Dispatcher {

Dispatchers are supposed to return content in requests. This is not the
case here, so you can write a Dispatcher and make it work, but writing a
RequestFilter would be more adequate

>
>     private final static String LOGIN_PAGE = "/";
>     private ApplicationStateManager applicationStateManager;
>     private final ComponentClassResolver componentClassResolver;
>     private final ComponentSource componentSource;
>
>     public ProtectPageService(ApplicationStateManager asm,
> ComponentClassResolver resolver, ComponentSource componentSource) {
>         this.applicationStateManager = asm;
>         this.componentClassResolver = resolver;
>         this.componentSource = componentSource;
>     }
>
>     public boolean dispatch(Request request, Response response) throws
> IOException {
>         /*
> * We need to get the Tapestry page requested by the user. So we
> parse the path extracted from the request
>          */

You're trying to parse URLs yourself. That's a bad idea: First, you don't
need to: the ComponentEventLinkEncoder service and its decode() methods
already do that for you. That's exactly what Tapestry itself uses. Second, *your code* is probably not handling event URLs correctly. Just change it
to using ComponentEventLinkEncoder and it'll work.

--
Thiago H. de Paula Figueiredo

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

                                        


--
Thiago H. de Paula Figueiredo

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

Reply via email to