Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

Fix restxq chunked requests
  • Loading branch information...
commit e70c01a5df9a06fb5668aaadf7beeda5b060f717 2 parents ad7bda2 + a67d038
@adamretter adamretter authored
View
21 extensions/exquery/restxq/src/main/java/org/exist/extensions/exquery/restxq/impl/RestXqServiceImpl.java
@@ -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) {
Please sign in to comment.
Something went wrong with that request. Please try again.