Hi.

I have not followed this thread in details, but did you check this :

http://tomcat.apache.org/tomcat-7.0-doc/config/http.html#Common_Attributes
--> maxPostSize      

The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The limit can be disabled by setting this attribute to a value less than zero. If not specified, this attribute is set to 2097152 (2 megabytes). Note that the FailedRequestFilter can be used to reject requests that exceed this limit.

Note: the size above might relate to the *encoded* size of the file, as it is transmitted over the WWW (possibly encoded as Base64 e.g.), which may mean that an original 1 MB file translates to more than 1 MB bytes while being uploaded.

Note also : maybe "Struts" is setting this to some other default value..

Another question : did you check the Tomcat logs ?


On 14.01.2016 10:52, Rahul Singh wrote:
Hello Christopher ,
Thanks for your input,



ServletRequest.getContentLength is declared to return an int value (32-bit):

* Integer.MAX_VALUE  = 2^31 - 1 = 2147483647
* 2GiB = 2 * 1024 * 1024 * 1024 = 2147483648
* 2147483648 > 2147483647

Therefore, request.getContentLength cannot be used to fetch
content-lengths over 2GiB - 1byte.

Yes above is already investigated, BTW thanks .

  You have to use
ServletRequest.getContentLengthLong (new in servlet 3.1)

for this we have to upgrade tomcat 8, currently we are using tomcat 7.0.54.

or call
HttpServletRequest.getHeader("Content-Length") as a String and parse it
yourself.

OK, but where we need to do this, in init() method or in doFilter() method, but 
FYI, the request(upload file >2GB) is not reached to doFilter().


Apart from above thread we want to share more information so that tomcat team 
help us to get out from this issue.

For my struts project the doFilter() fails to get any request from the file 
upload form in cases the size of the file is greater than 2gb.
Below is the code fragment:

Filter is as follows:

public void doFilter(ServletRequest req, ServletResponse res, FilterChain 
chain) throws IOException, ServletException
{
     HttpServletRequest request = (HttpServletRequest) req;
     HttpServletResponse response = (HttpServletResponse) res;
        HttpSession session = request.getSession(false);
         request.setCharacterEncoding("UTF-8");

        /*
        do the other business work example request response monitoring and 
logging
        */
        
         chain.doFilter(request, response);

}

jsp is :

<s:form id="uploadData" action="UploadAction" namespace="xyz" validateFields="false" 
method="post" enctype="multipart/form-data">

For my jsp the form is submitted as a XMLHttpRequest via the underlying 
javascipt.
Now when I upload a a file (lesser than 2gb) ,in my dofilter() method I have 
checked the uri and request length for the request.
They are as expected via the action called in the jsp form and the file size.
The file upload works fine in this case. But in case where the file size is 
greater than 2gb ,
in my doFilter() method no request is available for the file upload action 
called by the form submit(for file size greater than 2 gb).
Thus the upload does not proceed further in such cases.

I am using servlet 3.0.
What do I need to do to support larger than 2 gb file uploads, so that the 
request reaches the doFilter() method?



________________________________________
From: Christopher Schultz <ch...@christopherschultz.net>
Sent: Wednesday, January 13, 2016 8:11 PM
To: Tomcat Users List
Subject: Re: File size >= 2GB not uploaded in application [Tomcat 7.0.54 
Struts: 2.3.24 JAVA: openJDK 1.7.79]

Rahul,

On 1/12/16 10:56 PM, Rahul Singh wrote:
Hi,

Define "Not successful"?  Exceptions thrown?  File truncated?  Upload
never starts?  Never finishes?

Not successful :

Request Never finishes, we have trace the HttpServlet request object
and request.getContentLength return 0 in case when file size is >=2GB,

No exception thrown, as well as when file size is less than 2GB, then
request.getContentLength return the correct value of file size in
byte.

ServletRequest.getContentLength is declared to return an int value (32-bit):

* Integer.MAX_VALUE  = 2^31 - 1 = 2147483647
* 2GiB = 2 * 1024 * 1024 * 1024 = 2147483648
* 2147483648 > 2147483647

Therefore, request.getContentLength cannot be used to fetch
content-lengths over 2GiB - 1byte. You have to use
ServletRequest.getContentLengthLong (new in servlet 3.1) or call
HttpServletRequest.getHeader("Content-Length") as a String and parse it
yourself.

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to