You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Graham Leggett <mi...@sharp.fm> on 2001/11/12 12:47:02 UTC

escape a URL within a sevlet - how?

Hi all,

I am trying to generate a set of name/value pairs that will be tacked
onto the end of a generated URL like this:

url.html?name1=value1&name2=value2

These name value pairs have to be escaped first (problem characters
converted to %HH) before they are added to the URL - I am looking for an
object within either the servlet or jsp classes that will do this for me
(I cannot find such an object in the docs, although I might be looking
through it).

Can anyone point out an object I can use?

Regards,
Graham
-- 
-----------------------------------------
minfrin@sharp.fm		"There's a moon
					over Bourbon Street
						tonight..."

RE: escape a URL within a sevlet - how?

Posted by Steve Vu <st...@yahoo.com>.
You might try something like the encode(String) method from the
java.net.URLEncoder class or search through the Java API docs.  I'm not sure
if the method you're looking will be found in the HttpServlet class.  Good
luck and let me know how it tuns out.

-----Original Message-----
From: minfrin [mailto:minfrin]On Behalf Of Graham Leggett
Sent: Monday, November 12, 2001 3:47 AM
To: Tomcat User
Subject: escape a URL within a sevlet - how?


Hi all,

I am trying to generate a set of name/value pairs that will be tacked
onto the end of a generated URL like this:

url.html?name1=value1&name2=value2

These name value pairs have to be escaped first (problem characters
converted to %HH) before they are added to the URL - I am looking for an
object within either the servlet or jsp classes that will do this for me
(I cannot find such an object in the docs, although I might be looking
through it).

Can anyone point out an object I can use?

Regards,
Graham
--
-----------------------------------------
minfrin@sharp.fm		"There's a moon
					over Bourbon Street
						tonight..."


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


RE: escape a URL within a sevlet - how?

Posted by Greg Trasuk <st...@on.aibn.com>.
Hi Graham:

	Java has what you need as part of the standard API:

	String EncodedStr = java.lang.URLEncoder.encode(PlainStr);

Cheers,

Greg Trasuk, President
StratusCom Manufacturing Systems Inc. - We use information technology to
solve business problems on your plant floor.
http://stratuscom.ca

> -----Original Message-----
> From: minfrin@cameron.trasukg.lara.on.ca
> [mailto:minfrin@cameron.trasukg.lara.on.ca]On Behalf Of Graham Leggett
> Sent: Monday, November 12, 2001 6:47 AM
> To: Tomcat User
> Subject: escape a URL within a sevlet - how?
>
>
> Hi all,
>
> I am trying to generate a set of name/value pairs that will be tacked
> onto the end of a generated URL like this:
>
> url.html?name1=value1&name2=value2
>
> These name value pairs have to be escaped first (problem characters
> converted to %HH) before they are added to the URL - I am
> looking for an
> object within either the servlet or jsp classes that will do
> this for me
> (I cannot find such an object in the docs, although I might be looking
> through it).
>
> Can anyone point out an object I can use?
>
> Regards,
> Graham
> --
> -----------------------------------------
> minfrin@sharp.fm		"There's a moon
> 					over Bourbon Street
> 						tonight..."


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>