marmotta-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ja...@apache.org
Subject [10/50] [abbrv] marmotta git commit: make use of Guava string constants for HTTP headers
Date Fri, 05 Dec 2014 15:36:19 GMT
make use of Guava string constants for HTTP headers


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

Branch: refs/heads/master
Commit: 807f371045bac2e2e0dda18ba784de957edfd8c6
Parents: f63451b
Author: Sebastian Schaffert <sschaffert@apache.org>
Authored: Tue Nov 11 16:22:43 2014 +0100
Committer: Sebastian Schaffert <sschaffert@apache.org>
Committed: Tue Nov 11 16:22:54 2014 +0100

----------------------------------------------------------------------
 .../client/clients/ConfigurationClient.java     | 28 +++---
 .../marmotta/client/clients/ImportClient.java   | 28 +++---
 .../marmotta/client/clients/LDPathClient.java   | 25 +++---
 .../marmotta/client/clients/ResourceClient.java | 17 ++--
 .../marmotta/client/clients/SPARQLClient.java   | 20 ++---
 .../apache/marmotta/commons/util/DateUtils.java | 10 ---
 .../marmotta/kiwi/config/KiWiConfiguration.java | 95 +++++++++++++++-----
 .../marmotta/kiwi/jmx/KiWiStatisticsMBean.java  | 26 ++++++
 .../services/provider/AbstractHttpProvider.java |  6 +-
 .../facebook/FacebookGraphProvider.java         |  7 +-
 .../core/exception/HttpErrorException.java      |  4 +-
 .../HttpErrorExceptionMapper.java               |  8 +-
 .../services/content/HTTPContentReader.java     |  8 +-
 .../platform/core/services/prefix/PrefixCC.java | 19 ++--
 .../core/webservices/io/ExportWebService.java   |  9 +-
 .../core/webservices/io/ImportWebService.java   |  6 +-
 .../webservices/resource/ContentWebService.java | 27 +++---
 .../resource/InspectionWebService.java          |  5 +-
 .../webservices/resource/MetaWebService.java    | 23 +++--
 .../resource/ResourceWebService.java            | 62 ++++++-------
 .../triplestore/ContextWebService.java          |  3 +-
 .../sparql/webservices/SparqlWebService.java    | 12 +--
 .../user/webservices/UserWebService.java        | 13 ++-
 .../webservices/MementoWebService.java          | 18 ++--
 24 files changed, 284 insertions(+), 195 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ConfigurationClient.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ConfigurationClient.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ConfigurationClient.java
index 5ee7e32..e479a6f 100644
--- a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ConfigurationClient.java
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ConfigurationClient.java
@@ -17,15 +17,8 @@
  */
 package org.apache.marmotta.client.clients;
 
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.URLEncoder;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpDelete;
@@ -41,8 +34,13 @@ import org.apache.marmotta.client.util.HTTPUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URLEncoder;
+import java.util.*;
+
+import static com.google.common.net.HttpHeaders.ACCEPT;
+import static com.google.common.net.HttpHeaders.CONTENT_TYPE;
 
 /**
  * A client that supports accessing the configuration webservice of the Apache Marmotta. May be used for
@@ -73,7 +71,7 @@ public class ConfigurationClient {
         HttpClient httpClient = HTTPUtil.createClient(config);
 
         HttpGet get = new HttpGet(config.getMarmottaUri() + URL_CONFIG_SERVICE + "/list");
-        get.setHeader("Accept", "application/json");
+        get.setHeader(ACCEPT, "application/json");
 
         try {
             
@@ -108,7 +106,7 @@ public class ConfigurationClient {
         String serviceUrl = config.getMarmottaUri() + URL_CONFIG_SERVICE + "/list" + (prefix != null? "?prefix="+ URLEncoder.encode(prefix,"utf-8") : "");
 
         HttpGet get = new HttpGet(serviceUrl);
-        get.setHeader("Accept", "application/json");
+        get.setHeader(ACCEPT, "application/json");
         
         try {
 
@@ -150,7 +148,7 @@ public class ConfigurationClient {
         String serviceUrl = config.getMarmottaUri() + URL_CONFIG_SERVICE + "/data/" + URLEncoder.encode(key,"utf-8");
 
         HttpGet get = new HttpGet(serviceUrl);
-        get.setHeader("Accept", "application/json");
+        get.setHeader(ACCEPT, "application/json");
         
         try {
 
@@ -195,7 +193,7 @@ public class ConfigurationClient {
         String serviceUrl = config.getMarmottaUri() + URL_CONFIG_SERVICE + "/data/" + URLEncoder.encode(key,"utf-8");
 
         HttpPost post = new HttpPost(serviceUrl);
-        post.setHeader("Content-Type", "application/json");
+        post.setHeader(CONTENT_TYPE, "application/json");
         ContentProducer cp = new ContentProducer() {
             @Override
             public void writeTo(OutputStream outstream) throws IOException {

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ImportClient.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ImportClient.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ImportClient.java
index eaaff34..ab308b4 100644
--- a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ImportClient.java
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ImportClient.java
@@ -17,14 +17,9 @@
  */
 package org.apache.marmotta.client.clients;
 
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URISyntaxException;
-import java.util.HashSet;
-import java.util.Set;
-
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.io.ByteStreams;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.HttpClient;
@@ -40,9 +35,16 @@ import org.apache.marmotta.client.util.HTTPUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.io.ByteStreams;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URISyntaxException;
+import java.util.HashSet;
+import java.util.Set;
+
+import static com.google.common.net.HttpHeaders.ACCEPT;
+import static com.google.common.net.HttpHeaders.CONTENT_TYPE;
 
 /**
  * This client class provides support for importing ontologies in various formats into the Apache Marmotta.
@@ -85,7 +87,7 @@ public class ImportClient {
         String serviceUrl = config.getMarmottaUri() + URL_TYPES_SERVICE;
 
         HttpGet get = new HttpGet(serviceUrl);
-        get.setHeader("Accept", "application/json");
+        get.setHeader(ACCEPT, "application/json");
         
         try {
             HttpResponse response = httpClient.execute(get);
@@ -138,7 +140,7 @@ public class ImportClient {
 
     private void uploadDataset(final InputStream in, final String mimeType, HttpClient httpClient) throws IOException, URISyntaxException {
         HttpPost post = HTTPUtil.createPost(URL_UPLOAD_SERVICE, config);
-        post.setHeader("Content-Type", mimeType);
+        post.setHeader(CONTENT_TYPE, mimeType);
 
         ContentProducer cp = new ContentProducer() {
             @Override

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/LDPathClient.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/LDPathClient.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/LDPathClient.java
index e6475f7..44ba947 100644
--- a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/LDPathClient.java
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/LDPathClient.java
@@ -17,13 +17,9 @@
  */
 package org.apache.marmotta.client.clients;
 
