Size limit for data being POST to a servlet

D

DiscoStu

Hello Everyone,

I'm having a hard time finding a clear answer to my problem. I
have two tomcat servers talking to each other passing reports back and
forth. I want to set it up so that one client servlet POST's its
report data in a URL call to the server servlet, example:
http://localhost/App/ReportRecievingServlet?<ReportDataHere>

Its just an XML file so there is no binary to worry about, whats the
max size I can really get away with using this method of transfer...
the reports might run 40-50-60K maybe. I'm not sure the best way to
get the report off the client machine and onto the server machine. I
would normally just have the server make an HTTP-GET request to the
client, but I want the communications to be one-way-only. I only want
clients connecting to the server, never the server making requests on
the client.

Is there a way to programatically upload these XML files as part of a
mime-attachment to the POST the client makes to the server? Would just
attaching the XML text after the "?" in the URL be the easiest way to
do it?

Thanks everyone
 
S

Sudsy

DiscoStu wrote:
Its just an XML file so there is no binary to worry about, whats the
max size I can really get away with using this method of transfer...
the reports might run 40-50-60K maybe. I'm not sure the best way to
get the report off the client machine and onto the server machine. I
would normally just have the server make an HTTP-GET request to the
client, but I want the communications to be one-way-only. I only want
clients connecting to the server, never the server making requests on
the client.

Do it as a POST. Likely limit on the server end will be storage space,
i.e. on disk or in the database, depending on where you're planning on
storing it. Make sure that you set the content type and length headers
correctly on the client side.
If the storing on the server side fails then that can be indicated by
closing the socket and sending an HTTP failure status. If the client
sees either one then they will know the operation didn't succeed.
I've uploaded images as part of a multipart form which exceeded 200K
without difficulty.
 
C

Chris Smith

DiscoStu said:
Is there a way to programatically upload these XML files as part of a
mime-attachment to the POST the client makes to the server? Would just
attaching the XML text after the "?" in the URL be the easiest way to
do it?

You almost certainly don't want to send the XML as part of the URI of an
HTTP request. Use POST or PUT, and place it in the body of the request
(if using POST, as a named parameter; if using PUT, then just attach it
directly). Jakarta Commons HttpClient is helpful for advanced HTTP
usage like this.

If you send a multipart form request (which is ideal for large form
fields in a PUT request), then you'll need special code outside of the
servlet API to parse it on the server. Actually, Jakarta Commons has a
project for this too; but the O'Reilly Servlet class is better-known,
with the restriction that you're required to own a current copy of Jason
Hunter's book in order to use it.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
A

Andy Fish

Sudsy said:
DiscoStu wrote:


Do it as a POST. Likely limit on the server end will be storage space,
i.e. on disk or in the database, depending on where you're planning on
storing it. Make sure that you set the content type and length headers
correctly on the client side.

If the storing on the server side fails then that can be indicated by
closing the socket and sending an HTTP failure status. If the client
sees either one then they will know the operation didn't succeed.
I've uploaded images as part of a multipart form which exceeded 200K
without difficulty.

I wrote an upload facility for a document management system that just POSTed
the file. We tested it with 50mb powerpoint presentations and suchlike, and
there was never any problem.

(I'm not trying to start a p**sing contest - just adding my $0.02 :)
 
S

Sudsy

Andy Fish wrote:
I wrote an upload facility for a document management system that just POSTed
the file. We tested it with 50mb powerpoint presentations and suchlike, and
there was never any problem.

(I'm not trying to start a p**sing contest - just adding my $0.02 :)

Not at all! You proved the point, namely that there's no explicit upper-
limit on the size of uploaded files (as long as you've got sufficient
storage space on the server). This should provide comfirmation to the
OP. Thanks.
 
R

Roedy Green

Its just an XML file so there is no binary to worry about, whats the
max size I can really get away with using this method of transfer...
the reports might run 40-50-60K maybe.

I don't think there is a limit. The size is sent as a human-readable
ASCII number. The response is broken into chunks, apart from the
packets.

PUT can be used for uploading files, well beyond the limit you are
worrying about.
 
Joined
Mar 4, 2009
Messages
1
Reaction score
0
about the limit of files POSTed to a servlet:
I'm currently working on a fileUpload system which should accept verry large files (>10 gb should be possible)
This seems to work for files less than 2GB, but when I try it with larger files, the upload fails (doPost() method is even never called)

I think this might have something to do with the content-length property of the ServletRequest-class (which is an integer, so there might be an integer from the moment the content-length is bigger than 2 GB)

Anyone who is familiar with this problem, and can offer me a solution for it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top