Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Size limit for data being POST to a servlet

Reply
Thread Tools

Size limit for data being POST to a servlet

 
 
DiscoStu
Guest
Posts: n/a
 
      05-20-2004
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
 
Reply With Quote
 
 
 
 
Sudsy
Guest
Posts: n/a
 
      05-20-2004
DiscoStu wrote:
<snip>
> 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.

 
Reply With Quote
 
 
 
 
Chris Smith
Guest
Posts: n/a
 
      05-20-2004
DiscoStu wrote:
> 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
 
Reply With Quote
 
Andy Fish
Guest
Posts: n/a
 
      05-21-2004

"Sudsy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> DiscoStu wrote:
> <snip>
> > 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.
>


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


 
Reply With Quote
 
Sudsy
Guest
Posts: n/a
 
      05-21-2004
Andy Fish wrote:
<snip>
> 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.

 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      05-21-2004
On 20 May 2004 10:08:58 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) (DiscoStu)
wrote or quoted :

>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.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
Ward Ward is offline
Junior Member
Join Date: Mar 2009
Posts: 1
 
      03-04-2009
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?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
c program, file size limit, how to solve? 2G bytes limit. guru.slt@gmail.com C++ 1 06-27-2005 11:05 PM
Limit to size of POST in forms using javax.servlet.http.HttpServlet? news.amnet.net.au Java 1 09-15-2004 05:00 AM
Limit to size of POST in forms? news.amnet.net.au HTML 2 09-10-2004 05:11 PM
Servlet question(Tomcat, web.xml, servlet-class, servlet-name) circuit_breaker Java 2 04-04-2004 03:26 AM
Tomcat: POST from one servlet or internal class to another servlet Sean Clarke Java 1 01-07-2004 02:22 PM



Advertisments