-import java.io.IOException;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpGet;
@@ -37,9 +33,14 @@ import org.apache.marmotta.client.util.RDFJSONParser;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static com.google.common.net.HttpHeaders.ACCEPT;
 
 /**
  * Add file description here!
@@ -79,7 +80,7 @@ public class LDPathClient {
                                                                   + "&uri="  + URLEncoder.encode(uri, "utf-8");
 
         HttpGet get = new HttpGet(serviceUrl);
-        get.setHeader("Accept", "application/json");
+        get.setHeader(ACCEPT, "application/json");
         
         try {
 
@@ -124,7 +125,7 @@ public class LDPathClient {
                                                                                    + "&uri="  + URLEncoder.encode(uri, "utf-8");
 
         HttpGet get = new HttpGet(serviceUrl);
-        get.setHeader("Accept", "application/json");
+        get.setHeader(ACCEPT, "application/json");
         
         try {
 

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ResourceClient.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ResourceClient.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ResourceClient.java
index 575757f..a71a056 100644
--- a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ResourceClient.java
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ResourceClient.java
@@ -23,11 +23,7 @@ import org.apache.http.HttpResponse;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.ResponseHandler;
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpOptions;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.methods.HttpPut;
+import org.apache.http.client.methods.*;
 import org.apache.http.entity.ContentProducer;
 import org.apache.http.entity.EntityTemplate;
 import org.apache.http.util.EntityUtils;
@@ -49,6 +45,9 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import java.util.Map;
 
+import static com.google.common.net.HttpHeaders.ACCEPT;
+import static com.google.common.net.HttpHeaders.CONTENT_TYPE;
+
 /**
  * Add file description here!
  * <p/>
@@ -151,7 +150,7 @@ public class ResourceClient {
         HttpClient httpClient = HTTPUtil.createClient(config);
 
         HttpGet get = new HttpGet(getServiceUrl(uri));
-        get.setHeader("Accept", "application/rdf+json; rel=meta");
+        get.setHeader(ACCEPT, "application/rdf+json; rel=meta");
         
         try {
             
@@ -200,7 +199,7 @@ public class ResourceClient {
         HttpClient httpClient = HTTPUtil.createClient(config);
 
         HttpPut put = new HttpPut(getServiceUrl(uri));
-        put.setHeader("Content-Type", "application/rdf+json; rel=meta");
+        put.setHeader(CONTENT_TYPE, "application/rdf+json; rel=meta");
         ContentProducer cp = new ContentProducer() {
             @Override
             public void writeTo(OutputStream outstream) throws IOException {
@@ -251,7 +250,7 @@ public class ResourceClient {
         HttpClient httpClient = HTTPUtil.createClient(config);
 
         HttpGet get = new HttpGet(getServiceUrl(uri));
-        get.setHeader("Accept", mimeType+"; rel=content");
+        get.setHeader(ACCEPT, mimeType + "; rel=content");
         
         try {
 
@@ -295,7 +294,7 @@ public class ResourceClient {
         HttpClient httpClient = HTTPUtil.createClient(config);
 
         HttpPut put = new HttpPut(getServiceUrl(uri));
-        put.setHeader("Content-Type", content.getMimeType()+"; rel=content");
+        put.setHeader(CONTENT_TYPE, content.getMimeType() + "; rel=content");
         ContentProducer cp = new ContentProducer() {
             @Override
             public void writeTo(OutputStream outstream) throws IOException {

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/SPARQLClient.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/SPARQLClient.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/SPARQLClient.java
index ddb96fa..a3d9552 100644
--- a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/SPARQLClient.java
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/SPARQLClient.java
@@ -31,17 +31,8 @@ import org.apache.marmotta.client.util.HTTPUtil;
 import org.openrdf.model.Value;
 import org.openrdf.model.ValueFactory;
 import org.openrdf.model.impl.ValueFactoryImpl;
-import org.openrdf.query.Binding;
-import org.openrdf.query.BindingSet;
-import org.openrdf.query.QueryResultHandler;
-import org.openrdf.query.QueryResultHandlerException;
-import org.openrdf.query.TupleQueryResultHandlerException;
-import org.openrdf.query.resultio.BooleanQueryResultFormat;
-import org.openrdf.query.resultio.QueryResultIO;
-import org.openrdf.query.resultio.QueryResultParseException;
-import org.openrdf.query.resultio.QueryResultParser;
-import org.openrdf.query.resultio.TupleQueryResultFormat;
-import org.openrdf.query.resultio.UnsupportedQueryResultFormatException;
+import org.openrdf.query.*;
+import org.openrdf.query.resultio.*;
 import org.openrdf.query.resultio.helpers.QueryResultCollector;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -54,6 +45,9 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 
+import static com.google.common.net.HttpHeaders.ACCEPT;
+import static org.openrdf.query.resultio.TupleQueryResultFormat.JSON;
+
 /**
  * Add file description here!
  * <p/>
@@ -86,7 +80,7 @@ public class SPARQLClient {
         String serviceUrl = config.getMarmottaUri() + URL_QUERY_SERVICE + "?query=" + URLEncoder.encode(query, "utf-8");
 
         HttpGet get = new HttpGet(serviceUrl);
-        get.setHeader("Accept", TupleQueryResultFormat.JSON.getDefaultMIMEType());
+        get.setHeader(ACCEPT, JSON.getDefaultMIMEType());
         
         try {
 
@@ -176,7 +170,7 @@ public class SPARQLClient {
         String serviceUrl = config.getMarmottaUri() + URL_QUERY_SERVICE + "?query=" + URLEncoder.encode(askQuery, "utf-8");
 
         HttpGet get = new HttpGet(serviceUrl);
-        get.setHeader("Accept", BooleanQueryResultFormat.JSON.getDefaultMIMEType());
+        get.setHeader(ACCEPT, BooleanQueryResultFormat.JSON.getDefaultMIMEType());
         
         try {
 

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/util/DateUtils.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/util/DateUtils.java b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/util/DateUtils.java
index fa42508..dfe7e5d 100644
--- a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/util/DateUtils.java
+++ b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/util/DateUtils.java
@@ -167,16 +167,6 @@ public class DateUtils {
 
 
     /**
-     * Cut the fraction part of a date object, since some database systems do not support nanoseconds.
-     * @param date
-     * @return
-     */
-    public static Date getDateWithoutFraction(Date date) {
-        long seconds = date.getTime() / 1000L;
-        return new Date(seconds * 1000L);
-    }
-
-    /**
      * Transform a Java date into a XML calendar. Useful for working with date literals.
      * @param date
      * @return

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/config/KiWiConfiguration.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/config/KiWiConfiguration.java b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/config/KiWiConfiguration.java
index 6da8f7b..df204d8 100644
--- a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/config/KiWiConfiguration.java
+++ b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/config/KiWiConfiguration.java
@@ -118,6 +118,11 @@ public class KiWiConfiguration {
     private CacheMode cacheMode = CacheMode.REPLICATED;
 
     /**
+     * Enable JMX statistics collection
+     */
+    private boolean jmxEnabled = true;
+
+    /**
      * Enable to turn on cluster mode (e.g. for cache replication)
      */
     private boolean clustered = false;
@@ -184,24 +189,27 @@ public class KiWiConfiguration {
         return queryLoggingEnabled;
     }
 
