Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can we read the huge data using request object

 
Saurabh Agarwal
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using Altova XML Spy to run the servlet, it calls the servlet and my servlet reads the data from request object using below code



request.getInputStream() does not work in my case as it reads the data to some limitation.

Can you please guide me which approach I should take to read the huge data from request object.

Thanks,
Neha
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
request.getInputStream() does not work in my case as it reads the data to some limitation.

Please be more specific about this - how do you know it doesn't read all the data? How big is the file? Which servlet container are you using?
 
Saurabh Agarwal
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using SAP Net Weaver Application Server.

My XML file contains more than 65536 charaters
If I run the file with this much charater it runs well but If I increase a single character it fails.
I am using DOM parser to parse the inputstream.



Please let me know If you need more details.



 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's certainly not too much to handle for any servlet container. Could this be a limitation of the XML Spy program? Have you tried posting it using an HTML form in a browser?
 
Saurabh Agarwal
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I tried it from HTML also, it doesn't work

I have a strong feeling of problem with request.getInputStream();

I was searching on google and found to use MimeParser.

Can you please guide me.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you mean by "MimeParser", but if that means that you intend to parse the input stream in your own code instead of relying on the built-in capabilities of the servlet container, then you're probably on the wrong track.

Have you verified (using a proxy like tcpmon) that the full data that you think is submitted is indeed being submitted? Have you examined the contents of the input stream to verify that the full contents do arrive at the server?
 
Saurabh Agarwal
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the contents of the inputStream only contain upto 65536 characters and this what my problem is .

I found out that there is a limitation that HttpServletRequest object only can take maximum of 65536 characters and my data is longer than that.

so how do I feed in the complete data into the request object so that it can be read in the servlet.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found out that there is a limitation that HttpServletRequest object only can take maximum of 65536 characters

This sound suspect. Did you determine that it's specifically a limitation of SAP Net Weaver Application Server? I'd be surprised by that, since it's a commercial product, and even free servlet containers have no problem handling much larger inputs than that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic