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/12/26 15:54:25 UTC
svn commit: r1553490 -
/jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java
Author: andy
Date: Thu Dec 26 14:54:25 2013
New Revision: 1553490
URL: http://svn.apache.org/r1553490
Log:
Use ContentType, not strings.
Modified:
jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java
Modified: jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java?rev=1553490&r1=1553489&r2=1553490&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java (original)
+++ jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java Thu Dec 26 14:54:25 2013
@@ -91,23 +91,15 @@ public class SPARQL_Update extends SPARQ
@Override
protected void perform(HttpAction action)
{
- // WebContent needs to migrate to using ContentType.
- String ctStr ;
- {
- ContentType ct = FusekiLib.getContentType(action) ;
- if ( ct == null )
- ctStr = contentTypeSPARQLUpdate ;
- else
- ctStr = ct.getContentType() ;
- }
-
- if (contentTypeSPARQLUpdate.equals(ctStr))
- {
+ ContentType ct = FusekiLib.getContentType(action) ;
+ if ( ct == null )
+ ct = ctSPARQLUpdate ;
+
+ if ( matchContentType(ctSPARQLUpdate, ct) ) {
executeBody(action) ;
return ;
}
- if (contentTypeHTMLForm.equals(ctStr))
- {
+ if ( isHtmlForm(ct) ) {
executeForm(action) ;
return ;
}
@@ -126,11 +118,12 @@ public class SPARQL_Update extends SPARQ
if ( ! HttpNames.METHOD_POST.equalsIgnoreCase(request.getMethod()) )
ServletOps.errorMethodNotAllowed("SPARQL Update : use POST") ;
- ContentType incoming = FusekiLib.getContentType(action) ;
- String ctStr = ( incoming == null ) ? contentTypeSPARQLUpdate : incoming.getContentType() ;
+ ContentType ct = FusekiLib.getContentType(action) ;
+ if ( ct == null )
+ ct = ctSPARQLUpdate ;
// ----
- if ( contentTypeSPARQLUpdate.equals(ctStr) )
+ if ( matchContentType(ctSPARQLUpdate, ct) )
{
String charset = request.getCharacterEncoding() ;
if ( charset != null && ! charset.equalsIgnoreCase(charsetUTF8) )
@@ -139,7 +132,7 @@ public class SPARQL_Update extends SPARQ
return ;
}
- if ( contentTypeHTMLForm.equals(ctStr) )
+ if ( isHtmlForm(ct) )
{
int x = countParamOccurences(request, paramUpdate) + countParamOccurences(request, paramRequest) ;
if ( x == 0 )
@@ -156,7 +149,7 @@ public class SPARQL_Update extends SPARQ
return ;
}
- ServletOps.error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Must be "+contentTypeSPARQLUpdate+" or "+contentTypeHTMLForm+" (got "+ctStr+")") ;
+ ServletOps.error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Must be "+contentTypeSPARQLUpdate+" or "+contentTypeHTMLForm+" (got "+ct.getContentType()+")") ;
}
protected void validate(HttpAction action, Collection<String> params)