Sumanth,

I don't think there is any out-of-the-box solution.

The Referer header is ultimately unreliable unless your users and their
browsers are under your control. Relying on it for a return URL may also
introduce a XSS vulnerability if you aren't careful.

I think you'll probably have to pass some identifier of the return-to page
in the request. For example, each of the requesting pages could @Inject the
page with the button on it, set some @Persist'd property of the injected
page, then redirect to that injected page. That injected page (the page
with the button on it) would then be able to check that property to know
which page requested it. You could also do fancier things with a
session-based map (maybe a ConcurrentHashMap) that stores the return-to
page associated with each request, assigning a unique value (e.g. UUID) to
use as a page ID value that would also serve as the key to the map. That
would especially be needed if your app needs to function properly across
multiple browser tabs.
 On Feb 3, 2015 1:25 PM, "Thiago H de Paula Figueiredo" <thiag...@gmail.com>
wrote:

> On Tue, 03 Feb 2015 16:11:31 -0200, Sumanth <roasteddra...@gmail.com>
> wrote:
>
>  Hello Guys,
>>
>>  I have a page which has a back button. I need to set the "URL" for this
>> back button dynamically depending on which page directed the user to this
>> page.
>>
>> Is there any way of knowing from Which URL was i Redirected from in
>> Tapestry?
>>
>
> Have you tried getting the "Referer" HTTP header from Request?
>
> @Inject
> private Request request;
>
> String url = request.getHeader("Referer");
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to