Simple Java servlet getInputStream() Jul 01, 2009
If you need a simple proof of concept to display the body of a HTTP Post from a Java Servlet you can use the following code:
BufferedReader in = new BufferedReader(new InputStreamReader(req.getInputStream()));
while (in.ready()) {
System.out.println(in.readLine());
}
while (in.ready()) {
System.out.println(in.readLine());
}
This will print out the body of a request to your standard output. Please note that this is _NOT_ the best way to do this. This is just a quick way to get at a HTTPRequest object's body tag.. Java can be complex but it doesn't need to be.
