You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Chris Shenton <Ch...@hq.nasa.gov> on 2002/01/17 23:32:50 UTC
Passing a URL in as path info, stops at "/", even when encoded
I'm working on a proxy-type application. The app generates a page
with links pointing at my Turbine app and path info which specifies a
URL with the actual content to be retrieved. Like this, inside angle brackets:
A HREF="http://palimpsest.it.hq.nasa.gov:8080/sna/servlet/Turbine/action/Proxy/url/http%3A%2F%2Fwww.google.com%2Fads%2F"
Initially, I just tacked on the normal URL but found that
ParameterParser was getting variable "url" (above) as just "http:".
I realized that Turbine was using the slashes in the full URL as
attribute/value separators. So I used URLEncoder before affixing the
target URL to my path, as you see above. But ParameterParser is still
seeing only the "http:" part, as if it's gratuitously decode()ing the
incoming URL string before parsing it.
Here's how the Proxy.doPerform is getting at the parameter, and then
putting it in my context for display:
ParameterParser pp = data.getParameters();
java.util.Enumeration keys = pp.keys();
while (keys.hasMoreElements()) {
String key = keys.nextElement().toString();
data.addMessage(" key=`" + key + "'");
data.addMessage(",val=`" + pp.getString(key) + "'");
}
And the template emits it with a simple:
$data.getMessage();
Which gets rendered, in part, as:
key=`template',val=`Proxy.vm'
key=`action',val=`Proxy'
key=`url',val=`http:'
key=`www.google.com',val=`ads'
Any suggestions how I get it to leave embedded slashes in an argument?
Thanks.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Passing a URL in as path info, stops at "/", even when encoded
Posted by Chris Shenton <Ch...@hq.nasa.gov>.
Rodney Schneider <rl...@arcalink.com> writes:
> Have you tried encoding the slashes in your QUERY_DATA arguments? If this
> doesn't work, you will have to replace them with another character, and do a
> "find and replace" on the server. Alternatively, you could write your own
> ParameterParser that leaves PATH_INFO intact. Then you would have to use
> QUERY_DATA or POST for all the request parameters in your Turbine app.
I had encoded the URL with URLEndcoder.encode() when I was using
PATH_INFO, but Turbine still saw the slashes, and therefore split
variables and values on those internal slashes. I used your
QUERY_DATA suggestion, still with the URLEncoded URL to be safe, and
it works great. Now full URLs look like:
http://palimpsest:8080/sna/servlet/Turbine/action/Proxy?url=http%3A%2F%2Fexample.com%2index.html
and the ParameterParser sees variable name "url" with the right value,
automatically URL-decoding it.
Many thanks.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Passing a URL in as path info, stops at "/", even when encoded
Posted by Rodney Schneider <rl...@arcalink.com>.
Hi Chris,
Have you tried encoding the slashes in your QUERY_DATA arguments? If this
doesn't work, you will have to replace them with another character, and do a
"find and replace" on the server. Alternatively, you could write your own
ParameterParser that leaves PATH_INFO intact. Then you would have to use
QUERY_DATA or POST for all the request parameters in your Turbine app.
Regards,
-- Rodney
On Saturday 19 January 2002 08:26 am, you wrote:
> Chris> Any suggestions how I get it to leave embedded slashes in an
> argument?
>
> Rodney Schneider <rl...@arcalink.com> writes:
> > Try using QUERY_DATA instead of PATH_INFO for the URL argument.
>
> Beauty, eh! Works great.
>
> Thanks!
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Passing a URL in as path info, stops at "/", even when encoded
Posted by Chris Shenton <Ch...@hq.nasa.gov>.
Chris> Any suggestions how I get it to leave embedded slashes in an argument?
Rodney Schneider <rl...@arcalink.com> writes:
> Try using QUERY_DATA instead of PATH_INFO for the URL argument.
Beauty, eh! Works great.
Thanks!
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Passing a URL in as path info, stops at "/", even when encoded
Posted by Rodney Schneider <rl...@arcalink.com>.
On Friday 18 January 2002 09:32 am, you wrote:
> Any suggestions how I get it to leave embedded slashes in an argument?
Try using QUERY_DATA instead of PATH_INFO for the URL argument.
Hope that helps,
-- Rodney
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>