aspose file tools*
The moose likes Tomcat and the fly likes URL encoding gives 404 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "URL encoding gives 404" Watch "URL encoding gives 404" New topic
Author

URL encoding gives 404

Bill Goldsworthy
Greenhorn

Joined: Dec 21, 2004
Posts: 27
I'm running Tomcat 5 on JDK 1.5

I'm getting 404 errors for requests when the URL is encoded which doesn't make sense to me.

i.e.

/mypage.htm?page=A works

/mypage.htm%3fpage=A 404

Shouldn't this be handled automatically by tomcat? I've read the connector configuration docs but haven't been able to resolve this. I added URIEncoding="UTF-8" to my connectors but I don't believe this is even a UTF-8 encoding but ISO-Latin.

I tried URIEncoding="ISO-Latin1" (ISOLatin, ISOLatin1 etc.) to no avail.

Any ideas?

TIA,
Bill


Increasingly, people seem to misinterpret complexity as sophistication, which is baffling - the incomprehensible should cause suspicion rather than admiration. Possibly this trend results from a mistaken belief that using a somewhat mysterious device confers an aura of power on the user. Niklaus Wirth
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18902
    
    8

It makes sense to me. Those two URLs aren't equivalent; the first one refers to the name "mypage.htm" and has a parameter list "page=A" whereas the second one refers to the strange name "mypage.htm%3fpage=A" and doesn't have a parameter list.

Looks like whoever produced the second one wasn't quite clear on how URL-encoding should be used. Only the value parts of parameters in the parameter list need to be URL-encoded.
Bill Goldsworthy
Greenhorn

Joined: Dec 21, 2004
Posts: 27
"Only the value parts of parameters in the parameter list need to be URL-encoded."

Excellent! We're trying to track down where the request is coming from now that I understand that it's the URL that's bad not because of some inability for Tomcat to decode it.

Much appreciated!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61648
    
  67

Yes, the whole reason for encoding is so that special characters like the ? (and = and &) can be used to format the URL.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
jQuery in Action, 2nd edition
 
subject: URL encoding gives 404