You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2014/02/14 15:52:38 UTC
svn commit: r1568326 - in /jena/trunk/jena-arq/src/main/java:
com/hp/hpl/jena/sparql/engine/http/HttpQuery.java
org/apache/jena/atlas/web/HttpException.java
Author: andy
Date: Fri Feb 14 14:52:38 2014
New Revision: 1568326
URL: http://svn.apache.org/r1568326
Log:
Record status line and provide access to it.
Modified:
jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/http/HttpQuery.java
jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/web/HttpException.java
Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/http/HttpQuery.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/http/HttpQuery.java?rev=1568326&r1=1568325&r2=1568326&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/http/HttpQuery.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/http/HttpQuery.java Fri Feb 14 14:52:38 2014
@@ -155,6 +155,16 @@ public class HttpQuery extends Params {
}
/**
+ * Gets the HTTP Response Message returned by the request (returns null if request
+ * has yet to be made)
+ *
+ * @return Response Message
+ */
+ public String getResponseMessage() {
+ return responseMessage;
+ }
+
+ /**
* Sets whether the HTTP request will include a Accept-Encoding: gzip header
*
* @param allow
@@ -347,7 +357,8 @@ public class HttpQuery extends Params {
} catch (HttpException httpEx) {
// Unwrap and re-wrap the HTTP exception
responseCode = httpEx.getResponseCode();
- throw new QueryExceptionHTTP(responseCode, "Error making the query, see cause for details", httpEx.getCause());
+ responseMessage = httpEx.getStatusLine() ;
+ throw new QueryExceptionHTTP(responseCode, "Error making the query: "+responseMessage, httpEx.getCause());
}
}
@@ -393,7 +404,8 @@ public class HttpQuery extends Params {
} catch (HttpException httpEx) {
// Unwrap and re-wrap the HTTP Exception
responseCode = httpEx.getResponseCode();
- throw new QueryExceptionHTTP(responseCode, "Error making the query, see cause for details", httpEx.getCause());
+ responseMessage = httpEx.getStatusLine() ;
+ throw new QueryExceptionHTTP(responseCode, "Error making the query: "+responseMessage, httpEx.getCause());
}
}
@@ -413,6 +425,7 @@ public class HttpQuery extends Params {
private InputStream execCommon(TypedInputStream stream) throws QueryExceptionHTTP {
// Assume response code must be 200 if we got here
responseCode = 200;
+ responseMessage = "OK" ;
// Get the returned content type so we can expose this later via the
// getContentType() method
Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/web/HttpException.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/web/HttpException.java?rev=1568326&r1=1568325&r2=1568326&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/web/HttpException.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/web/HttpException.java Fri Feb 14 14:52:38 2014
@@ -25,10 +25,12 @@ package org.apache.jena.atlas.web;
public class HttpException extends RuntimeException {
private static final long serialVersionUID = -7224224620679594095L;
private int responseCode = -1;
+ private String statusLine = null ;;
public HttpException(int responseCode, String statusLine) {
super(responseCode + " - " + statusLine);
this.responseCode = responseCode;
+ this.statusLine = statusLine ;
}
public HttpException(String message) {
@@ -50,4 +52,13 @@ public class HttpException extends Runti
public int getResponseCode() {
return this.responseCode;
}
+
+ /**
+ * Gets the response code, may be null if unknown
+ * @return Status line
+ */
+ public String getStatusLine() {
+ return this.statusLine;
+ }
+
}