jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [1/2] jena git commit: JENA-1454: Fix to handle text output format.
Date Wed, 07 Mar 2018 13:00:46 GMT
Repository: jena
Updated Branches:
  refs/heads/master 10aa1397f -> a92048a55


JENA-1454: Fix to handle text output format.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/b5b4b13a
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/b5b4b13a
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/b5b4b13a

Branch: refs/heads/master
Commit: b5b4b13ad6bafb08c15a8588cd2ad43ec0f515e2
Parents: 10aa139
Author: Andy Seaborne <andy@apache.org>
Authored: Tue Mar 6 19:50:19 2018 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Tue Mar 6 19:50:19 2018 +0000

----------------------------------------------------------------------
 .../jena/fuseki/servlets/ResponseResultSet.java | 25 ++++++++++----------
 1 file changed, 12 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/b5b4b13a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
index cb9298f..464f5b8 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
@@ -40,7 +40,6 @@ import org.apache.jena.query.ResultSet ;
 import org.apache.jena.query.ResultSetFormatter ;
 import org.apache.jena.riot.Lang;
 import org.apache.jena.riot.WebContent ;
-import org.apache.jena.riot.resultset.ResultSetLang ;
 import org.apache.jena.riot.resultset.ResultSetWriterRegistry;
 import org.apache.jena.riot.resultset.rw.ResultsWriter;
 import org.apache.jena.sparql.core.Prologue ;
@@ -131,9 +130,12 @@ public class ResponseResultSet
             contentType = contentTypeTextPlain ;
 
         // Some kind of general dispatch is neater but there are quite a few special cases.
+        // text/plain is special because there is no ResultSetWriter for it (yet). 
+        // Text plain is special because of the formatting by prologue.
+        // text/plain is not a registered result set language. 
         //
         // JSON is special because of ?callback
-        // 
+        //
         // XML is special because of
         // (1) charset is a feature of XML, not the response 
         // (2) ?stylesheet=
@@ -141,16 +143,17 @@ public class ResponseResultSet
         // Thrift is special because
         // (1) charset is meaningless
         // (2) there is no boolean result form.
-        //
-        // Text plain is special because of the formatting by prologue.
-        
+
+        if ( Objects.equals(serializationType, contentTypeTextPlain) ) {
+            textOutput(action, contentType, resultSet, qPrologue, booleanResult) ;
+            return;
+        }
+
         Lang lang = WebContent.contentTypeToLangResultSet(serializationType);
         if (lang == null )
             ServletOps.errorBadRequest("Not recognized for SPARQL results: "+serializationType)
;
         if ( ! ResultSetWriterRegistry.isRegistered(lang) )
             ServletOps.errorBadRequest("No results writer for "+serializationType);
-        if ( ResultSetLang.SPARQLResultSetThrift.equals(lang) && booleanResult !=
null )
-            ServletOps.errorBadRequest("Can't write a boolean result in thrift") ;
 
         Context cxt = action.getContext().copy();
         String charset = charsetUTF8;
@@ -164,15 +167,11 @@ public class ResponseResultSet
             jsonCallback = ResponseOps.paramCallback(action.request) ;
         }
         if (Objects.equals(serializationType, WebContent.contentTypeResultsThrift) ) {
+            if ( booleanResult != null )
+                ServletOps.errorBadRequest("Can't write a boolean result in thrift") ;
             charset = null;
         }
         
-        if ( Objects.equals(serializationType, contentTypeTextPlain) ) {
-            // While text form does not use context for a Prologue.
-            textOutput(action, contentType, resultSet, qPrologue, booleanResult) ;
-            return;
-        }
-        
         //Finally, the general case
         generalOutput(action, lang, contentType, charset, cxt, jsonCallback, resultSet, booleanResult)
;
     }


Mime
View raw message