getReader « Request « JSP-Servlet Q&A





1. Servlet's request.getInputStream(); / request.getReader(); not working Struts2    stackoverflow.com

Servlet's request.getInputStream(); / request.getReader(); not working Struts2

InputStream in=req.getInputStream();
//InputStream in= new FileInputStream("d:/forChml/PunchOutSetupRequest.xml");
StringBuffer xmlStr=new StringBuffer();
int d;
while((d=in.read()) != -1){
          xmlStr.append((char)d);
}
 return xmlStr.toString();
}
I even tried ...

2. java.lang.IllegalStateException: getReader() has already been called for this request    stackoverflow.com

I want to add logging to my Servlet, so I've created Filter which should display request and go to the Servlet. But unfortunately I've encoutered exception:

java.lang.IllegalStateException: getReader() has already been called ...