Size limit for data being POST to a servlet

Discussion in 'Java' started by DiscoStu, May 20, 2004.

  1. DiscoStu

    DiscoStu Guest

    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
    DiscoStu, May 20, 2004
    #1
    1. Advertising

  2. DiscoStu

    Sudsy Guest

    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.
    Sudsy, May 20, 2004
    #2
    1. Advertising

  3. DiscoStu

    Chris Smith Guest

    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
    Chris Smith, May 20, 2004
    #3
  4. DiscoStu

    Andy Fish Guest

    "Sudsy" <> wrote in message
    news:...
    > 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 :)
    Andy Fish, May 21, 2004
    #4
  5. DiscoStu

    Sudsy Guest

    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.
    Sudsy, May 21, 2004
    #5
  6. DiscoStu

    Roedy Green Guest

    On 20 May 2004 10:08:58 -0700, (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.
    Roedy Green, May 21, 2004
    #6
  7. DiscoStu

    Ward

    Joined:
    Mar 4, 2009
    Messages:
    1
    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?
    Ward, Mar 4, 2009
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sean Clarke
    Replies:
    1
    Views:
    1,891
    Sudsy
    Jan 7, 2004
  2. circuit_breaker
    Replies:
    2
    Views:
    1,993
    Jack Jia
    Apr 4, 2004
  3. news.amnet.net.au
    Replies:
    1
    Views:
    914
    Sudsy
    Sep 15, 2004
  4. news.amnet.net.au

    Limit to size of POST in forms?

    news.amnet.net.au, Sep 10, 2004, in forum: HTML
    Replies:
    2
    Views:
    547
    Isofarro
    Sep 10, 2004
  5. Replies:
    1
    Views:
    1,076
    Victor Bazarov
    Jun 28, 2005
Loading...

Share This Page