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 2013/03/19 20:53:34 UTC
svn commit: r1458481 - in
/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets:
ResponseModel.java ResponseResultSet.java
Author: andy
Date: Tue Mar 19 19:53:33 2013
New Revision: 1458481
URL: http://svn.apache.org/r1458481
Log:
Return "bad request" if a writer format can't be found for a Model.
Modified:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java?rev=1458481&r1=1458480&r2=1458481&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java Tue Mar 19 19:53:33 2013
@@ -18,6 +18,7 @@
package org.apache.jena.fuseki.servlets;
+import static org.apache.jena.fuseki.servlets.ServletBase.* ;
import java.util.HashMap ;
import java.util.Map ;
@@ -82,7 +83,7 @@ public class ResponseModel
msg = "No Accept: header" ;
else
msg = "Accept: "+x+" : Not understood" ;
- SPARQL_ServletBase.error(HttpSC.NOT_ACCEPTABLE_406, msg) ;
+ error(HttpSC.NOT_ACCEPTABLE_406, msg) ;
}
String contentType = mimeType ;
@@ -95,9 +96,10 @@ public class ResponseModel
charset = WebContent.charsetUTF8 ;
}
- Lang lang = WebContent.contentTypeToLang(contentType) ;
-// RDFWriter rdfw = FusekiLib.chooseWriter(lang) ;
-//
+ Lang lang = WebContent.contentTypeToLang(contentType) ;
+ if ( lang == null )
+ errorBadRequest("Can't determine output content type: "+contentType) ;
+
// if ( rdfw instanceof RDFXMLWriterI )
// rdfw.setProperty("showXmlDeclaration", "true") ;
@@ -105,7 +107,7 @@ public class ResponseModel
// // Time/space tradeoff.
// try {
// OutputStream out = new NullOutputStream() ;
- // rdfw.write(model, out, null) ;
+ // RDFDataMgr.write(out, model, lang) ;
// IO.flush(out) ;
// } catch (JenaException ex)
// {
@@ -119,7 +121,7 @@ public class ResponseModel
RDFDataMgr.write(out, model, lang) ;
out.flush() ;
}
- catch (Exception ex) { SPARQL_ServletBase.errorOccurred(ex) ; }
+ catch (Exception ex) { errorOccurred(ex) ; }
}
}
Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java?rev=1458481&r1=1458480&r2=1458481&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java Tue Mar 19 19:53:33 2013
@@ -18,6 +18,7 @@
package org.apache.jena.fuseki.servlets;
+import static org.apache.jena.fuseki.servlets.ServletBase.* ;
import java.io.IOException ;
import java.util.HashMap ;
import java.util.Map ;
@@ -238,7 +239,7 @@ public class ResponseResultSet
return ;
}
- SPARQL_ServletBase.errorBadRequest("Can't determine output serialization: "+serializationType) ;
+ errorBadRequest("Can't determine output serialization: "+serializationType) ;
}
@@ -253,7 +254,7 @@ public class ResponseResultSet
out.flush() ;
// Do not call httpResponse.flushBuffer(); here - Jetty closes the stream if it is a gzip stream
// then the JSON callback closing details can't be added.
- } catch (IOException ex) { SPARQL_ServletBase.errorOccurred(ex) ; }
+ } catch (IOException ex) { errorOccurred(ex) ; }
}
public static void setHttpResponse(HttpServletRequest httpRequest,
@@ -290,7 +291,7 @@ public class ResponseResultSet
try {
output(contentType, null, proc, httpRequest, httpResponse) ;
httpResponse.flushBuffer() ;
- } catch (IOException ex) { SPARQL_ServletBase.errorOccurred(ex) ; }
+ } catch (IOException ex) { errorOccurred(ex) ; }
}
private static void jsonOutput(String contentType, OutputContent proc,
@@ -314,7 +315,7 @@ public class ResponseResultSet
out.println(")") ;
httpResponse.flushBuffer();
- } catch (IOException ex) { SPARQL_ServletBase.errorOccurred(ex) ; }
+ } catch (IOException ex) { errorOccurred(ex) ; }
}
private static void textOutput(String contentType, OutputContent proc,
@@ -325,6 +326,6 @@ public class ResponseResultSet
output(contentType, WebContent.charsetUTF8, proc, httpRequest, httpResponse) ;
out.flush() ;
httpResponse.flushBuffer();
- } catch (IOException ex) { SPARQL_ServletBase.errorOccurred(ex) ; }
+ } catch (IOException ex) { errorOccurred(ex) ; }
}
}