I would like to create a servlet that can handle XML file uploads. The servlet should read the uploaded XML file to create Java objects (using JAXB).
How would I go about doing this? I used the request.getInputStream() function - However, it gives me more than what I wanted.
This is what I get:
I am just interested in the *** xml content ***
So, I guess I need to parse the InputStream to get the xml? Is that how everyone else does file upload processing?
I've read somewhere that Apache Commons FileUpload has lots of utilities that can make upload processing easier. But before I go to my manager to get his approval to use a 3rd party library (Apache), I would like to know if what I want to achieve can be done using servlet APIs alone.
MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
It could be done with the existing API but it's a lot of work. You would, pretty much, end up doing what the writers of the 3rd party libraries have already done (including learning some things the hard way).
Having it built in doesn't necessarily make it better.
The Jakarta library is managed by the same foundation as Tomcat so, if this were built into the spec, the folks at Tomcat would probably be using these libraries anyway. And, since so many commercial containers use Apache libraries in their products (Jasper, for instance), it's probably safe to assume that they might also use the same code.