Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

URLEncode limits

 
David Brown
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a quick question, and I may actually be in the wrong forum for this. I'm creating an image using a java servlet and posting it to our web page, using the following code:
**This is code from the servlet that is creating the dataset**
String sChartInfo = "img src=\"/coal0000/GraphData";
sChartInfo += "?title=" + URLEncoder.encode(sTitle);
sChartInfo += "&chart=" + URLEncoder.encode(sGraphType);
sChartInfo += "&dataSet=" + URLEncoder.encode(sDataSet);
sChartInfo += "width=\"700\" height=\"700\" border=\"2\"";
***the string sChartInfo is replacing a comment block in our HTML webpage***
My question is, Is there a limit to the amount of data that I can pass back to the servlet that is creating the image, if it is a doGet method ? If there is a limit, is there any way that I can get around it ? I was thinking about the doPost, but I'm not sure how to post to the servlet in a query stream like that.
Thanks.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm thinking you're asking about the maximum length of the entire URL, and not just a single URLEncoded parameter?

Here is the official word on IE:
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q208/4/27.ASP&NoWebContent=1

Other browsers may not have these limits, as the official HTTP 1.1 spec imposes no minimums or maximums.

It might also be server dependant (perhaps some implementations of servlet runners or web servers will truncate, perhaps not).

POSTing is the recommended alternative, but you can't (to my knowledge) fake a POST for an http request for images via an anchor tag.
[ February 10, 2004: Message edited by: Mike Curwen ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!