Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Ampersands in query strings

843835Nov 15 2001 — edited Nov 19 2001
Hi,

I was wondering if anyone has attempted to parse query strings that contain ampersands (&) or equals (=) in the parameter values.

At the moment we have some working code to do this but it is kind of messy and complicated. If possible we would like to make use of Java classes to do this for us. I was thinking along the lines of using some or all of:
Hashtable javax.servlet.http.HttpUtils.parseQueryString( String s)
String java.net.URLDecoder.decode( String s)
String java.net.URLEncoder.encode( String s)
Has anyone managed to implement a parser using these classes? Basically the problem is determining where to split the name/value pairs when the delimiters may be included in the values.

Just to give you an idea, try parsing the following URL

http://someserver/servlet?parm1=val&ue&parm2=val=ue

Craig
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 17 2001
Added on Nov 15 2001
6 comments
658 views