Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

inputstream consumption avoided

  • Loading branch information...
commit e253b02b3dfcdd8e10b2a9199a2ded29887617b5 1 parent 67eb13e
michelegonella authored
14 zen-webservice/src/main/java/com/nominanuda/web/http/ServletHelper.java
View
@@ -70,18 +70,10 @@ public String getRequestLineURI(HttpServletRequest request, boolean stripContext
*/
public @Nullable InputStream getServletRequestBody(HttpServletRequest servletRequest) throws IOException {
ServletInputStream sis = servletRequest.getInputStream();
- if(sis == null) {
- return null;
+ if(servletRequest.getContentLength() > 0) {
+ return sis;
} else {
- PushbackInputStream pis = new PushbackInputStream(sis);
- int val = pis.read();
- if(val == -1) {
- //?? sis.close();
- return null;
- } else {
- pis.unread(val);
- return pis;
- }
+ return null;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.