In fact, this is a better solution if you have an activation context.

So to achieve this, we still may use the "ComponentResources" class and its 
"createPageLink" method

Christophe.

-----Message d'origine-----
De : Stephane Decleire [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 14 mars 2008 12:05
À : Tapestry users
Objet : Re: Redirect on login

I would recommend to store a Link (which can contain the page name and
the context of the request) and return this link in the success method.

Stephane

Cordenier Christophe a écrit :
> Why do you not store the page name instead of the request Path and then 
> returning the page name in the success method ?
>
> As your success method return an Object you can return a String containing 
> the requested page name...
>
> @Inject
> ComponentResources resources;
>
> ...
>
> // Store this in application state
> resources.getPageName();
>
>
> Hope this helps
>
> Christophe.
>
> -----Message d'origine-----
> De : Gabriel Landais [mailto:[EMAIL PROTECTED]
> Envoyé : vendredi 14 mars 2008 11:36
> À : Tapestry users
> Objet : Redirect on login
>
> Hi,
>  when a user try to connect to my app, it checks if user is logged.
> I'm trying to redirect him to page is was trying to access, but I don't
> know how to do it in Tapestry way. With plain old sendRedirect of
> servlet response it works, but not as clean as it should.
> All pages inherits of this page :
>
>     @ApplicationState
>     private SimExplorerState applicationState;
>
>     Object onActivate() throws SimExplorerException {
>         [...]
>         if (!userLogged) {
>             String fromURL = requestGlobals.getRequest().getPath(); //
> get url being tried
>             applicationState.setRequestedURL(fromURL); // save it in
> application state of user
>             return "Login"; // redirect to login page
>         }
>         [...]
>         return null;
>     }
>
> Then in Login :
>
>     public Object onSuccessFromFormLogin() throws SimExplorerException,
> IOException {
>         [...]
>         if (success) {
>             [...]
>             String fromURL = applicationState.getRequestedURL();
>             if (fromURL == null) {
>                 return elementList;
>             }
>             //return fromURL.substring(1); // doesn't work, as context
> is then included in page name
>             requestGlobals.getResponse().sendRedirect(fromURL); // bad
> as Tapestry will try to commit data again in response afterwards....
>             return null;
>         }
>         return this;
>     }
>
> Thanks for any advice!
>
> --
> Gabriel <[EMAIL PROTECTED]>
> http://www.codelutin.com
> tel : 02 40 50 29 28 / fax : 09 59 92 29 28
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
> Ce message et les pièces jointes sont confidentiels et réservés à l'usage 
> exclusif de ses destinataires. Il peut également être protégé par le secret 
> professionnel. Si vous recevez ce message par erreur, merci d'en avertir 
> immédiatement l'expéditeur et de le détruire. L'intégrité du message ne 
> pouvant être assurée sur Internet, la responsabilité du groupe Atos Origin ne 
> pourra être recherchée quant au contenu de ce message. Bien que les meilleurs 
> efforts soient faits pour maintenir cette transmission exempte de tout virus, 
> l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne 
> saurait être recherchée pour tout dommage résultant d'un virus transmis.
>
> This e-mail and the documents attached are confidential and intended solely 
> for the addressee; it may also be privileged. If you receive this e-mail in 
> error, please notify the sender immediately and destroy it. As its integrity 
> cannot be secured on the Internet, the Atos Origin group liability cannot be 
> triggered for the message content. Although the sender endeavours to maintain 
> a computer virus-free network, the sender does not warrant that this 
> transmission is virus-free and will not be liable for any damages resulting 
> from any virus transmitted.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Ce message et les pièces jointes sont confidentiels et réservés à l'usage 
exclusif de ses destinataires. Il peut également être protégé par le secret 
professionnel. Si vous recevez ce message par erreur, merci d'en avertir 
immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant 
être assurée sur Internet, la responsabilité du groupe Atos Origin ne pourra 
être recherchée quant au contenu de ce message. Bien que les meilleurs efforts 
soient faits pour maintenir cette transmission exempte de tout virus, 
l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne 
saurait être recherchée pour tout dommage résultant d'un virus transmis.

This e-mail and the documents attached are confidential and intended solely for 
the addressee; it may also be privileged. If you receive this e-mail in error, 
please notify the sender immediately and destroy it. As its integrity cannot be 
secured on the Internet, the Atos Origin group liability cannot be triggered 
for the message content. Although the sender endeavours to maintain a computer 
virus-free network, the sender does not warrant that this transmission is 
virus-free and will not be liable for any damages resulting from any virus 
transmitted.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to