• Post Reply Bookmark Topic Watch Topic
  • New Topic

URL encoding/decoding  RSS feed

 
Robert Garrido
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranch people,


I'm implementing a filter with HTTPCLIENT that processes requests from many sources, and I always do a redirection at the end, the problem I have is that some request are encoded with:

URLEncoder.encode(reqString, "UTF-8");

others not, so in my filter those that are not encoded work properly with:

httpMethod.setURI(new URI(resourcePath.toString(), false));

and those that are encoded work properly with:

httpMethod.setURI(new URI(resourcePath.toString(), true));

How can I know whether or not an incoming request was encoded? or How can I deal with this?

Thanks in advanced!

 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you create a boolean flag to indicate that string is encoded or not? Then use this flag for the setURI method.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!