-    public void setQueryLoggingEnabled(boolean queryLoggingEnabled) {
+    public KiWiConfiguration setQueryLoggingEnabled(boolean queryLoggingEnabled) {
         this.queryLoggingEnabled = queryLoggingEnabled;
+        return this;
     }
 
     public String getDefaultContext() {
         return defaultContext;
     }
 
-    public void setDefaultContext(String defaultContext) {
+    public KiWiConfiguration setDefaultContext(String defaultContext) {
         this.defaultContext = defaultContext;
+        return this;
     }
 
     public String getInferredContext() {
         return inferredContext;
     }
 
-    public void setInferredContext(String inferredContext) {
+    public KiWiConfiguration setInferredContext(String inferredContext) {
         this.inferredContext = inferredContext;
+        return this;
     }
 
     /**
@@ -220,18 +228,20 @@ public class KiWiConfiguration {
      * once the limit is reached or the connection committed. Enabling this can significantly improve the
      * performance, and is usually quite safe for triples.
      */
-    public void setTripleBatchCommit(boolean tripleBatchCommit) {
+    public KiWiConfiguration setTripleBatchCommit(boolean tripleBatchCommit) {
         if(dialect.isBatchSupported()) {
             this.tripleBatchCommit = tripleBatchCommit;
         }
+        return this;
     }
 
     public int getTripleBatchSize() {
         return tripleBatchSize;
     }
 
-    public void setTripleBatchSize(int tripleBatchSize) {
+    public KiWiConfiguration setTripleBatchSize(int tripleBatchSize) {
         this.tripleBatchSize = tripleBatchSize;
+        return this;
     }
 
     /**
@@ -250,8 +260,9 @@ public class KiWiConfiguration {
      *
      * @see java.sql.PreparedStatement#setFetchSize(int)
      */
-    public void setCursorSize(int cursorSize) {
+    public KiWiConfiguration setCursorSize(int cursorSize) {
         this.cursorSize = cursorSize;
+        return this;
     }
 
     /**
@@ -270,8 +281,9 @@ public class KiWiConfiguration {
      * will prepare the database with appropriate fulltext index support. Since this adds additional overhead, it is
      * not enabled by default.
      */
-    public void setFulltextEnabled(boolean fulltextEnabled) {
+    public KiWiConfiguration setFulltextEnabled(boolean fulltextEnabled) {
         this.fulltextEnabled = fulltextEnabled;
+        return this;
     }
 
     /**
@@ -288,8 +300,9 @@ public class KiWiConfiguration {
      * separate fulltext index for each supported language, adding additional overhead. In case you only want generic
      * fulltext support, use the empty array.
      */
-    public void setFulltextLanguages(String[] fulltextLanguages) {
+    public KiWiConfiguration setFulltextLanguages(String[] fulltextLanguages) {
         this.fulltextLanguages = fulltextLanguages;
+        return this;
     }
 
     /**
@@ -297,8 +310,9 @@ public class KiWiConfiguration {
      * separate fulltext index for each supported language, adding additional overhead. In case you only want generic
      * fulltext support, use the empty array.
      */
-    public void setFulltextLanguages(List<String> fulltextLanguages) {
+    public KiWiConfiguration setFulltextLanguages(List<String> fulltextLanguages) {
         this.fulltextLanguages = new ArrayList<String>(fulltextLanguages).toArray(new String[fulltextLanguages.size()]);
+        return this;
     }
 
 
@@ -314,8 +328,9 @@ public class KiWiConfiguration {
      * Fully qualified class name of the cache manager factory to use. Falls back to the Guava
      * cache manager if not found
      */
-    public void setCachingBackend(CachingBackends cachingBackend) {
+    public KiWiConfiguration setCachingBackend(CachingBackends cachingBackend) {
         this.cachingBackend = cachingBackend;
+        return this;
     }
 
     /**
@@ -329,8 +344,9 @@ public class KiWiConfiguration {
     /**
      * The maximum size of the node ID cache used by the KiWiValueFactory (default: 1000000)
      */
-    public void setNodeCacheSize(int nodeCacheSize) {
+    public KiWiConfiguration setNodeCacheSize(int nodeCacheSize) {
         this.nodeCacheSize = nodeCacheSize;
+        return this;
     }
 
     /**
@@ -344,8 +360,9 @@ public class KiWiConfiguration {
     /**
      * The maximum size of the literal cache used by the KiWiValueFactory (default: 100000)
      */
-    public void setLiteralCacheSize(int literalCacheSize) {
+    public KiWiConfiguration setLiteralCacheSize(int literalCacheSize) {
         this.literalCacheSize = literalCacheSize;
+        return this;
     }
 
     /**
@@ -359,8 +376,9 @@ public class KiWiConfiguration {
     /**
      * The maximum size of the BNode cache used by the KiWiValueFactory (default: 10000)
      */
-    public void setBNodeCacheSize(int bNodeCacheSize) {
+    public KiWiConfiguration setBNodeCacheSize(int bNodeCacheSize) {
         this.bNodeCacheSize = bNodeCacheSize;
+        return this;
     }
 
     /**
@@ -374,8 +392,9 @@ public class KiWiConfiguration {
     /**
      * The maximum size of the URI cache used by the KiWiValueFactory (default: 500000)
      */
-    public void setUriCacheSize(int uriCacheSize) {
+    public KiWiConfiguration setUriCacheSize(int uriCacheSize) {
         this.uriCacheSize = uriCacheSize;
+        return this;
     }
 
 
@@ -390,8 +409,9 @@ public class KiWiConfiguration {
     /**
      * The maximum size of the triple cache used for looking up triples by id
      */
-    public void setTripleCacheSize(int tripleCacheSize) {
+    public KiWiConfiguration setTripleCacheSize(int tripleCacheSize) {
         this.tripleCacheSize = tripleCacheSize;
+        return this;
     }
 
     /**
@@ -404,8 +424,9 @@ public class KiWiConfiguration {
     /**
      * The maximum size of the namespace cache used for looking up namespaces by prefix and uri
      */
-    public void setNamespaceCacheSize(int namespaceCacheSize) {
+    public KiWiConfiguration setNamespaceCacheSize(int namespaceCacheSize) {
         this.namespaceCacheSize = namespaceCacheSize;
+        return this;
     }
 
     /**
@@ -422,8 +443,9 @@ public class KiWiConfiguration {
      * The datacenter ID of this server for generating unique database IDs.
      * @return
      */
-    public void setDatacenterId(int datacenterId) {
+    public KiWiConfiguration setDatacenterId(int datacenterId) {
         this.datacenterId = datacenterId;
+        return this;
     }
 
 
@@ -439,8 +461,9 @@ public class KiWiConfiguration {
      * Change the strategy to use for synchronizing between transactions. Currently either "database" or "cache".
      * @return
      */
-    public void setRegistryStrategy(RegistryStrategy registryStrategy) {
+    public KiWiConfiguration setRegistryStrategy(RegistryStrategy registryStrategy) {
         this.registryStrategy = registryStrategy;
+        return this;
     }
 
     /**
@@ -455,8 +478,9 @@ public class KiWiConfiguration {
     /**
      * If true, support for special cluster features is enabled (e.g. replicated caches).
      */
-    public void setClustered(boolean clustered) {
+    public KiWiConfiguration setClustered(boolean clustered) {
         this.clustered = clustered;
+        return this;
     }
 
 
@@ -499,8 +523,9 @@ public class KiWiConfiguration {
      *
      * @param cacheMode
      */
-    public void setCacheMode(CacheMode cacheMode) {
+    public KiWiConfiguration setCacheMode(CacheMode cacheMode) {
         this.cacheMode = cacheMode;
+        return this;
     }
 
     /**
@@ -517,8 +542,9 @@ public class KiWiConfiguration {
      * Change the name of the cluster. This name is e.g. used by the Infinispan cache to identify other cache members
      * in the same cluster,
      */
-    public void setClusterName(String clusterName) {
+    public KiWiConfiguration setClusterName(String clusterName) {
         this.clusterName = clusterName;
+        return this;
     }
 
     /**
@@ -543,8 +569,9 @@ public class KiWiConfiguration {
      *
      * @return
      */
-    public void setClusterPort(int clusterPort) {
+    public KiWiConfiguration setClusterPort(int clusterPort) {
         this.clusterPort = clusterPort;
+        return this;
     }
 
     /**
@@ -580,8 +607,9 @@ public class KiWiConfiguration {
      *
      * @return
      */
-    public void setClusterAddress(String clusterAddress) {
+    public KiWiConfiguration setClusterAddress(String clusterAddress) {
         this.clusterAddress = clusterAddress;
+        return this;
     }
 
 
@@ -592,4 +620,25 @@ public class KiWiConfiguration {
     public void setClusterTimeout(int clusterTimeout) {
         this.clusterTimeout = clusterTimeout;
     }
+
+
+    /**
+     * Return true if statistics collection in JMX. The JMX name of the KiWi statistics bean will be
+     * org.apache.marmotta.kiwi.jmx:type=KiWiStatisticsMBean
+     */
+    public boolean isJmxEnabled() {
+        return jmxEnabled;
+    }
+
+    /**
+     * Enable/disable statistics collection in JMX. The JMX name of the KiWi statistics bean will be
+     * org.apache.marmotta.kiwi.jmx:type=KiWiStatisticsMBean
+     *
+     * @param jmxEnabled
+     */
+    public KiWiConfiguration setJmxEnabled(boolean jmxEnabled) {
+        this.jmxEnabled = jmxEnabled;
+
+        return this;
+    }
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/jmx/KiWiStatisticsMBean.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/jmx/KiWiStatisticsMBean.java b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/jmx/KiWiStatisticsMBean.java
new file mode 100644
index 0000000..5869fba
--- /dev/null
+++ b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/jmx/KiWiStatisticsMBean.java
@@ -0,0 +1,26 @@
+/*
+ * 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.marmotta.kiwi.jmx;
+
+/**
+ * Statistics collection for the KiWi triple store, to be published in JMX.
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+public interface KiWiStatisticsMBean {
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/provider/AbstractHttpProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/provider/AbstractHttpProvider.java b/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/provider/AbstractHttpProvider.java
index 5a41a60..a14569e 100644
--- a/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/provider/AbstractHttpProvider.java
+++ b/libraries/ldclient/ldclient-core/src/main/java/org/apache/marmotta/ldclient/services/provider/AbstractHttpProvider.java
@@ -42,6 +42,8 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.*;
 
+import static com.google.common.net.HttpHeaders.ACCEPT;
+import static com.google.common.net.HttpHeaders.ACCEPT_LANGUAGE;
 import static org.apache.marmotta.commons.http.MarmottaHttpUtils.parseContentType;
 
 /**
@@ -133,8 +135,8 @@ public abstract class AbstractHttpProvider implements DataProvider {
                 if(!visited.contains(requestUrl)) {
                     HttpGet get = new HttpGet(requestUrl);
                     try {
-                        get.setHeader("Accept",contentType);
-                        get.setHeader("Accept-Language", "*"); // PoolParty compatibility
+                        get.setHeader(ACCEPT, contentType);
+                        get.setHeader(ACCEPT_LANGUAGE, "*"); // PoolParty compatibility
 
                         log.info("retrieving resource data for {} from '{}' endpoint, request URI is <{}>", new Object[]  {resource, getName(), get.getURI().toASCIIString()});
 

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/libraries/ldclient/ldclient-provider-facebook/src/main/java/org/apache/marmotta/ldclient/provider/facebook/FacebookGraphProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-facebook/src/main/java/org/apache/marmotta/ldclient/provider/facebook/FacebookGraphProvider.java b/libraries/ldclient/ldclient-provider-facebook/src/main/java/org/apache/marmotta/ldclient/provider/facebook/FacebookGraphProvider.java
index 92fd837..341ed31 100644
--- a/libraries/ldclient/ldclient-provider-facebook/src/main/java/org/apache/marmotta/ldclient/provider/facebook/FacebookGraphProvider.java
+++ b/libraries/ldclient/ldclient-provider-facebook/src/main/java/org/apache/marmotta/ldclient/provider/facebook/FacebookGraphProvider.java
@@ -54,6 +54,9 @@ import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import static com.google.common.net.HttpHeaders.ACCEPT;
+import static com.google.common.net.HttpHeaders.ACCEPT_LANGUAGE;
+
 /**
  * A provider that accesses objects exposed by the Facebook Graph API (in JSON format). The provider will map the
  * properties of Facebook Objects to RDF and tries choosing the most appropriate RDF types and vocabularies. The base
@@ -357,8 +360,8 @@ public class FacebookGraphProvider implements DataProvider {
             for(String lang : languages) {
                 HttpGet get = new HttpGet(requestUri);
                 try {
-                    get.setHeader("Accept",contentType);
-                    get.setHeader("Accept-Language", lang);
+                    get.setHeader(ACCEPT, contentType);
+                    get.setHeader(ACCEPT_LANGUAGE, lang);
 
                     log.info("retrieving resource data for {} from '{}' endpoint, request URI is <{}>", new Object[]  {resourceUri, getName(), get.getURI().toASCIIString()});
 

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/exception/HttpErrorException.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/exception/HttpErrorException.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/exception/HttpErrorException.java
index dc69f8b..735f9c5 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/exception/HttpErrorException.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/exception/HttpErrorException.java
@@ -25,6 +25,8 @@ import javax.ws.rs.core.Response;
 import java.util.HashMap;
 import java.util.Map;
 
+import static com.google.common.net.HttpHeaders.ACCEPT;
+
 /**
  * HTTP Error Exception
  *
@@ -83,7 +85,7 @@ public class HttpErrorException extends Exception {
      * @param e exception
      */
     public HttpErrorException(Response.Status status, HttpServletRequest request, Exception e) {
-        this(status.getStatusCode(), status.getReasonPhrase(), request.getRequestURI(), e.getMessage(), ImmutableMap.of("Accept", request.getHeader("Accept")));
+        this(status.getStatusCode(), status.getReasonPhrase(), request.getRequestURI(), e.getMessage(), ImmutableMap.of(ACCEPT, request.getHeader(ACCEPT)));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/exceptionmappers/HttpErrorExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/exceptionmappers/HttpErrorExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/exceptionmappers/HttpErrorExceptionMapper.java
index fd37e56..e7f28ad 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/exceptionmappers/HttpErrorExceptionMapper.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/exceptionmappers/HttpErrorExceptionMapper.java
@@ -16,8 +16,6 @@
  */
 package org.apache.marmotta.platform.core.jaxrs.exceptionmappers;
 
-import com.google.common.base.Predicates;
-import com.google.common.collect.Iterables;
 import freemarker.template.TemplateException;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.marmotta.commons.http.ContentType;
@@ -39,6 +37,8 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
+import static com.google.common.net.HttpHeaders.ACCEPT;
+
 /**
  * Map HttpErrorExceptionMapper to a internal server error and return the default error object
  *
@@ -74,8 +74,8 @@ public class HttpErrorExceptionMapper implements CDIExceptionMapper<HttpErrorExc
         final Map<String, String> exceptionHeaders = exception.getHeaders();
 
         boolean htmlError = true; //HTML still by default
-        if (exceptionHeaders.containsKey("Accept")) {
-            final String acceptHeader = exceptionHeaders.get("Accept");
+        if (exceptionHeaders.containsKey(ACCEPT)) {
+            final String acceptHeader = exceptionHeaders.get(ACCEPT);
             final ContentType bestContentType = MarmottaHttpUtils.bestContentType(Arrays.asList(new ContentType("text", "html"), new ContentType("application", "json")),
                     MarmottaHttpUtils.parseAcceptHeader(acceptHeader));
             htmlError = bestContentType == null || !bestContentType.matches(new ContentType("application", "json"));

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/content/HTTPContentReader.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/content/HTTPContentReader.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/content/HTTPContentReader.java
index d74c37f..22da19b 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/content/HTTPContentReader.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/content/HTTPContentReader.java
@@ -40,6 +40,8 @@ import javax.inject.Inject;
 import java.io.IOException;
 import java.io.InputStream;
 
+import static com.google.common.net.HttpHeaders.ACCEPT;
+import static com.google.common.net.HttpHeaders.CONTENT_TYPE;
 import static org.apache.marmotta.commons.sesame.repository.ExceptionUtils.handleRepositoryException;
 
 /**
@@ -127,7 +129,7 @@ public class HTTPContentReader implements ContentReader {
                 if(location != null) {
                     log.info("reading remote resource {}",location);
                     HttpGet get = new HttpGet(location);
-                    get.setHeader("Accept",mimetype);
+                    get.setHeader(ACCEPT, mimetype);
 
                     HttpResponse response = httpClientService.execute(get);
                     if(response.getStatusLine().getStatusCode() == 200)
@@ -174,7 +176,7 @@ public class HTTPContentReader implements ContentReader {
                     if(location != null) {
                         log.info("reading remote resource {}",location);
                         HttpHead head = new HttpHead(location);
-                        head.setHeader("Accept",mimetype);
+                        head.setHeader(ACCEPT, mimetype);
 
                         return httpClientService.execute(head, new ResponseHandler<Boolean>() {
                             @Override
@@ -227,7 +229,7 @@ public class HTTPContentReader implements ContentReader {
                             @Override
                             public String handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
                                 if (response.getStatusLine().getStatusCode() == 200)
-                                    return response.getFirstHeader("Content-Type").getValue().split(";")[0];
+                                    return response.getFirstHeader(CONTENT_TYPE).getValue().split(";")[0];
                                 else
                                     return null;
                             }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/prefix/PrefixCC.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/prefix/PrefixCC.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/prefix/PrefixCC.java
index b231800..89868a8 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/prefix/PrefixCC.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/prefix/PrefixCC.java
@@ -17,13 +17,6 @@
  */
 package org.apache.marmotta.platform.core.services.prefix;
 
-import java.io.IOException;
-import java.net.URLEncoder;
-import java.nio.charset.Charset;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.LineIterator;
 import org.apache.http.HttpEntity;
@@ -36,6 +29,14 @@ import org.apache.marmotta.platform.core.api.prefix.PrefixProvider;
 import org.apache.marmotta.platform.core.util.http.HttpRequestUtil;
 import org.slf4j.Logger;
 
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.nio.charset.Charset;
+
+import static com.google.common.net.HttpHeaders.ACCEPT;
+
 /**
  * Prefix.cc Provider
  * 
@@ -59,7 +60,7 @@ public class PrefixCC implements PrefixProvider {
     public String getNamespace(final String prefix) {
         HttpGet get = new HttpGet(URI + prefix + ".file.txt");
         HttpRequestUtil.setUserAgentString(get, USER_AGENT);
-        get.setHeader("Accept", "text/plain");
+        get.setHeader(ACCEPT, "text/plain");
         try {
             return httpClientService.execute(get, new ResponseHandler<String>() {
 
@@ -95,7 +96,7 @@ public class PrefixCC implements PrefixProvider {
         try {
             HttpGet get = new HttpGet(URI + "reverse?format=txt&uri=" + URLEncoder.encode(namespace, "utf-8"));
             HttpRequestUtil.setUserAgentString(get, USER_AGENT);
-            get.setHeader("Accept", "text/plain");
+            get.setHeader(ACCEPT, "text/plain");
 
             return httpClientService.execute(get, new ResponseHandler<String>() {
 

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/io/ExportWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/io/ExportWebService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/io/ExportWebService.java
index 27d2d52..7bd3354 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/io/ExportWebService.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/io/ExportWebService.java
@@ -42,6 +42,7 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 
+import static com.google.common.net.HttpHeaders.*;
 import static org.apache.marmotta.commons.sesame.repository.ExceptionUtils.handleRepositoryException;
 
 /**
@@ -93,7 +94,7 @@ public class ExportWebService {
      */
     @GET
     @Path("/download")
-    public Response downloadData(@HeaderParam("Accept") String types, @QueryParam("format") String qFormat, @QueryParam("context") String context_string) throws IOException {
+    public Response downloadData(@HeaderParam(ACCEPT) String types, @QueryParam("format") String qFormat, @QueryParam("context") String context_string) throws IOException {
         List<ContentType> acceptedTypes;
         if(qFormat != null) {
             acceptedTypes = MarmottaHttpUtils.parseAcceptHeader(qFormat);
@@ -155,14 +156,14 @@ public class ExportWebService {
 
             return Response
                     .status(Response.Status.OK)
-                    .header("Content-Type", bestType.getMime())
-                    .header("Content-Disposition", "attachment; filename=\""+fileName+"\"")
+                    .header(CONTENT_TYPE, bestType.getMime())
+                    .header(CONTENT_DISPOSITION, "attachment; filename=\""+fileName+"\"")
                     .entity(entity)
                     .build();
 
         } else
             return Response.status(406)
-                    .header("Content-Type", exportService.getProducedTypes())
+                    .header(CONTENT_TYPE, exportService.getProducedTypes())
                     .entity("could not find matching type for " + acceptedTypes + "; see Content-Type header for possible types")
                     .build();
 

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/io/ImportWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/io/ImportWebService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/io/ImportWebService.java
index 34055d2..b221f2b 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/io/ImportWebService.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/io/ImportWebService.java
@@ -43,6 +43,8 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
+import static com.google.common.net.HttpHeaders.CONTENT_TYPE;
+
 /**
  * A webservice offering functionality to import data from the KiWi knowledge base.
  * <p/>
@@ -103,7 +105,7 @@ public class ImportWebService {
      */
     @POST
     @Path("/upload")
-    public Response uploadData(@HeaderParam("Content-Type") String type, @Context HttpServletRequest request, @QueryParam("context") String context_string) throws IOException, MarmottaImportException {
+    public Response uploadData(@HeaderParam(CONTENT_TYPE) String type, @Context HttpServletRequest request, @QueryParam("context") String context_string) throws IOException, MarmottaImportException {
         if(type != null && type.lastIndexOf(';') >= 0) {
             type = type.substring(0,type.lastIndexOf(';'));
         }
@@ -149,7 +151,7 @@ public class ImportWebService {
      */
     @POST
     @Path("/external")
-    public Response externalData(@HeaderParam("Content-Type") String type, @QueryParam("url") String url, @QueryParam("context") String context) throws IOException, MarmottaImportException {
+    public Response externalData(@HeaderParam(CONTENT_TYPE) String type, @QueryParam("url") String url, @QueryParam("context") String context) throws IOException, MarmottaImportException {
         try {
             log.debug("Received 'external' request for {} with {}%n", type, url);
             if(type != null && type.lastIndexOf(';') >= 0) {

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/ContentWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/ContentWebService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/ContentWebService.java
index b37fc3a..9c55439 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/ContentWebService.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/ContentWebService.java
@@ -50,6 +50,9 @@ import java.net.URLDecoder;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import static com.google.common.net.HttpHeaders.*;
+import static org.apache.marmotta.platform.core.webservices.resource.ResourceWebServiceHelper.appendContentTypes;
+
 /**
  * Content Web Services
  *
@@ -153,8 +156,8 @@ public class ContentWebService {
                     return Response
                             .status(configurationService.getIntConfiguration(
                                     "linkeddata.redirect.status", 303))
-                            .header("Vary", "Accept")
-                            .header("Content-Type", mimeType + "; rel=content")
+                            .header(VARY, ACCEPT)
+                            .header(CONTENT_TYPE, mimeType + "; rel=content")
                             .location(
                                     new java.net.URI(ResourceWebServiceHelper
                                             .buildResourceLink(resource,
@@ -321,39 +324,39 @@ public class ContentWebService {
                             try {
                                 fromL = Long.parseLong(from);
                                 is.skip(fromL);
-                                response.getMetadata().add("Content-Range","bytes "+fromL+"-"+(length-1)+"/"+length);
+                                response.getMetadata().add(CONTENT_RANGE,"bytes "+fromL+"-"+(length-1)+"/"+length);
                             } catch(NumberFormatException ex) {
-                                response.getMetadata().add("Content-Range","bytes 0-"+(length-1)+"/"+length);
+                                response.getMetadata().add(CONTENT_RANGE,"bytes 0-"+(length-1)+"/"+length);
                             }
                         } else {
-                            response.getMetadata().add("Content-Range","bytes 0-"+(length-1)+"/"+length);
+                            response.getMetadata().add(CONTENT_RANGE,"bytes 0-"+(length-1)+"/"+length);
                         }
-                        response.getMetadata().add("Accept-Ranges","bytes");
+                        response.getMetadata().add(ACCEPT_RANGES,"bytes");
                     } else {
                         response = Response.ok(is).build();
-                        response.getMetadata().add("Accept-Ranges","bytes");
+                        response.getMetadata().add(ACCEPT_RANGES,"bytes");
                     }
 
                     if(mimetype.startsWith("text") || mimetype.startsWith("application/json")) {
                         // Content-Encoding is not what it seems, known values are: gzip, compress,
                         // deflate, identity
                         // response.getMetadata().add("Content-Encoding", "utf-8");
-                        response.getMetadata().add("Content-Type", mimetype + "; charset=utf-8");
+                        response.getMetadata().add(CONTENT_TYPE, mimetype + "; charset=utf-8");
                     } else {
-                        response.getMetadata().add("Content-Type", mimetype);
+                        response.getMetadata().add(CONTENT_TYPE, mimetype);
                     }
                     if(length > 0) {
-                        response.getMetadata().add("Content-Length",length-fromL);
+                        response.getMetadata().add(CONTENT_LENGTH,length-fromL);
                     }
 
                     // append data links
                     String s = ResourceWebServiceHelper.buildMetaLinks(resource, kiWiIOService.getProducedTypes(), configurationService);
                     if (s != null) {
-                        response.getMetadata().add("Links", s);
+                        response.getMetadata().add(LINK, s);
                     }
                     return response;
                 } else {
-                    ImmutableMap<String, String> headers = ImmutableMap.of("Content-Type", ResourceWebServiceHelper.appendContentTypes(contentService.getContentType(resource)));
+                    ImmutableMap<String, String> headers = ImmutableMap.of(CONTENT_TYPE, appendContentTypes(contentService.getContentType(resource)));
                     throw new HttpErrorException(Status.NOT_ACCEPTABLE, resource.stringValue(), "no content for mimetype " + mimetype, headers);
                 }
             } finally {

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/InspectionWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/InspectionWebService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/InspectionWebService.java
index 13ba090..f10891e 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/InspectionWebService.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/InspectionWebService.java
@@ -17,6 +17,7 @@
  */
 package org.apache.marmotta.platform.core.webservices.resource;
 
+import com.google.common.net.HttpHeaders;
 import org.apache.marmotta.commons.sesame.model.Namespaces;
 import org.apache.marmotta.commons.sesame.repository.ResourceUtils;
 import org.apache.marmotta.platform.core.api.config.ConfigurationService;
@@ -315,7 +316,9 @@ public class InspectionWebService {
 
         ps.println();
         ps.println("</body></html>");
-        return Response.ok().header("Content-Type", "text/html;charset=" + CHARSET).header("Last-Modified", ResourceUtils.getLastModified(conn, rsc))
+        return Response.ok()
+                .header(HttpHeaders.CONTENT_TYPE, "text/html;charset=" + CHARSET)
+                .header(HttpHeaders.LAST_MODIFIED, ResourceUtils.getLastModified(conn, rsc))
                 .entity(os.toString(CHARSET)).build();
     }
 

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/MetaWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/MetaWebService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/MetaWebService.java
index 019b69d..49089a6 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/MetaWebService.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/MetaWebService.java
@@ -18,6 +18,7 @@
 package org.apache.marmotta.platform.core.webservices.resource;
 
 import com.google.common.collect.ImmutableMap;
+import com.google.common.net.HttpHeaders;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.marmotta.commons.collections.CollectionUtils;
 import org.apache.marmotta.commons.http.ETagGenerator;
@@ -54,6 +55,10 @@ import java.net.URLDecoder;
 import java.util.LinkedList;
 import java.util.List;
 
+import static com.google.common.net.HttpHeaders.ACCEPT;
+import static org.apache.marmotta.platform.core.webservices.resource.ResourceWebService.CHARSET;
+import static org.apache.marmotta.platform.core.webservices.resource.ResourceWebServiceHelper.appendMetaTypes;
+
 /**
  * Meta Web Services
  *
@@ -240,13 +245,13 @@ public class MetaWebService {
                 }
 
                 if (r == null || !ResourceUtils.isUsed(conn, r)) {
-                    throw new HttpErrorException(Response.Status.NOT_FOUND, resource, "the requested resource could not be found in Marmotta right now, but may be available again in the future", ImmutableMap.of("Accept", mimetype));
+                    throw new HttpErrorException(Response.Status.NOT_FOUND, resource, "the requested resource could not be found in Marmotta right now, but may be available again in the future", ImmutableMap.of(ACCEPT, mimetype));
                 }
 
                 // create parser
                 final RDFFormat serializer = kiWiIOService.getSerializer(mimetype);
                 if (serializer == null) {
-                    ImmutableMap<String, String> headers = ImmutableMap.of("Content-Type", ResourceWebServiceHelper.appendMetaTypes(kiWiIOService.getProducedTypes()));
+                    ImmutableMap<String, String> headers = ImmutableMap.of(HttpHeaders.CONTENT_TYPE, appendMetaTypes(kiWiIOService.getProducedTypes()));
                     throw new HttpErrorException(Status.NOT_ACCEPTABLE, resource, "mimetype can not be processed", headers);
                 }
 
@@ -287,14 +292,14 @@ public class MetaWebService {
                         components = resource.split("/");
                     }
                     final String fileName = components[components.length - 1] + "." + serializer.getDefaultFileExtension();
-                    response.getMetadata().add("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
+                    response.getMetadata().add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + fileName + "\"");
                 }
 
                 // create the Content-Type header for the response
                 if (mimetype.startsWith("text/") || mimetype.startsWith("application/")) {
-                    response.getMetadata().add("Content-Type", mimetype + "; charset=" + ResourceWebService.CHARSET);
+                    response.getMetadata().add(HttpHeaders.CONTENT_TYPE, mimetype + "; charset=" + CHARSET);
                 } else {
-                    response.getMetadata().add("Content-Type", mimetype);
+                    response.getMetadata().add(HttpHeaders.CONTENT_TYPE, mimetype);
                 }
 
                 // create the Link headers for the response
@@ -327,11 +332,11 @@ public class MetaWebService {
             RDFFormat parser = kiWiIOService.getParser(mimetype);
             if (parser == null) {
                 Response response = Response.status(Status.UNSUPPORTED_MEDIA_TYPE).entity("media type " + mimetype + " not supported").build();
-                ResourceWebServiceHelper.addHeader(response, "Content-Type", ResourceWebServiceHelper.appendMetaTypes(kiWiIOService.getProducedTypes()));
+                ResourceWebServiceHelper.addHeader(response, HttpHeaders.CONTENT_TYPE, appendMetaTypes(kiWiIOService.getProducedTypes()));
                 return response;
             }
             if (request.getContentLength() == 0) {
-                throw new HttpErrorException(Status.BAD_REQUEST, uri, "content may not be empty in resource update", ImmutableMap.of("Accept", mimetype));
+                throw new HttpErrorException(Status.BAD_REQUEST, uri, "content may not be empty in resource update", ImmutableMap.of(ACCEPT, mimetype));
             }
 
             // a intercepting connection that filters out all triples that have
@@ -355,9 +360,9 @@ public class MetaWebService {
             }
             return Response.ok().build();
         } catch (URISyntaxException e) {
-            throw new HttpErrorException(Status.INTERNAL_SERVER_ERROR, uri, "invalid target context", ImmutableMap.of("Accept", mimetype));
+            throw new HttpErrorException(Status.INTERNAL_SERVER_ERROR, uri, "invalid target context", ImmutableMap.of(ACCEPT, mimetype));
         } catch (IOException | RDFParseException e) {
-            throw new HttpErrorException(Status.NOT_ACCEPTABLE, uri, "could not parse request body", ImmutableMap.of("Accept", mimetype));
+            throw new HttpErrorException(Status.NOT_ACCEPTABLE, uri, "could not parse request body", ImmutableMap.of(ACCEPT, mimetype));
         } catch (RepositoryException e) {
             throw new HttpErrorException(Status.INTERNAL_SERVER_ERROR, request, e);
         }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/ResourceWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/ResourceWebService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/ResourceWebService.java
index 991c1f2..d2e4a7f 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/ResourceWebService.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/ResourceWebService.java
@@ -51,7 +51,9 @@ import java.util.Collections;
 import java.util.List;
 import java.util.UUID;
 
+import static com.google.common.net.HttpHeaders.*;
 import static javax.ws.rs.core.Response.status;
+import static org.apache.marmotta.platform.core.webservices.resource.ResourceWebServiceHelper.appendMetaTypes;
 
 /**
  * Resource Web Services
@@ -103,17 +105,17 @@ public class ResourceWebService {
      * @ResponseHeader Access-Control-Allow-Origin the origins that are allowable for cross-site scripting on this resource
      */
     @OPTIONS
-    public Response optionsResourceRemote(@QueryParam("uri") String uri, @HeaderParam("Access-Control-Request-Headers") String reqHeaders) {
+    public Response optionsResourceRemote(@QueryParam("uri") String uri, @HeaderParam(ACCESS_CONTROL_REQUEST_HEADERS) String reqHeaders) {
         if (reqHeaders == null) {
             reqHeaders = "Accept, Content-Type";
         }
 
         if (uri == null)
             return Response.ok()
-                    .header("Allow", "POST")
-                    .header("Access-Control-Allow-Methods", "POST")
-                    .header("Access-Control-Allow-Headers", reqHeaders)
-                    .header("Access-Control-Allow-Origin", configurationService.getStringConfiguration("kiwi.allow_origin", "*"))
+                    .header(ALLOW, "POST")
+                    .header(ACCESS_CONTROL_ALLOW_METHODS, "POST")
+                    .header(ACCESS_CONTROL_ALLOW_HEADERS, reqHeaders)
+                    .header(ACCESS_CONTROL_ALLOW_ORIGIN, configurationService.getStringConfiguration("kiwi.allow_origin", "*"))
                     .build();
         else {
             try {
@@ -126,17 +128,17 @@ public class ResourceWebService {
                     conn.commit();
 
                     if (resource != null) return Response.ok()
-                            .header("Allow", "PUT, GET, DELETE")
-                            .header("Access-Control-Allow-Methods", "PUT, GET, DELETE")
-                            .header("Access-Control-Allow-Headers", reqHeaders)
-                            .header("Access-Control-Allow-Origin", configurationService.getStringConfiguration("kiwi.allow_origin", "*"))
+                            .header(ALLOW, "PUT, GET, DELETE")
+                            .header(ACCESS_CONTROL_ALLOW_METHODS, "PUT, GET, DELETE")
+                            .header(ACCESS_CONTROL_ALLOW_HEADERS, reqHeaders)
+                            .header(ACCESS_CONTROL_ALLOW_ORIGIN, configurationService.getStringConfiguration("kiwi.allow_origin", "*"))
                             .build();
                     else
                         return Response.ok()
-                                .header("Allow", "POST")
-                                .header("Access-Control-Allow-Methods", "POST")
-                                .header("Access-Control-Allow-Headers", reqHeaders)
-                                .header("Access-Control-Allow-Origin", configurationService.getStringConfiguration("kiwi.allow_origin", "*"))
+                                .header(ALLOW, "POST")
+                                .header(ACCESS_CONTROL_ALLOW_METHODS, "POST")
+                                .header(ACCESS_CONTROL_ALLOW_HEADERS, reqHeaders)
+                                .header(ACCESS_CONTROL_ALLOW_ORIGIN, configurationService.getStringConfiguration("kiwi.allow_origin", "*"))
                                 .build();
                 } finally {
                     conn.close();
@@ -162,7 +164,7 @@ public class ResourceWebService {
      */
     @OPTIONS
     @Path(UUID_PATTERN)
-    public Response optionsResourceLocal(@PathParam("uuid") String uuid, @HeaderParam("Access-Control-Request-Headers") String reqHeaders) {
+    public Response optionsResourceLocal(@PathParam("uuid") String uuid, @HeaderParam(ACCESS_CONTROL_REQUEST_HEADERS) String reqHeaders) {
         String uri = configurationService.getBaseUri() + "resource/" + uuid;
 
         if (reqHeaders == null) {
@@ -182,17 +184,17 @@ public class ResourceWebService {
 
 
                     if (resource != null) return Response.ok()
-                            .header("Allow", "PUT, GET, DELETE")
-                            .header("Access-Control-Allow-Methods", "PUT, GET, DELETE")
-                            .header("Access-Control-Allow-Headers", reqHeaders)
-                            .header("Access-Control-Allow-Origin", configurationService.getStringConfiguration("kiwi.allow_origin", "*"))
+                            .header(ALLOW, "PUT, GET, DELETE")
+                            .header(ACCESS_CONTROL_ALLOW_METHODS, "PUT, GET, DELETE")
+                            .header(ACCESS_CONTROL_ALLOW_HEADERS, reqHeaders)
+                            .header(ACCESS_CONTROL_ALLOW_ORIGIN, configurationService.getStringConfiguration("kiwi.allow_origin", "*"))
                             .build();
                     else
                         return Response.ok()
-                                .header("Allow", "POST")
-                                .header("Access-Control-Allow-Methods", "POST")
-                                .header("Access-Control-Allow-Headers", reqHeaders)
-                                .header("Access-Control-Allow-Origin", configurationService.getStringConfiguration("kiwi.allow_origin", "*"))
+                                .header(ALLOW, "POST")
+                                .header(ACCESS_CONTROL_ALLOW_METHODS, "POST")
+                                .header(ACCESS_CONTROL_ALLOW_HEADERS, reqHeaders)
+                                .header(ACCESS_CONTROL_ALLOW_ORIGIN, configurationService.getStringConfiguration("kiwi.allow_origin", "*"))
                                 .build();
 
                 } finally {
@@ -264,8 +266,8 @@ public class ResourceWebService {
                     status = Status.CREATED;
                 }
                 Response response = status(status).entity(uri).build();
-                response.getMetadata().add("Location", location);
-                response.getMetadata().add("Vary", "Content-Type");
+                response.getMetadata().add(LOCATION, location);
+                response.getMetadata().add(VARY, CONTENT_TYPE);
                 return response;
             } finally {
                 conn.commit();
@@ -296,7 +298,7 @@ public class ResourceWebService {
      */
     @GET
     @Path(UUID_PATTERN)
-    public Response getLocal(@PathParam("uuid") String uuid, @HeaderParam("Accept") String types) throws UnsupportedEncodingException, HttpErrorException {
+    public Response getLocal(@PathParam("uuid") String uuid, @HeaderParam(javax.ws.rs.core.HttpHeaders.ACCEPT) String types) throws UnsupportedEncodingException, HttpErrorException {
         String uri = configurationService.getBaseUri() + "resource/" + uuid;
         try {
             return get(uri, types);
@@ -374,7 +376,7 @@ public class ResourceWebService {
                     }
                 }
                 if (r == null) {
-                    throw new HttpErrorException(Status.NOT_FOUND, resource, "the requested resource could not be found in Marmotta right now, but may be available again in the future", ImmutableMap.of("Accept", types));
+                    throw new HttpErrorException(Status.NOT_FOUND, resource, "the requested resource could not be found in Marmotta right now, but may be available again in the future", ImmutableMap.of(ACCEPT, types));
                 }
                 // FIXME String appendix = uuid == null ? "?uri=" + URLEncoder.encode(uri, "utf-8") :
                 // "/" + uuid;
@@ -420,7 +422,7 @@ public class ResourceWebService {
 
     private Response build406(List<ContentType> acceptedTypes, List<ContentType> offeredTypes) {
         ResponseBuilder response = Response.status(Status.NOT_ACCEPTABLE);
-        response.header("Content-Type", "text/plain; charset=UTF-8");
+        response.header(CONTENT_TYPE, "text/plain; charset=UTF-8");
 
         StringBuilder entity = new StringBuilder();
         entity.append("Could not find matching type for " + acceptedTypes + "\n");
@@ -548,7 +550,7 @@ public class ResourceWebService {
                 }
             } else {
                 Response response = Response.status(415).entity("type " + mimetype + " not supported").build();
-                ResourceWebServiceHelper.addHeader(response, "Content-Type", ResourceWebServiceHelper.appendMetaTypes(kiWiIOService.getAcceptTypes()));
+                ResourceWebServiceHelper.addHeader(response, CONTENT_TYPE, appendMetaTypes(kiWiIOService.getAcceptTypes()));
                 return response;
             }
         } catch (RepositoryException e) {
@@ -617,8 +619,8 @@ public class ResourceWebService {
             return Response
                     .status(configurationService.getIntConfiguration(
                             "linkeddata.redirect.status", 303))
-                    .header("Vary", "Accept")
-                    .header("Content-Type", type.toString())
+                    .header("Vary", ACCEPT)
+                    .header(CONTENT_TYPE, type.toString())
                             // .location(new URI(configurationService.getBaseUri() +
                             // type.getParameter("rel") + "/" + type.getType() + "/"
                             // +type.getSubtype() +

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/triplestore/ContextWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/triplestore/ContextWebService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/triplestore/ContextWebService.java
index 3527b5b..d3f4778 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/triplestore/ContextWebService.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/triplestore/ContextWebService.java
@@ -17,6 +17,7 @@
  */
 package org.apache.marmotta.platform.core.webservices.triplestore;
 
+import com.google.common.net.HttpHeaders;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.marmotta.commons.http.ContentType;
 import org.apache.marmotta.commons.http.MarmottaHttpUtils;
@@ -126,7 +127,7 @@ public class ContextWebService {
     @GET
     public Response get(@QueryParam("graph") String context, @HeaderParam("Accept") String accept, @QueryParam("format") String format) throws URISyntaxException {
         if (StringUtils.isBlank(context)) {
-            return Response.seeOther(new URI(configurationService.getServerUri() + ConfigurationService.CONTEXT_PATH + "/list")).header("Accept", accept).build();
+            return Response.seeOther(new URI(configurationService.getServerUri() + ConfigurationService.CONTEXT_PATH + "/list")).header(HttpHeaders.ACCEPT, accept).build();
         } else {
             URI uri = buildExportUri(context, accept, format);
             return Response.seeOther(uri).build();        

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/webservices/SparqlWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/webservices/SparqlWebService.java b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/webservices/SparqlWebService.java
index 0b5a090..3fde761 100644
--- a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/webservices/SparqlWebService.java
+++ b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/webservices/SparqlWebService.java
@@ -62,6 +62,8 @@ import java.util.concurrent.TimeoutException;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import static javax.ws.rs.core.HttpHeaders.ACCEPT;
+import static javax.ws.rs.core.HttpHeaders.CONTENT_TYPE;
 import static org.openrdf.rio.RDFFormat.RDFXML;
 
 /**
@@ -230,7 +232,7 @@ public class SparqlWebService {
      */
 	private Response select(String query, String resultType, HttpServletRequest request) {
 		try {
-	    	String acceptHeader = StringUtils.defaultString(request.getHeader("Accept"), "");
+	    	String acceptHeader = StringUtils.defaultString(request.getHeader(ACCEPT), "");
 	    	if (StringUtils.isBlank(query)) { //empty query
 	            if (acceptHeader.contains("html")) {
 	                return Response.seeOther(new URI(configurationService.getServerUri() + "sparql/admin/squebi.html")).build();
@@ -387,7 +389,7 @@ public class SparqlWebService {
                 return Response.ok().build();
             } else {
                 if (resultType == null) {
-                    List<ContentType> acceptedTypes = MarmottaHttpUtils.parseAcceptHeader(request.getHeader("Accept"));
+                    List<ContentType> acceptedTypes = MarmottaHttpUtils.parseAcceptHeader(request.getHeader(ACCEPT));
                     List<ContentType> offeredTypes = MarmottaHttpUtils.parseStringList(Lists.newArrayList("*/*", "text/html"));
                     ContentType bestType = MarmottaHttpUtils.bestContentType(offeredTypes, acceptedTypes);
                     if (bestType != null) {
@@ -459,10 +461,10 @@ public class SparqlWebService {
     
     private Response createServiceDescriptionResponse(final HttpServletRequest request, final boolean isUpdate) {
         final List<ContentType> acceptedTypes;
-        if (StringUtils.isBlank(request.getHeader("Accept"))) {
+        if (StringUtils.isBlank(request.getHeader(ACCEPT))) {
             acceptedTypes = Collections.singletonList(MarmottaHttpUtils.parseContentType(RDFXML.getDefaultMIMEType()));
         } else {
-            acceptedTypes = MarmottaHttpUtils.parseAcceptHeader(request.getHeader("Accept"));
+            acceptedTypes = MarmottaHttpUtils.parseAcceptHeader(request.getHeader(ACCEPT));
         }
         
         ContentType _bestType = null;
@@ -516,7 +518,7 @@ public class SparqlWebService {
             }
         };
         
-        final ResponseBuilder responseBuilder = Response.ok().entity(entity).header("Content-Type", format.getMime());
+        final ResponseBuilder responseBuilder = Response.ok().entity(entity).header(CONTENT_TYPE, format.getMime());
         final TupleQueryResultFormat fmt = QueryResultIO.getWriterFormatForMIMEType(format.getMime());
         if (fmt != null) {
             responseBuilder.header("Content-Disposition", String.format("attachment; filename=\"%s.%s\"", queryType.toString().toLowerCase(), fmt.getDefaultFileExtension()));

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
index c6c7c0c..ea7af2a 100644
--- a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
+++ b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
@@ -41,14 +41,13 @@ import javax.ws.rs.core.Response.Status;
 import java.io.UnsupportedEncodingException;
 import java.net.URISyntaxException;
 import java.net.URLEncoder;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import static com.google.common.net.HttpHeaders.ACCEPT;
+import static com.google.common.net.HttpHeaders.REFERER;
+
 /**
  * User-Account related webservices, accessable by every user (each for his/her own data)
  *
@@ -248,7 +247,7 @@ public class UserWebService {
 
                     java.net.URI u = new java.net.URI(configurationService.getServerUri() + "resource?uri=" + URLEncoder.encode(user.stringValue(), "utf-8"));
 
-                    return Response.seeOther(u).header("Accept", types).build();
+                    return Response.seeOther(u).header(ACCEPT, types).build();
                 } finally {
                     conn.commit();
                     conn.close();
@@ -275,7 +274,7 @@ public class UserWebService {
      */
     @GET
     @Path("/login")
-    public Response login(@HeaderParam("Referer") String ref, @QueryParam("logout") @DefaultValue("false") boolean logout,
+    public Response login(@HeaderParam(REFERER) String ref, @QueryParam("logout") @DefaultValue("false") boolean logout,
                           @QueryParam("user") String login) {
         // Check whether we want to logout
         if (logout) {

http://git-wip-us.apache.org/repos/asf/marmotta/blob/807f3710/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/webservices/MementoWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/webservices/MementoWebService.java b/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/webservices/MementoWebService.java
index d04bda2..78994cb 100644
--- a/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/webservices/MementoWebService.java
+++ b/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/webservices/MementoWebService.java
@@ -57,6 +57,8 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import static com.google.common.net.HttpHeaders.*;
+
 /**
  * Webservice manages memento related services, namely:
  * <ul>
@@ -125,9 +127,9 @@ public class MementoWebService {
                 return Response
                         .status(301)
                         .location(MementoUtils.resourceURI(resource_string, versions.getCurrent().getCommitTime(), configurationService.getBaseUri()))
-                        .header("Vary", "negotiate, accept-datetime, accept")
+                        .header(VARY, "negotiate, accept-datetime, accept")
                         .header("Memento-Datetime", versions.getCurrent().getCommitTime().toString())
-                        .header("Link", CollectionUtils.fold(links, ", "))
+                        .header(LINK, CollectionUtils.fold(links, ", "))
                         .build();
 
             } catch (MementoException e) {
@@ -160,7 +162,7 @@ public class MementoWebService {
     @Path("/" + MementoUtils.MEMENTO_RESOURCE + "/{date:[^/]+}/{resource:.+}")
     public Response resourceService(@PathParam("date")String date_string,
                                     @PathParam("resource") String resource_string,
-                                    @HeaderParam("Accept") String types_string) {
+                                    @HeaderParam(ACCEPT) String types_string) {
 
         try {
             //check preconditions
@@ -219,8 +221,8 @@ public class MementoWebService {
                 //create response
                 return Response
                         .ok()
-                        .header("Link", CollectionUtils.fold(links," ,"))
-                        .header("Content-Type", type.toString())
+                        .header(LINK, CollectionUtils.fold(links," ,"))
+                        .header(CONTENT_TYPE, type.toString())
                         .header("Memento-Datetime", MementoUtils.MEMENTO_DATE_FORMAT.format(versions.getCurrent().getCommitTime()))
                         .entity(entity)
                         .build();
@@ -247,7 +249,7 @@ public class MementoWebService {
     @GET
     @Path("/" + MementoUtils.MEMENTO_TIMEMAP + "/{resource:.+}")
     public Response timemapService(@PathParam("resource") String resource_string,
-                                   @HeaderParam("Accept") String types_string) {
+                                   @HeaderParam(ACCEPT) String types_string) {
 
         try {
             //check preconditions
@@ -285,8 +287,8 @@ public class MementoWebService {
                 //create response
                 return Response
                         .ok()
-                        .header("Link", CollectionUtils.fold(links," ,"))
-                        .header("Content-Type", serializer.getContentType().toString())
+                        .header(LINK, CollectionUtils.fold(links," ,"))
+                        .header(CONTENT_TYPE, serializer.getContentType().toString())
                         .entity(entity)
                         .build();
 


Mime
View raw message