Reading content from HTTPServletRequest?
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ramakrishnan_Seshadri
Posted On:   Friday, October 12, 2001 08:12 AM

How do you identify what kind of content is sent by the client, so that the servlet can accordingly read it and send a response.

I am hgaving a servlet which listens for the client to send some XML data. How do I identify what kind of data they send? Possible alternate solutions are also welcome.

Thanks
Ram

Re: Reading content from HTTPServletRequest?

Posted By:   Alex_Chaffee  
Posted On:   Thursday, October 18, 2001 12:01 PM

Search this FAQ on "upload" for how to upload files to a servlet.


As to identifying whether a particular random string of bytes is an XML file, a Word doc, a JPEG of Britney Spears, or whatever, that's a generally hard problem. However, all XML documents are supposed to start with the line



so that's a good way to verify that you really got an XML file. Or just run it through an XML parser and catch a parse exception.

Re: Reading content from HTTPServletRequest?

Posted By:   Ankit_Bhatia  
Posted On:   Monday, October 15, 2001 12:19 AM

Hi

U can get content type by using function getContentType() of HttpServletRequest class.It tells what MIME type is sent.If u have any problem ,Let me know.
About | Sitemap | Contact