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 2015/12/18 15:33:33 UTC
[1/2] jena git commit: Remove : unused. 2.3.1 has been released.
Repository: jena
Updated Branches:
refs/heads/master 8dc61cadf -> e70adf702
Remove : unused. 2.3.1 has been released.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/fddc6626
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/fddc6626
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/fddc6626
Branch: refs/heads/master
Commit: fddc6626cc01d3bd041f15a223b296d2c4afd5c2
Parents: 8dc61ca
Author: Andy Seaborne <an...@apache.org>
Authored: Fri Dec 18 14:24:10 2015 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Fri Dec 18 14:24:10 2015 +0000
----------------------------------------------------------------------
.../jena/fuseki/servlets/ResponseModel.java | 140 -------------------
1 file changed, 140 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/fddc6626/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java
deleted file mode 100644
index 6bdb272..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ResponseModel.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.servlets;
-
-import java.util.HashMap ;
-import java.util.Map ;
-
-import javax.servlet.ServletOutputStream ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.atlas.web.MediaType ;
-import org.apache.jena.fuseki.DEF ;
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.fuseki.conneg.ConNeg ;
-import org.apache.jena.fuseki.conneg.WebLib ;
-import org.apache.jena.rdf.model.Model ;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFDataMgr ;
-import org.apache.jena.riot.RDFLanguages ;
-import static org.apache.jena.riot.WebContent.* ;
-import org.apache.jena.web.HttpSC ;
-
-// REPLACED by ResponseDataset
-// Kept here in case we need to revert it (Aug 2015)
-// Delete after release of Fusek 2.3.1 or earlier if specific confirmation
-// the new code is OK.
-
-public class ResponseModel
-{
- // Short names for "output="
- private static final String contentOutputJSONLD = "json-ld" ;
- private static final String contentOutputJSONRDF = "json-rdf" ;
- private static final String contentOutputJSON = "json" ;
- private static final String contentOutputXML = "xml" ;
- private static final String contentOutputText = "text" ;
- private static final String contentOutputTTL = "ttl" ;
- private static final String contentOutputNT = "nt" ;
-
- public static Map<String,String> shortNamesModel = new HashMap<String, String>() ;
- static {
-
- // Some short names. keys are lowercase.
- ResponseOps.put(shortNamesModel, contentOutputJSONLD, contentTypeJSONLD) ;
- ResponseOps.put(shortNamesModel, contentOutputJSONRDF, contentTypeRDFJSON) ;
- ResponseOps.put(shortNamesModel, contentOutputJSON, contentTypeJSONLD) ;
- ResponseOps.put(shortNamesModel, contentOutputXML, contentTypeRDFXML) ;
- ResponseOps.put(shortNamesModel, contentOutputText, contentTypeTurtle) ;
- ResponseOps.put(shortNamesModel, contentOutputTTL, contentTypeTurtle) ;
- ResponseOps.put(shortNamesModel, contentOutputNT, contentTypeNTriples) ;
- }
-
- public static void doResponseModel(HttpAction action, Model model)
- {
- HttpServletRequest request = action.request ;
- HttpServletResponse response = action.response ;
-
- String mimeType = null ; // Header request type
-
- // TODO Use MediaType throughout.
- MediaType i = ConNeg.chooseContentType(request, DEF.rdfOffer, DEF.acceptRDFXML) ;
- if ( i != null )
- mimeType = i.getContentType() ;
-
- String outputField = ResponseOps.paramOutput(request, shortNamesModel) ;
- if ( outputField != null )
- mimeType = outputField ;
-
- String writerMimeType = mimeType ;
-
- if ( mimeType == null )
- {
- Fuseki.actionLog.warn("Can't find MIME type for response") ;
- String x = WebLib.getAccept(request) ;
- String msg ;
- if ( x == null )
- msg = "No Accept: header" ;
- else
- msg = "Accept: "+x+" : Not understood" ;
- ServletOps.error(HttpSC.NOT_ACCEPTABLE_406, msg) ;
- }
-
- String contentType = mimeType ;
- String charset = charsetUTF8 ;
-
- String forceAccept = ResponseOps.paramForceAccept(request) ;
- if ( forceAccept != null )
- {
- contentType = forceAccept ;
- charset = charsetUTF8 ;
- }
-
- Lang lang = RDFLanguages.contentTypeToLang(contentType) ;
- if ( lang == null )
- ServletOps.errorBadRequest("Can't determine output content type: "+contentType) ;
-
-// if ( rdfw instanceof RDFXMLWriterI )
-// rdfw.setProperty("showXmlDeclaration", "true") ;
-
- // // Write locally to check it's possible.
- // // Time/space tradeoff.
- // try {
- // OutputStream out = new NullOutputStream() ;
- // RDFDataMgr.write(out, model, lang) ;
- // IO.flush(out) ;
- // } catch (JenaException ex)
- // {
- // SPARQL_ServletBase.errorOccurred(ex) ;
- // }
-
- try {
- ResponseResultSet.setHttpResponse(action, contentType, charset) ;
- response.setStatus(HttpSC.OK_200) ;
- ServletOutputStream out = response.getOutputStream() ;
- RDFDataMgr.write(out, model, lang) ;
- out.flush() ;
- }
- catch (Exception ex) {
- action.log.info("Exception while writing the response model: "+ex.getMessage(), ex) ;
- ServletOps.errorOccurred("Exception while writing the response model: "+ex.getMessage(), ex) ;
- }
- }
-}
-
[2/2] jena git commit: Make execute related methods protected.
Posted by an...@apache.org.
Make execute related methods protected.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/e70adf70
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/e70adf70
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/e70adf70
Branch: refs/heads/master
Commit: e70adf702c2045aad319db21c7950f5ab724b911
Parents: fddc662
Author: Andy Seaborne <an...@apache.org>
Authored: Fri Dec 18 14:25:54 2015 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Fri Dec 18 14:25:54 2015 +0000
----------------------------------------------------------------------
.../java/org/apache/jena/fuseki/servlets/SPARQL_Query.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/e70adf70/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
index 27ab3b5..dc2e89b 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
@@ -223,12 +223,12 @@ public abstract class SPARQL_Query extends SPARQL_Protocol
ServletOps.error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Bad content type: " + ct.getContentType()) ;
}
- private void executeWithParameter(HttpAction action) {
+ protected void executeWithParameter(HttpAction action) {
String queryString = action.request.getParameter(paramQuery) ;
execute(queryString, action) ;
}
- private void executeBody(HttpAction action) {
+ protected void executeBody(HttpAction action) {
String queryString = null ;
try {
InputStream input = action.request.getInputStream() ;
@@ -239,7 +239,7 @@ public abstract class SPARQL_Query extends SPARQL_Protocol
execute(queryString, action) ;
}
- private void execute(String queryString, HttpAction action) {
+ protected void execute(String queryString, HttpAction action) {
String queryStringLog = ServletOps.formatForLog(queryString) ;
if ( action.verbose )
action.log.info(format("[%d] Query = \n%s", action.id, queryString)) ;