Permalink
Browse files

Merge pull request #142 from Infiniverse/fix-restxq-chunked-requests

Fix restxq chunked requests
  • Loading branch information...
2 parents ad7bda2 + a67d038 commit e70c01a5df9a06fb5668aaadf7beeda5b060f717 @adamretter adamretter committed Feb 6, 2014
@@ -133,10 +133,8 @@ protected Sequence extractRequestBody(final HttpRequest request) throws RestXqSe
//first, get the content of the request
is = new CloseShieldInputStream(request.getInputStream());
-
- //if the content length is unknown or 0, return
- final int contentLength = request.getContentLength();
- if(contentLength == -1 || contentLength == 0) {
+
+ if(is.available() <= 0) {
return null;
}
@@ -162,18 +160,7 @@ public String getCacheClass() {
try {
//was there any POST content?
-
-
- /**
- * There is a bug in HttpInput.available() in Jetty 7.2.2.v20101205
- * This has been filed as Bug 333415 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=333415
- * It is expected to be fixed in the Jetty 7.3.0 release
- */
-
- //TODO reinstate call to .available() when Jetty 7.3.0 is released, use of .getContentLength() is not reliable because of http mechanics
- //if(is != null && is.available() > 0) {
- final int contentLength = request.getContentLength();
- if(is != null && contentLength > 0) {
+ if(is != null && is.available() > 0) {
String contentType = request.getContentType();
// 1) determine if exists mime database considers this binary data
if(contentType != null) {
@@ -227,6 +214,8 @@ public String getCacheClass() {
}
}
}
+ } catch (IOException e) {
+ throw new RestXqServiceException(e.getMessage());
} finally {
if(cache != null) {

0 comments on commit e70c01a

Please sign in to comment.