You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "t5.0" <t5...@kochira.com> on 2010/09/08 11:53:23 UTC

Deal with URL as a parameter and redirect

What is the best strategy to deal with a URL given as a parameter to a page,
and then perform a redirect to it, with Tapestry 5.0.x

1. onActivate

@Inject
private Response response;


public void onActivate(String url) {

  ...some processing with url...  

  response.sendRedirect(url);  
}


2. Filter

3. Or ??

Thank you.

-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/Deal-with-URL-as-a-parameter-and-redirect-tp2807631p2807631.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Deal with URL as a parameter and redirect

Posted by Katia Aresti Gonzalez <ka...@gmail.com>.
I don't understand what do you mean about "reverse solution".

What exactly are you trying to do ? Why do you need to pass the URL as an
url  parameter ?


2010/9/9 t5.0 <t5...@kochira.com>

>
> Thanks but I'm looking for the "reverse" solution: handle a URL provided to
> the page.
>
> I tried with a onActivate(url) based page but it seems Tapestry prevents
> the
> URL to be passed as a parameter, since it interprets the '/' as parameter
> separator.
>
> Is there a way for *one* to prevent this interpretation and let a URL be
> specified as a parameter?
>
> (tried by replacing the '/' and ':' with their % equivalents, but the
> problem persists)
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Deal-with-URL-as-a-parameter-and-redirect-tp2807631p2826965.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Deal with URL as a parameter and redirect

Posted by Josh Canfield <jo...@gmail.com>.
How about using a query parameter?

-- Josh

On Sep 8, 2010, at 10:20 PM, "t5.0" <t5...@kochira.com> wrote:

> 
> Thanks but I'm looking for the "reverse" solution: handle a URL provided to
> the page.
> 
> I tried with a onActivate(url) based page but it seems Tapestry prevents the
> URL to be passed as a parameter, since it interprets the '/' as parameter
> separator.
> 
> Is there a way for *one* to prevent this interpretation and let a URL be
> specified as a parameter?
> 
> (tried by replacing the '/' and ':' with their % equivalents, but the
> problem persists)
> 
> -- 
> View this message in context: http://tapestry.1045711.n5.nabble.com/Deal-with-URL-as-a-parameter-and-redirect-tp2807631p2826965.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

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


Re: Deal with URL as a parameter and redirect

Posted by "t5.0" <t5...@kochira.com>.
Thanks but I'm looking for the "reverse" solution: handle a URL provided to
the page.

I tried with a onActivate(url) based page but it seems Tapestry prevents the
URL to be passed as a parameter, since it interprets the '/' as parameter
separator.

Is there a way for *one* to prevent this interpretation and let a URL be
specified as a parameter?

(tried by replacing the '/' and ':' with their % equivalents, but the
problem persists)

-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/Deal-with-URL-as-a-parameter-and-redirect-tp2807631p2826965.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Deal with URL as a parameter and redirect

Posted by Katia Aresti Gonzalez <ka...@gmail.com>.
Concerning to

*"URL given as a parameter to a page"*

Be careful, as this practice is not considered a good idea at all ;)

You can read here why : http://www.owasp.org/index.php/Top_10_2010-A10

Thanks Christophe Cordenier for the tip


2010/9/8 Katia Aresti Gonzalez <ka...@gmail.com>

> Hi,
>
> You can return an URL object and this will perform the redirect like this
> example :
>
> public Object onActivate()
> {
>
>         URL myURL= null;
>
>         try
>         {
>             myURL= new URL("http://www.google.com");
>         }
>         catch (MalformedURLException e)
>         {
>             //logs
>         }
>
>         return myURL;
>     }
>
>
> 2010/9/8 t5.0 <t5...@kochira.com>
>
>
>> What is the best strategy to deal with a URL given as a parameter to a
>> page,
>> and then perform a redirect to it, with Tapestry 5.0.x
>>
>> 1. onActivate
>>
>> @Inject
>> private Response response;
>>
>>
>> public void onActivate(String url) {
>>
>>  ...some processing with url...
>>
>>  response.sendRedirect(url);
>> }
>>
>>
>> 2. Filter
>>
>> 3. Or ??
>>
>> Thank you.
>>
>> --
>> View this message in context:
>> http://tapestry.1045711.n5.nabble.com/Deal-with-URL-as-a-parameter-and-redirect-tp2807631p2807631.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>

Re: Deal with URL as a parameter and redirect

Posted by Katia Aresti Gonzalez <ka...@gmail.com>.
Hi,

You can return an URL object and this will perform the redirect like this
example :

public Object onActivate()
{

        URL myURL= null;

        try
        {
            myURL= new URL("http://www.google.com");
        }
        catch (MalformedURLException e)
        {
            //logs
        }

        return myURL;
    }


2010/9/8 t5.0 <t5...@kochira.com>

>
> What is the best strategy to deal with a URL given as a parameter to a
> page,
> and then perform a redirect to it, with Tapestry 5.0.x
>
> 1. onActivate
>
> @Inject
> private Response response;
>
>
> public void onActivate(String url) {
>
>  ...some processing with url...
>
>  response.sendRedirect(url);
> }
>
>
> 2. Filter
>
> 3. Or ??
>
> Thank you.
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Deal-with-URL-as-a-parameter-and-redirect-tp2807631p2807631.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>