This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
for some time I am looking for clear answer, how to increase maximum size of data, that comes to servlet in the request? I have a servlet that receives xml data from another server. I have been told by admin of that another server, to increase the maximum allowed size to 6MB, shoot me but I have no clue where to set it. When some bigger data comes, their server is sending it all the time, because no successful status comes from mine.
By maximum size of data I mean max size of request's parameter(s) (String xml = request.getParameter("data");)
Regards,
Michal
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12268
1
posted
1
The usual use of getParameter is for relatively short Strings from a HTML form submission.
If somebody was trying to POST megabytes of text to my servlet, I would avoid all the methods (such as get Parameter) which trigger the servlet container into trying to interpret the input as a form. Instead I would get the request body as a stream and try to process that.
See javax.servlet.ServletRequest.getInputStream()
With stream input you could process XML as either a Document or with a SAX or Stax parser.
It will depend on the server container you are using.
If you are using Tomcat directly, you can set the maxPostSize attribute for your http-connector (or ajp connector) to allow a 6 MB file. By default, Tomcat's HTTP (and AJP) connector limits this to 2 MB. See http://tomcat.apache.org/tomcat-6.0-doc/config/http.html
For other server containers, look for a similar setting in their documentation - they are very likely to have a similar setting.
OCPJP
In preparing for battle I have always found that plans are useless, but planning is indispensable. -- Dwight D. Eisenhower
Michal Glowacki
Ranch Hand
Joined: Mar 14, 2006
Posts: 113
posted
0
Thanks for the answers, I think Pete's answer should do the trick, as I had maxPostSize set to 2MB until now.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: How to increase maximum size of data accepted?