File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Length of a URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Length of a URL" Watch "Length of a URL" New topic

Length of a URL

Suku Kana

Joined: Mar 14, 2002
Posts: 3
Hi friends,
I am not sure whether this question fits in here. But, I am also not sure where else to post it.
I have a servlet to which I am passing lots of parameters. I found that in IE, if I pass more than 2050 characters as a URL, the request doesn't even reach the servlet. In netscape, I found that the number of characters allowed in a URL is more (not sure how long).
Can anyone tell me whether there is any restriction on the number of characters allowed in a URL? If so, how many in IE/Netscape?
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

I had the same question once and someone pointed out RFC2616 - HTTP 1.1, section 3.2.1 in particular, which states:
Note: Servers ought to be cautious about depending on URI lengths above 255 bytes, because some older client or proxy implementations might not properly support these lengths.

Now this RFC is dated June 1999 so I'd hope things were better than this, but there is no guarantee. I tend to try to limit things to 1024 characters, but there are too many things that can go wrong if you leave it unbounded...
I agree. Here's the link:
subject: Length of a URL
It's not a secret anymore!