Monday, May 2, 2011

req.getContentLength() returns -1, what is wrong ???

Hi.
I'm using current validation code on my HTTPServlet to check if the
user uploads big files:
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
long maxSize = 1024*1024 * 1; //Limit 50 MB
int contentLength = req.getContentLength();
if (contentLength < 0 || contentLength > maxSize) {
res.sendError(509, "CHAP@: "+contentLength+" BYTE-a");
}

else {
//// It's ok
}
In the development mode req.getContentLength(); Returns me the
correct
size of the data I'm uploading, but when I deploy my application to
App Engine And run my application req.getContentLength(); returns me
-1. Please tell me what is wrong and please suggest me how can I
solve
that problem...

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment