Re: Redirect to URL with params
Hi, It not works, because I redirect to an external URL with params. So I don't know if I must use Response object, and if so how to pass params to it? Thanks in advance.
Re: Redirect to URL with params
On Fri, 26 Nov 2010 07:20:19 -0200, Gnu Ubuntu gnu.ubu...@gmail.com wrote: Hi, Hi! It not works, because I redirect to an external URL with params. So I don't know if I must use Response object, Absolutely no. Just return a new java.net.URL() instance passing all the params in your onActivate(). What do you mean by it doesn't work? -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Redirect to URL with params
To redirect to an external site, your onActivate() on onActionFromActionLink() method can return a java.net.URL: PageA.java: @Inject private Request request; @Inject private PageRenderLinkSource prls; public URL onActivate() { String value1 = request.getParam(key1); String value2 = // Do something with these, then: String externalPage = http://externalsite.com/dir/page?key1=; + value1 + key2= + value2 +... ; URL url = new URL(externalPage); return url; } Obviously make sure your values are appropriately url encoded. -Original Message- From: Gnu Ubuntu gnu.ubu...@gmail.com Reply-to: Tapestry users users@tapestry.apache.org To: Tapestry users users@tapestry.apache.org, r...@su3analytics.com Subject: Re: Redirect to URL with params Date: Fri, 26 Nov 2010 10:20:19 +0100 Hi, It not works, because I redirect to an external URL with params. So I don't know if I must use Response object, and if so how to pass params to it? Thanks in advance. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Redirect to URL with params
How about using onActivate onPassivate. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Redirect-to-URL-with-params-tp3279834p3282143.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Redirect to URL with params
Hi! I need to redirect user to an url with some parameters (simulate a post without form). Can you help me to do that, please ? Thanks in advance.
Re: Redirect to URL with params
Can you be a little more explicit: You want a GET request (instead of a POST) to trigger a redirect? Does the original GET or the redirect contain url parameters? Or both? Do either of them have an activation context? -Original Message- From: Gnu Ubuntu gnu.ubu...@gmail.com Reply-to: Tapestry users users@tapestry.apache.org To: users@tapestry.apache.org Subject: Redirect to URL with params Date: Thu, 25 Nov 2010 11:24:04 +0100 Hi! I need to redirect user to an url with some parameters (simulate a post without form). Can you help me to do that, please ? Thanks in advance. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Redirect to URL with params
Thanks Richard for your response. What I want is to do a post request but my page dosn't contain any form. The user will be redirected to an URL with some parameters and after that I must get some other parameters from the response. I hope that is more clear now. Thanks.
Re: Redirect to URL with params
Ok so, if I follow correctly: Page A: Doesn't have a form. So instead you have a normal link. This contains as url parameters the data to be sent. After processing you want to redirect to Page B. So you could do something like this: PageA.java: @Inject private Request request; @Inject private PageRenderLinkSource prls; public Link onActivate() { String value1 = request.getParam(key1); String value2 = // Do something with these Link link = prls.createPageRenderLink(PageB.class); link.addParameter(key1, value1); ... return link; } If the processing is done by PageA as above, you'll need some logic in onActivate() that determines whether you redirect or render the page (returning null will mean that PageA is rendered). Or instead of a t:pagelink in PageA you could use an t:actionlink instead, and return the Link in the onActionFromYourLink(). Hope that helps. -Original Message- From: Gnu Ubuntu gnu.ubu...@gmail.com Reply-to: Tapestry users users@tapestry.apache.org To: Tapestry users users@tapestry.apache.org, r...@su3analytics.com Subject: Re: Redirect to URL with params Date: Thu, 25 Nov 2010 11:56:15 +0100 Thanks Richard for your response. What I want is to do a post request but my page dosn't contain any form. The user will be redirected to an URL with some parameters and after that I must get some other parameters from the response. I hope that is more clear now. Thanks. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Redirect to URL with params
Thanks Richard, I'll try that. 2010/11/25 Richard Hill r...@su3analytics.com Ok so, if I follow correctly: Page A: Doesn't have a form. So instead you have a normal link. This contains as url parameters the data to be sent. After processing you want to redirect to Page B. So you could do something like this: PageA.java: @Inject private Request request; @Inject private PageRenderLinkSource prls; public Link onActivate() { String value1 = request.getParam(key1); String value2 = // Do something with these Link link = prls.createPageRenderLink(PageB.class); link.addParameter(key1, value1); ... return link; } If the processing is done by PageA as above, you'll need some logic in onActivate() that determines whether you redirect or render the page (returning null will mean that PageA is rendered). Or instead of a t:pagelink in PageA you could use an t:actionlink instead, and return the Link in the onActionFromYourLink(). Hope that helps. -Original Message- From: Gnu Ubuntu gnu.ubu...@gmail.com Reply-to: Tapestry users users@tapestry.apache.org To: Tapestry users users@tapestry.apache.org, r...@su3analytics.com Subject: Re: Redirect to URL with params Date: Thu, 25 Nov 2010 11:56:15 +0100 Thanks Richard for your response. What I want is to do a post request but my page dosn't contain any form. The user will be redirected to an URL with some parameters and after that I must get some other parameters from the response. I hope that is more clear now. Thanks. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org