java - Get Posted XML from HttpServletRequest Object -


I have a filter that receives HTTPSRL REV and request is a post which has an XML that I need to read.

It depends on what is the best way to get XML from the filter method HttpServletRequest object. That's how the customer sent it.

If it has been sent as a raw request body, then use:

  InputStream xml = request.getInputStream (); // ...   

Use this if it has been sent as a regular application / x-www-form-urlencoded request parameter :

  string xml = request.getParameter ("somename"); // ...   

If this is sent as a upload code in the taste of multipart / form-data part, use it.

  InputStream xml = request.getPart ("somename"). GetInputStream (); // ...   

These were standard methods supported by the Serallet API. Other methods may require different or third party APIs (eg SOAP).

Comments