You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2014/03/17 09:54:45 UTC

[01/11] git commit: MARMOTTA-238: improved http error handling, moving to the new jarx-rs + cdi infrastructure

Repository: marmotta
Updated Branches:
  refs/heads/MARMOTTA-450 b07ed1383 -> cebdd6404


MARMOTTA-238: improved http error handling, moving to the new jarx-rs + cdi infrastructure


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

Branch: refs/heads/MARMOTTA-450
Commit: d297c0a2a2d9e1e95bf924af4a17239ef91dccef
Parents: 0a69f01
Author: Sergio Fernández <wi...@apache.org>
Authored: Sun Mar 2 20:46:45 2014 +0100
Committer: Sergio Fernández <wi...@apache.org>
Committed: Sun Mar 2 20:46:45 2014 +0100

----------------------------------------------------------------------
 .../core/exception/HttpErrorException.java      | 107 +++++++
 .../core/jaxrs/HttpErrorExceptionMapper.java    |  91 ++++++
 .../jaxrs/MarmottaImportExceptionMapper.java    |   1 -
 .../webservices/resource/ContentWebService.java |  83 +++---
 .../webservices/resource/MetaWebService.java    | 194 ++++++-------
 .../resource/ResourceWebService.java            | 282 +++++++++----------
 .../resource/ResourceWebServiceHelper.java      |  65 ++---
 .../src/main/resources/templates/error.ftl      |  83 ++++++
 .../resources/web/public/style/blue/error.css   |  43 +++
 .../resources/web/public/style/white/error.css  |  44 +++
 10 files changed, 650 insertions(+), 343 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/d297c0a2/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
new file mode 100644
index 0000000..381e9da
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/exception/HttpErrorException.java
@@ -0,0 +1,107 @@
+/**
+ * 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.platform.core.exception;
+
+import edu.emory.mathcs.backport.java.util.Collections;
+
+import javax.ws.rs.core.Response;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Resource Not Found Exception
+ *
+ * @author Sergio Fernández
+ */
+public class HttpErrorException extends Exception {
+
+    private final int status;
+    private final String reason;
+    private final String uri;
+
+    private final Map<String, String> headers;
+
+    /**
+     * Constructs an instance with the specified details
+     *
+     * @param status http status code
+     * @param reason reason phrase
+     * @param uri resource uri
+     * @param msg message
+     */
+    public HttpErrorException(int status, String reason, String uri, String msg) {
+        this(status, reason, uri, msg, new HashMap<String,String>());
+    }
+
+    /**
+     * Constructs an instance with the specified details
+     *
+     * @param status http status code
+     * @param uri resource uri
+     * @param msg message
+     */
+    public HttpErrorException(Response.Status status, String uri, String msg) {
+        this(status.getStatusCode(), status.getReasonPhrase(), uri, msg);
+    }
+
+    /**
+     * Constructs an instance with the specified details
+     *
+     * @param status http status code
+     * @param uri resource uri
+     * @param msg message
+     * @param headers custom headers
+     */
+    public HttpErrorException(Response.Status status, String uri, String msg, Map<String,String> headers) {
+        this(status.getStatusCode(), status.getReasonPhrase(), uri, msg, headers);
+    }
+
+    /**
+     * Constructs an instance with the specified details
+     *
+     * @param status http status code
+     * @param reason reason phrase
+     * @param uri resource uri
+     * @param msg message
+     * @param headers custom headers
+     */
+    public HttpErrorException(int status, String reason, String uri, String msg, Map<String,String> headers) {
+        super(msg);
+        this.status = status;
+        this.reason = reason;
+        this.uri = uri;
+        this.headers = new HashMap<String,String>(headers);
+    }
+
+    public int getStatus() {
+        return status;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public String getUri() {
+        return uri;
+    }
+
+    public Map<String, String> getHeaders() {
+        return Collections.unmodifiableMap(headers);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/d297c0a2/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/HttpErrorExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/HttpErrorExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/HttpErrorExceptionMapper.java
new file mode 100644
index 0000000..eb53cdb
--- /dev/null
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/HttpErrorExceptionMapper.java
@@ -0,0 +1,91 @@
+/*
+ * 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.platform.core.jaxrs;
+
+import freemarker.template.TemplateException;
+import org.apache.marmotta.platform.core.api.config.ConfigurationService;
+import org.apache.marmotta.platform.core.api.templating.TemplatingService;
+import org.apache.marmotta.platform.core.exception.HttpErrorException;
+import org.slf4j.Logger;
+
+import javax.enterprise.context.Dependent;
+import javax.inject.Inject;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.Provider;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Map HttpErrorExceptionMapper to a internal server error and return the default error object
+ *
+ * @author Sergio Fernández
+ */
+@Provider
+@Dependent
+public class HttpErrorExceptionMapper implements CDIExceptionMapper<HttpErrorException> {
+
+    private final String TEMPLATE = "error.ftl";
+
+    @Inject
+    private Logger log;
+
+    @Inject
+    private ConfigurationService configurationService;
+
+    @Inject
+    private TemplatingService templatingService;
+
+    /**
+     * Map an exception to a {@link javax.ws.rs.core.Response}. Returning
+     * {@code null} results in a {@link javax.ws.rs.core.Response.Status#NO_CONTENT}
+     * response. Throwing a runtime exception results in a
+     * {@link javax.ws.rs.core.Response.Status#INTERNAL_SERVER_ERROR} response
+     *
+     * @param exception the exception to map to a response
+     * @return a response mapped from the supplied exception
+     */
+    @Override
+    public Response toResponse(HttpErrorException exception) {
+        Map<String, Object> data = new HashMap<String, Object>();
+        data.put("status", exception.getStatus());
+        data.put("reason", exception.getReason());
+        data.put("uri", exception.getUri());
+        data.put("message", exception.getMessage());
+        try {
+            data.put("encoded_uri", URLEncoder.encode(exception.getUri(), "UTF-8"));
+        } catch (UnsupportedEncodingException uee) {
+            data.put("encoded_uri", exception.getUri());
+        }
+
+        Response.ResponseBuilder responseBuilder;
+        try {
+            responseBuilder = Response.status(exception.getStatus()).entity(templatingService.process(TEMPLATE, data));
+        } catch (IOException | TemplateException e) {
+            log.error("Error rendering template {}: {}", TEMPLATE, e.getMessage());
+            responseBuilder = Response.status(exception.getStatus()).entity(e.getMessage());
+        }
+        Response response = responseBuilder.build();
+        for (Map.Entry<String, String> entry : exception.getHeaders().entrySet()) {
+            response.getMetadata().add(entry.getKey(), entry.getValue());
+        }
+        return response;
+    }
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/d297c0a2/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaImportExceptionMapper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaImportExceptionMapper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaImportExceptionMapper.java
index 9b67df1..1930b79 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaImportExceptionMapper.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/jaxrs/MarmottaImportExceptionMapper.java
@@ -19,7 +19,6 @@ package org.apache.marmotta.platform.core.jaxrs;
 
 import org.apache.marmotta.platform.core.exception.io.MarmottaImportException;
 
-import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.context.Dependent;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.ext.Provider;

http://git-wip-us.apache.org/repos/asf/marmotta/blob/d297c0a2/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 7013767..b37fc3a 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
@@ -17,36 +17,14 @@
  */
 package org.apache.marmotta.platform.core.webservices.resource;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.URISyntaxException;
-import java.net.URLDecoder;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Event;
-import javax.inject.Inject;
-import javax.servlet.http.HttpServletRequest;
-import javax.validation.constraints.NotNull;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-
+import com.google.common.collect.ImmutableMap;
 import org.apache.marmotta.platform.core.api.config.ConfigurationService;
 import org.apache.marmotta.platform.core.api.content.ContentService;
 import org.apache.marmotta.platform.core.api.io.MarmottaIOService;
 import org.apache.marmotta.platform.core.api.templating.TemplatingService;
 import org.apache.marmotta.platform.core.api.triplestore.SesameService;
 import org.apache.marmotta.platform.core.events.ContentCreatedEvent;
+import org.apache.marmotta.platform.core.exception.HttpErrorException;
 import org.apache.marmotta.platform.core.exception.MarmottaException;
 import org.apache.marmotta.platform.core.exception.WritingNotSupportedException;
 import org.apache.marmotta.platform.core.qualifiers.event.ContentCreated;
@@ -55,6 +33,23 @@ import org.openrdf.model.URI;
 import org.openrdf.repository.RepositoryConnection;
 import org.openrdf.repository.RepositoryException;
 
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Event;
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URISyntaxException;
+import java.net.URLDecoder;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 /**
  * Content Web Services
  *
@@ -105,7 +100,7 @@ public class ContentWebService {
      */
     @GET
     @Path(ResourceWebService.MIME_PATTERN + ResourceWebService.UUID_PATTERN)
-    public Response getContentLocal(@PathParam("uuid") String uuid, @PathParam("mimetype") String mimetype, @HeaderParam("Range") String range) throws UnsupportedEncodingException {
+    public Response getContentLocal(@PathParam("uuid") String uuid, @PathParam("mimetype") String mimetype, @HeaderParam("Range") String range) throws UnsupportedEncodingException, HttpErrorException {
         String uri = configurationService.getBaseUri() + "resource/" + uuid;
         return getContent(uri, mimetype, range);
     }
@@ -131,7 +126,7 @@ public class ContentWebService {
      */
     @GET
     @Path(ResourceWebService.MIME_PATTERN)
-    public Response getContentRemote(@QueryParam("uri") @NotNull String uri, @PathParam("mimetype") String mimetype, @HeaderParam("Range") String range) throws UnsupportedEncodingException {
+    public Response getContentRemote(@QueryParam("uri") @NotNull String uri, @PathParam("mimetype") String mimetype, @HeaderParam("Range") String range) throws UnsupportedEncodingException, HttpErrorException {
         return getContent(URLDecoder.decode(uri, "utf-8"), mimetype, range);
     }
     
@@ -215,7 +210,7 @@ public class ContentWebService {
      */
     @PUT
     @Path(ResourceWebService.MIME_PATTERN + ResourceWebService.UUID_PATTERN)
-    public Response putContentLocal(@PathParam("uuid") String uuid, @PathParam("mimetype") String mimetype, @Context HttpServletRequest request) {
+    public Response putContentLocal(@PathParam("uuid") String uuid, @PathParam("mimetype") String mimetype, @Context HttpServletRequest request) throws HttpErrorException {
         String uri = configurationService.getBaseUri() + "resource/" + uuid;
         return putContent(uri, mimetype, request);
     }
@@ -239,7 +234,7 @@ public class ContentWebService {
     @PUT
     @Path(ResourceWebService.MIME_PATTERN)
     public Response putContentRemote(@QueryParam("uri") @NotNull String uri, @PathParam("mimetype") String mimetype, @Context HttpServletRequest request)
-            throws UnsupportedEncodingException {
+            throws UnsupportedEncodingException, HttpErrorException {
         return putContent(URLDecoder.decode(uri, "utf-8"), mimetype, request);
     }
 
@@ -255,16 +250,18 @@ public class ContentWebService {
      * @HTTP 404 resource or resource content not found
      */
     @DELETE
-    public Response deleteContentRemote(@QueryParam("uri") @NotNull String uri) throws UnsupportedEncodingException {
+    public Response deleteContentRemote(@QueryParam("uri") @NotNull String uri) throws UnsupportedEncodingException, HttpErrorException {
         try {
             RepositoryConnection conn = sesameService.getConnection();
             try {
                 conn.begin();
                 Resource resource = conn.getValueFactory().createURI(uri);
                 if (resource != null) {
-                    if (contentService.deleteContent(resource)) return Response.ok().build();
-                    else
-                        return ResourceWebServiceHelper.buildErrorPage(uri, configurationService.getBaseUri(), Response.Status.NOT_FOUND, "no content found for this resource in LMF right now, but may be available again in the future", configurationService, templatingService);
+                    if (contentService.deleteContent(resource)) {
+                        return Response.ok().build();
+                    } else {
+                        throw new HttpErrorException(Response.Status.NOT_FOUND, uri, "no content found for this resource in Marmotta right now, but may be available again in the future");
+                    }
                 }
                 return Response.status(Response.Status.NOT_FOUND).build();
             } finally {
@@ -290,12 +287,12 @@ public class ContentWebService {
      */
     @DELETE
     @Path(ResourceWebService.UUID_PATTERN)
-    public Response deleteContentLocal(@PathParam("uuid") String uuid) throws UnsupportedEncodingException {
+    public Response deleteContentLocal(@PathParam("uuid") String uuid) throws UnsupportedEncodingException, HttpErrorException {
         String uri = configurationService.getBaseUri() + "resource/" + uuid;
         return deleteContentRemote(uri);
     }
 
-    private Response getContent(String uri, String mimetype, String range) throws UnsupportedEncodingException {
+    private Response getContent(String uri, String mimetype, String range) throws UnsupportedEncodingException, HttpErrorException {
         try {
             // FIXME String appendix = uuid == null ? "?uri=" + URLEncoder.encode(uri, "utf-8") :
             // "/" + uuid;
@@ -356,9 +353,8 @@ public class ContentWebService {
                     }
                     return response;
                 } else {
-                    Response response = ResourceWebServiceHelper.buildErrorPage(uri, configurationService.getBaseUri(), Status.NOT_ACCEPTABLE, "no content for mimetype " + mimetype, configurationService, templatingService);
-                    ResourceWebServiceHelper.addHeader(response, "Content-Type", ResourceWebServiceHelper.appendContentTypes(contentService.getContentType(resource)));
-                    return response;
+                    ImmutableMap<String, String> headers = ImmutableMap.of("Content-Type", ResourceWebServiceHelper.appendContentTypes(contentService.getContentType(resource)));
+                    throw new HttpErrorException(Status.NOT_ACCEPTABLE, resource.stringValue(), "no content for mimetype " + mimetype, headers);
                 }
             } finally {
                 conn.close();
@@ -370,7 +366,7 @@ public class ContentWebService {
         }
     }
 
-    public Response putContent(String uri, String mimetype, HttpServletRequest request) {
+    public Response putContent(String uri, String mimetype, HttpServletRequest request) throws HttpErrorException {
         try {
             final RepositoryConnection conn = sesameService.getConnection();
             try {
@@ -386,19 +382,20 @@ public class ContentWebService {
         }
     }
 
-    public Response putContent(URI resource, String mimetype, HttpServletRequest request) {
+    public Response putContent(URI resource, String mimetype, HttpServletRequest request) throws HttpErrorException {
         try {
-            if (request.getContentLength() == 0)
-                return ResourceWebServiceHelper.buildErrorPage(resource.stringValue(), configurationService.getBaseUri(), Status.BAD_REQUEST, "content may not be empty for writting", configurationService, templatingService);
+            if (request.getContentLength() == 0) {
+                throw new HttpErrorException(Status.BAD_REQUEST, resource.stringValue(), "content may not be empty for writing");
+            }
             contentService.setContentStream(resource, request.getInputStream(), mimetype); // store content
             if(configurationService.getBooleanConfiguration(ENHANCER_STANBOL_ENHANCER_ENABLED, false)) {
                 afterContentCreated.fire(new ContentCreatedEvent(resource)); //enhancer
             }
             return Response.ok().build();
         } catch (IOException e) {
-            return ResourceWebServiceHelper.buildErrorPage(resource.stringValue(), configurationService.getBaseUri(), Status.BAD_REQUEST, "could not read request body", configurationService, templatingService);
+            throw new HttpErrorException(Status.BAD_REQUEST, resource.stringValue(), "could not read request body");
         } catch (WritingNotSupportedException e) {
-            return ResourceWebServiceHelper.buildErrorPage(resource.stringValue(), configurationService.getBaseUri(), Status.FORBIDDEN, "writting this content is not supported", configurationService, templatingService);
+            throw new HttpErrorException(Status.FORBIDDEN, resource.stringValue(), "writting this content is not supported");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/marmotta/blob/d297c0a2/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 cf43488..ae3fb48 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
@@ -17,30 +17,7 @@
  */
 package org.apache.marmotta.platform.core.webservices.resource;
 
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.URISyntaxException;
-import java.net.URLDecoder;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.servlet.http.HttpServletRequest;
-import javax.validation.constraints.NotNull;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.StreamingOutput;
-
+import com.google.common.collect.ImmutableMap;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.marmotta.commons.collections.CollectionUtils;
 import org.apache.marmotta.commons.http.ETagGenerator;
@@ -52,17 +29,31 @@ import org.apache.marmotta.platform.core.api.io.MarmottaIOService;
 import org.apache.marmotta.platform.core.api.templating.TemplatingService;
 import org.apache.marmotta.platform.core.api.triplestore.ContextService;
 import org.apache.marmotta.platform.core.api.triplestore.SesameService;
+import org.apache.marmotta.platform.core.exception.HttpErrorException;
 import org.apache.marmotta.platform.core.services.sesame.ResourceSubjectMetadata;
 import org.openrdf.model.Resource;
 import org.openrdf.repository.RepositoryConnection;
 import org.openrdf.repository.RepositoryException;
 import org.openrdf.repository.event.InterceptingRepositoryConnection;
 import org.openrdf.repository.event.base.InterceptingRepositoryConnectionWrapper;
-import org.openrdf.rio.RDFFormat;
-import org.openrdf.rio.RDFHandlerException;
-import org.openrdf.rio.RDFParseException;
-import org.openrdf.rio.RDFWriter;
-import org.openrdf.rio.Rio;
+import org.openrdf.rio.*;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.core.StreamingOutput;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URISyntaxException;
+import java.net.URLDecoder;
+import java.util.LinkedList;
+import java.util.List;
 
 /**
  * Meta Web Services
@@ -76,10 +67,10 @@ public class MetaWebService {
 
     @Inject
     private ConfigurationService configurationService;
-    
+
     @Inject
     private TemplatingService templatingService;
-    
+
     @Inject
     private ContextService contextService;
 
@@ -96,54 +87,50 @@ public class MetaWebService {
      * Returns remote resource metadata with the given uri and an accepted
      * return type (mimetype)
      *
-     * @param uri
-     *            , the fully-qualified URI of the resource to create in the
-     *            triple store
-     * @param mimetype
-     *            , accepted mimetype follows the pattern .+/.+
+     * @param uri      , the fully-qualified URI of the resource to create in the
+     *                 triple store
+     * @param mimetype , accepted mimetype follows the pattern .+/.+
      * @return a remote resource's metadata (body is the resource data in
-     *         requested format)
+     * requested format)
      * @HTTP 200 resource metadata found and returned
      * @HTTP 400 bad request (maybe uri is not defined)
      * @HTTP 404 resource cannot be found
      * @HTTP 406 resource cannot be found in the given format
      * @HTTP 500 Internal Error
      * @ResponseHeader Content-Type (for HTTP 406) a list of available metadata
-     *                 types
+     * types
      */
     @GET
     @Path(ResourceWebService.MIME_PATTERN)
-    public Response getMetaRemote(@QueryParam("uri") String uri, @QueryParam("genid") String genid, @PathParam("mimetype") String mimetype) throws UnsupportedEncodingException {
-    	if (StringUtils.isNotBlank(uri)) {
-    		return getMeta(URLDecoder.decode(uri, "utf-8"), mimetype);
-    	} else if (StringUtils.isNotBlank(genid)) {
-    		return getMeta(URLDecoder.decode(genid, "utf-8"), mimetype);
-    	} else {
-    		return ResourceWebServiceHelper.buildErrorPage(uri, configurationService.getBaseUri(), Status.BAD_REQUEST, "Invalid Request", configurationService, templatingService);
-    	}
+    public Response getMetaRemote(@QueryParam("uri") String uri, @QueryParam("genid") String genid, @PathParam("mimetype") String mimetype) throws UnsupportedEncodingException, HttpErrorException {
+        if (StringUtils.isNotBlank(uri)) {
+            return getMeta(URLDecoder.decode(uri, "utf-8"), mimetype);
+        } else if (StringUtils.isNotBlank(genid)) {
+            return getMeta(URLDecoder.decode(genid, "utf-8"), mimetype);
+        } else {
+            throw new HttpErrorException(Status.BAD_REQUEST, uri, "Invalid Request");
+        }
     }
 
     /**
      * Returns local resource data with the given uuid and an accepted return
      * type (mimetype)
      *
-     * @param uuid
-     *            , a unique identifier (must not contain url specific
-     *            characters like /,# etc.)
-     * @param mimetype
-     *            , accepted mimetype follows the pattern .+/.+
+     * @param uuid     , a unique identifier (must not contain url specific
+     *                 characters like /,# etc.)
+     * @param mimetype , accepted mimetype follows the pattern .+/.+
      * @return a local resource's metadata (body is the resource data in
-     *         requested format)
+     * requested format)
      * @HTTP 200 resource data found and returned
      * @HTTP 404 resource cannot be found
      * @HTTP 406 resource cannot be found in the given format
      * @HTTP 500 Internal Error
      * @ResponseHeader Content-Type (for HTTP 406) a list of available metadata
-     *                 types
+     * types
      */
     @GET
     @Path(ResourceWebService.MIME_PATTERN + ResourceWebService.UUID_PATTERN)
-    public Response getMetaLocal(@PathParam("uuid") String uuid, @PathParam("mimetype") String mimetype) throws UnsupportedEncodingException {
+    public Response getMetaLocal(@PathParam("uuid") String uuid, @PathParam("mimetype") String mimetype) throws UnsupportedEncodingException, HttpErrorException {
         String uri = configurationService.getBaseUri() + "resource/" + uuid;
         return getMeta(uri, mimetype);
     }
@@ -151,11 +138,9 @@ public class MetaWebService {
     /**
      * Sets metadata to a given locale resource
      *
-     * @param uuid
-     *            , a unique identifier (must not contain url specific
-     *            characters like /,# etc.)
-     * @param mimetype
-     *            content-type of the body (metadata) follows the pattern .+/.+
+     * @param uuid     , a unique identifier (must not contain url specific
+     *                 characters like /,# etc.)
+     * @param mimetype content-type of the body (metadata) follows the pattern .+/.+
      * @return HTTP response (success or error)
      * @HTTP 200 put was successful
      * @HTTP 400 bad request (e.g. body is empty)
@@ -163,11 +148,11 @@ public class MetaWebService {
      * @HTTP 415 Content-Type is not supported
      * @HTTP 500 Internal Error
      * @ResponseHeader Content-Type (for HTTP 415) a list of available types for
-     *                 metadata
+     * metadata
      */
     @PUT
     @Path(ResourceWebService.MIME_PATTERN + ResourceWebService.UUID_PATTERN)
-    public Response putMetaLocal(@PathParam("uuid") String uuid, @PathParam("mimetype") String mimetype, @Context HttpServletRequest request) {
+    public Response putMetaLocal(@PathParam("uuid") String uuid, @PathParam("mimetype") String mimetype, @Context HttpServletRequest request) throws HttpErrorException {
         String uri = configurationService.getBaseUri() + "resource/" + uuid;
         return putMeta(uri, mimetype, request);
     }
@@ -175,11 +160,9 @@ public class MetaWebService {
     /**
      * Sets metadata to a given locale resource
      *
-     * @param uri
-     *            , the fully-qualified URI of the resource to create in the
-     *            triple store
-     * @param mimetype
-     *            content-type of the body (metadata) follows the pattern .+/.+
+     * @param uri      , the fully-qualified URI of the resource to create in the
+     *                 triple store
+     * @param mimetype content-type of the body (metadata) follows the pattern .+/.+
      * @return HTTP response (success or error)
      * @HTTP 200 put was successful
      * @HTTP 400 bad request (e.g. uri is null)
@@ -187,20 +170,19 @@ public class MetaWebService {
      * @HTTP 415 Content-Type is not supported
      * @HTTP 500 Internal Error
      * @ResponseHeader Content-Type (for HTTP 415) a list of available types for
-     *                 metadata
+     * metadata
      */
     @PUT
     @Path(ResourceWebService.MIME_PATTERN)
     public Response putMetaRemote(@QueryParam("uri") @NotNull String uri, @PathParam("mimetype") String mimetype, @Context HttpServletRequest request)
-            throws UnsupportedEncodingException {
+            throws UnsupportedEncodingException, HttpErrorException {
         return putMeta(URLDecoder.decode(uri, "utf-8"), mimetype, request);
     }
 
     /**
      * Delete metadata of remote resource with given uri
      *
-     * @param uri
-     *            , the fully-qualified URI of the resource to create in the
+     * @param uri , the fully-qualified URI of the resource to create in the
      *            triple store
      * @return HTTP response (success or error)
      * @HTTP 200 resource content deleted
@@ -208,7 +190,7 @@ public class MetaWebService {
      * @HTTP 404 resource or resource metadata not found
      */
     @DELETE
-    public Response deleteMetaRemote(@QueryParam("uri") @NotNull String uri) throws UnsupportedEncodingException {
+    public Response deleteMetaRemote(@QueryParam("uri") @NotNull String uri) throws UnsupportedEncodingException, HttpErrorException {
         try {
             InterceptingRepositoryConnection connection = new InterceptingRepositoryConnectionWrapper(sesameService.getRepository(), sesameService.getConnection());
             connection.begin();
@@ -218,7 +200,7 @@ public class MetaWebService {
                 connection.addRepositoryConnectionInterceptor(new ResourceSubjectMetadata(subject));
 
                 // delete all triples for given subject
-                connection.remove(subject,null,null);
+                connection.remove(subject, null, null);
 
                 return Response.ok().build();
             } finally {
@@ -227,7 +209,7 @@ public class MetaWebService {
             }
 
         } catch (RepositoryException e) {
-            return ResourceWebServiceHelper.buildErrorPage(uri, configurationService.getBaseUri(), Status.INTERNAL_SERVER_ERROR, e.getMessage(), configurationService, templatingService);
+            throw new HttpErrorException(Status.INTERNAL_SERVER_ERROR, uri, e.getMessage());
         }
     }
 
@@ -242,35 +224,34 @@ public class MetaWebService {
      */
     @DELETE
     @Path(ResourceWebService.UUID_PATTERN)
-    public Response deleteMetaLocal(@PathParam("uuid") String uuid) throws UnsupportedEncodingException {
+    public Response deleteMetaLocal(@PathParam("uuid") String uuid) throws UnsupportedEncodingException, HttpErrorException {
         String uri = configurationService.getBaseUri() + "resource/" + uuid;
         return deleteMetaRemote(uri);
     }
 
-    private Response getMeta(String resource, String mimetype) throws UnsupportedEncodingException {
+    private Response getMeta(String resource, String mimetype) throws UnsupportedEncodingException, HttpErrorException {
         try {
             RepositoryConnection conn = sesameService.getConnection();
 
             try {
                 conn.begin();
-                
+
                 Resource r = null;
-            	if (UriUtil.validate(resource)) {
+                if (UriUtil.validate(resource)) {
                     r = ResourceUtils.getUriResource(conn, resource);
-            	} else {
-            		r = ResourceUtils.getAnonResource(conn, resource);
-            	}
-            	
+                } else {
+                    r = ResourceUtils.getAnonResource(conn, resource);
+                }
+
                 if (r == null || !ResourceUtils.isUsed(conn, r)) {
-                	return ResourceWebServiceHelper.buildErrorPage(resource, configurationService.getBaseUri(), Response.Status.NOT_FOUND, "the requested resource could not be found in Marmotta right now, but may be available again in the future", configurationService, templatingService);
+                    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");
                 }
-            	
+
                 // create parser
                 final RDFFormat serializer = kiWiIOService.getSerializer(mimetype);
                 if (serializer == null) {
-                    Response response = Response.status(406).entity("mimetype can not be processed").build();
-                    ResourceWebServiceHelper.addHeader(response, "Content-Type", ResourceWebServiceHelper.appendMetaTypes(kiWiIOService.getProducedTypes()));
-                    return response;
+                    ImmutableMap<String, String> headers = ImmutableMap.of("Content-Type", ResourceWebServiceHelper.appendMetaTypes(kiWiIOService.getProducedTypes()));
+                    throw new HttpErrorException(Status.NOT_ACCEPTABLE, resource, "mimetype can not be processed", headers);
                 }
 
                 final Resource subject = r;
@@ -279,12 +260,12 @@ public class MetaWebService {
                     @Override
                     public void write(OutputStream output) throws IOException, WebApplicationException {
                         // FIXME: This method is executed AFTER the @Transactional!
-                        RDFWriter writer = Rio.createWriter(serializer,output);
+                        RDFWriter writer = Rio.createWriter(serializer, output);
                         try {
                             RepositoryConnection connection = sesameService.getConnection();
                             try {
                                 connection.begin();
-                                connection.exportStatements(subject,null,null,true,writer);
+                                connection.exportStatements(subject, null, null, true, writer);
                             } finally {
                                 connection.commit();
                                 connection.close();
@@ -301,16 +282,16 @@ public class MetaWebService {
                 // build response
                 Response response = Response.ok(entity).lastModified(ResourceUtils.getLastModified(conn, r)).build();
                 response.getMetadata().add("ETag", "W/\"" + ETagGenerator.getWeakETag(conn, r) + "\"");
-                
+
                 if (!mimetype.contains("html")) { // then create a proper filename
                     String[] components;
                     if (resource.contains("#")) {
-                    	components = resource.split("#");	                    	
+                        components = resource.split("#");
                     } else {
-                    	components = resource.split("/");
+                        components = resource.split("/");
                     }
-                    final String fileName = components[components.length-1] + "." + serializer.getDefaultFileExtension();   
-                    response.getMetadata().add("Content-Disposition", "attachment; filename=\""+fileName+"\"");
+                    final String fileName = components[components.length - 1] + "." + serializer.getDefaultFileExtension();
+                    response.getMetadata().add("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
                 }
 
                 // create the Content-Type header for the response
@@ -325,7 +306,7 @@ public class MetaWebService {
 
                 // build the link to the human readable content of this resource (if it exists)
                 String contentLink = ResourceWebServiceHelper.buildContentLink(r, contentService.getContentType(r), configurationService);
-                if(!"".equals(contentLink)) {
+                if (!"".equals(contentLink)) {
                     links.add(contentLink);
                 }
 
@@ -333,18 +314,18 @@ public class MetaWebService {
                     response.getMetadata().add("Link", CollectionUtils.fold(links, ", "));
                 }
                 return response;
-        } finally {
+            } finally {
                 if (conn.isOpen()) {
                     conn.commit();
                     conn.close();
                 }
             }
         } catch (RepositoryException e) {
-            return ResourceWebServiceHelper.buildErrorPage(resource, configurationService.getBaseUri(), Status.INTERNAL_SERVER_ERROR, e.getMessage(), configurationService, templatingService);
+            throw new HttpErrorException(Status.INTERNAL_SERVER_ERROR, resource, e.getMessage());
         }
     }
 
-    public Response putMeta(String uri, String mimetype, HttpServletRequest request) {
+    public Response putMeta(String uri, String mimetype, HttpServletRequest request) throws HttpErrorException {
         try {
             // create parser
             RDFFormat parser = kiWiIOService.getParser(mimetype);
@@ -353,8 +334,9 @@ public class MetaWebService {
                 ResourceWebServiceHelper.addHeader(response, "Content-Type", ResourceWebServiceHelper.appendMetaTypes(kiWiIOService.getProducedTypes()));
                 return response;
             }
-            if (request.getContentLength() == 0)
-                return ResourceWebServiceHelper.buildErrorPage(uri, configurationService.getBaseUri(), Status.BAD_REQUEST, "content may not be empty in resource update", configurationService, templatingService);
+            if (request.getContentLength() == 0) {
+                throw new HttpErrorException(Status.BAD_REQUEST, uri, "content may not be empty in resource update");
+            }
 
             // a intercepting connection that filters out all triples that have
             // the wrong subject
@@ -367,23 +349,21 @@ public class MetaWebService {
                 connection.addRepositoryConnectionInterceptor(new ResourceSubjectMetadata(subject));
 
                 // delete all triples for given subject
-                connection.remove(subject, null, null, (Resource)null);
+                connection.remove(subject, null, null, (Resource) null);
 
                 // add RDF data from input to the suject
                 connection.add(request.getReader(), configurationService.getBaseUri(), parser, contextService.getDefaultContext());
-			} finally {
+            } finally {
                 connection.commit();
                 connection.close();
             }
             return Response.ok().build();
         } catch (URISyntaxException e) {
-        	return ResourceWebServiceHelper.buildErrorPage(uri, configurationService.getBaseUri(), Status.INTERNAL_SERVER_ERROR, "invalid target context", configurationService, templatingService);
+            throw new HttpErrorException(Status.INTERNAL_SERVER_ERROR, uri, "invalid target context");
+        } catch (IOException | RDFParseException e) {
+            throw new HttpErrorException(Status.NOT_ACCEPTABLE, uri, "could not parse request body");
         } catch (RepositoryException e) {
-            return ResourceWebServiceHelper.buildErrorPage(uri, configurationService.getBaseUri(), Status.INTERNAL_SERVER_ERROR, e.getMessage(), configurationService, templatingService);
-        } catch (IOException e) {
-            return ResourceWebServiceHelper.buildErrorPage(uri, configurationService.getBaseUri(), Status.INTERNAL_SERVER_ERROR, "could not read request body", configurationService, templatingService);
-        } catch (RDFParseException e) {
-            return ResourceWebServiceHelper.buildErrorPage(uri, configurationService.getBaseUri(), Status.UNSUPPORTED_MEDIA_TYPE, "could not parse request body", configurationService, templatingService);
+            throw new HttpErrorException(Status.INTERNAL_SERVER_ERROR, uri, e.getMessage());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/marmotta/blob/d297c0a2/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 2373140..77456a1 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
@@ -17,32 +17,6 @@
  */
 package org.apache.marmotta.platform.core.webservices.resource;
 
-import static javax.ws.rs.core.Response.status;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URISyntaxException;
-import java.net.URLDecoder;
-import java.util.Collections;
-import java.util.List;
-import java.util.UUID;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.OPTIONS;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.ResponseBuilder;
-import javax.ws.rs.core.Response.Status;
-
 import org.apache.commons.lang3.StringUtils;
 import org.apache.marmotta.commons.http.ContentType;
 import org.apache.marmotta.commons.http.ETagGenerator;
@@ -54,12 +28,30 @@ import org.apache.marmotta.platform.core.api.content.ContentService;
 import org.apache.marmotta.platform.core.api.io.MarmottaIOService;
 import org.apache.marmotta.platform.core.api.templating.TemplatingService;
 import org.apache.marmotta.platform.core.api.triplestore.SesameService;
+import org.apache.marmotta.platform.core.exception.HttpErrorException;
 import org.openrdf.model.Resource;
 import org.openrdf.model.URI;
 import org.openrdf.repository.RepositoryConnection;
 import org.openrdf.repository.RepositoryException;
 import org.slf4j.Logger;
 
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+import javax.ws.rs.core.Response.Status;
+import java.io.UnsupportedEncodingException;
+import java.net.URISyntaxException;
+import java.net.URLDecoder;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+
+import static javax.ws.rs.core.Response.status;
+
 /**
  * Resource Web Services
  *
@@ -81,7 +73,7 @@ public class ResourceWebService {
 
     @Inject
     private ConfigurationService configurationService;
-    
+
     @Inject
     private TemplatingService templatingService;
 
@@ -103,8 +95,7 @@ public class ResourceWebService {
     /**
      * Return the options that are available for a resource with the given URI.
      *
-     * @param uri
-     *            , the fully-qualified URI of the resource to create in the
+     * @param uri , the fully-qualified URI of the resource to create in the
      *            triple store
      * @return HTTP response (empty body)
      * @ResponseHeader Access-Control-Allow-Methods the HTTP methods that are allowable for the given resource
@@ -112,16 +103,16 @@ public class ResourceWebService {
      */
     @OPTIONS
     public Response optionsResourceRemote(@QueryParam("uri") String uri, @HeaderParam("Access-Control-Request-Headers") String reqHeaders) {
-        if(reqHeaders == null) {
+        if (reqHeaders == null) {
             reqHeaders = "Accept, Content-Type";
         }
 
-        if(uri == null)
+        if (uri == null)
             return Response.ok()
                     .header("Allow", "POST")
-                    .header("Access-Control-Allow-Methods","POST")
+                    .header("Access-Control-Allow-Methods", "POST")
                     .header("Access-Control-Allow-Headers", reqHeaders)
-                    .header("Access-Control-Allow-Origin", configurationService.getStringConfiguration("kiwi.allow_origin","*"))
+                    .header("Access-Control-Allow-Origin", configurationService.getStringConfiguration("kiwi.allow_origin", "*"))
                     .build();
         else {
             try {
@@ -130,27 +121,27 @@ public class ResourceWebService {
                 RepositoryConnection conn = sesameService.getConnection();
                 try {
                     conn.begin();
-                    URI resource = ResourceUtils.getUriResource(conn,uri);
+                    URI resource = ResourceUtils.getUriResource(conn, uri);
                     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","*"))
+                    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", "*"))
                             .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("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();
                 }
 
-            } catch(UnsupportedEncodingException ex) {
+            } catch (UnsupportedEncodingException ex) {
                 return Response.serverError().entity(ex.getMessage()).build();
             } catch (RepositoryException ex) {
                 return Response.serverError().entity(ex.getMessage()).build();
@@ -162,9 +153,8 @@ public class ResourceWebService {
     /**
      * Return the options that are available for a resource with the given URI.
      *
-     * @param uuid
-     *            , a unique identifier (must not contain url specific
-     *            characters like /,# etc.)
+     * @param uuid , a unique identifier (must not contain url specific
+     *             characters like /,# etc.)
      * @return HTTP response (empty body)
      * @ResponseHeader Access-Control-Allow-Methods the HTTP methods that are allowable for the given resource
      * @ResponseHeader Access-Control-Allow-Origin the origins that are allowable for cross-site scripting on this resource
@@ -174,11 +164,11 @@ public class ResourceWebService {
     public Response optionsResourceLocal(@PathParam("uuid") String uuid, @HeaderParam("Access-Control-Request-Headers") String reqHeaders) {
         String uri = configurationService.getBaseUri() + "resource/" + uuid;
 
-        if(reqHeaders == null) {
+        if (reqHeaders == null) {
             reqHeaders = "Accept, Content-Type";
         }
 
-        if(uuid == null)
+        if (uuid == null)
             return Response.status(Status.NOT_FOUND).build();
         else {
             try {
@@ -186,28 +176,28 @@ public class ResourceWebService {
                 RepositoryConnection conn = sesameService.getConnection();
                 try {
                     conn.begin();
-                    URI resource = ResourceUtils.getUriResource(conn,uri);
+                    URI resource = ResourceUtils.getUriResource(conn, uri);
                     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","*"))
+                    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", "*"))
                             .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();
                 }
-            } catch(UnsupportedEncodingException ex) {
+            } catch (UnsupportedEncodingException ex) {
                 return Response.serverError().entity(ex.getMessage()).build();
             } catch (RepositoryException ex) {
                 return Response.serverError().entity(ex.getMessage()).build();
@@ -224,8 +214,7 @@ public class ResourceWebService {
      * Creates new resource with given uri. If no uri is defined it creates a
      * local uri with random uuid
      *
-     * @param uri
-     *            , the fully-qualified URI of the resource to create in the
+     * @param uri , the fully-qualified URI of the resource to create in the
      *            triple store
      * @return HTTP response (body is a String message)
      * @HTTP 201 new resource created
@@ -267,7 +256,7 @@ public class ResourceWebService {
                 conn.begin();
                 String location = remote ? configurationService.getServerUri() + ConfigurationService.RESOURCE_PATH + "?uri=" + uri : uri;
                 Response.Status status;
-                if (ResourceUtils.getUriResource(conn,uri) != null) {
+                if (ResourceUtils.getUriResource(conn, uri) != null) {
                     status = Status.OK;
                 } else {
                     conn.getValueFactory().createURI(uri);
@@ -290,24 +279,23 @@ public class ResourceWebService {
      * Returns a link to a local resource (data or content) with the given uuid
      * and an accepted return type
      *
-     * @param uuid
-     *            , a unique identifier (must not contain url specific
-     *            characters like /,# etc.)
+     * @param uuid , a unique identifier (must not contain url specific
+     *             characters like /,# etc.)
      * @return a link to a local resource's data or content
      * @HTTP 303 resource can be found in the requested format under Location
      * @HTTP 404 resource cannot be found
      * @HTTP 406 resource cannot be found in the given format
      * @HTTP 500 Internal Error
      * @RequestHeader Accept accepted mimetypes; value must follow the pattern
-     *                (.+/.+(;rel=(content|meta))?,)+
+     * (.+/.+(;rel=(content|meta))?,)+
      * @ResponseHeader Location (for HTTP 303) the url of the resource in the
-     *                 requested format
+     * requested format
      * @ResponseHeader Content-Type (for HTTP 406) a list of available types
-     *                 (content and meta)
+     * (content and meta)
      */
     @GET
     @Path(UUID_PATTERN)
-    public Response getLocal(@PathParam("uuid") String uuid, @HeaderParam("Accept") String types) throws UnsupportedEncodingException {
+    public Response getLocal(@PathParam("uuid") String uuid, @HeaderParam("Accept") String types) throws UnsupportedEncodingException, HttpErrorException {
         String uri = configurationService.getBaseUri() + "resource/" + uuid;
         try {
             return get(uri, types);
@@ -322,7 +310,7 @@ public class ResourceWebService {
      * Returns a link to a remote resource (data or content) with the given uri
      * and an accepted return type
      *
-     * @param uri the fully-qualified URI of the resource to create in the triple store
+     * @param uri    the fully-qualified URI of the resource to create in the triple store
      * @param format forces representation format (optional, normal content negotiation performed if empty)
      * @HTTP 303 resource can be found in the requested format under Location
      * @HTTP 400 bad request (maybe uri is not defined)
@@ -330,14 +318,14 @@ public class ResourceWebService {
      * @HTTP 406 resource cannot be found in the given format
      * @HTTP 500 Internal Error
      * @RequestHeader Accept accepted mimetypes; value must follow the pattern
-     *                (.+/.+(;rel=(content|meta))?,)+
+     * (.+/.+(;rel=(content|meta))?,)+
      * @ResponseHeader Location the url of the resource in the requested format
      * @ResponseHeader Content-Type (for HTTP 406) a list of available types
-     *                 (content and meta)
+     * (content and meta)
      */
     @GET
     public Response getRemote(@QueryParam("uri") String uri, @QueryParam("genid") String genid, @QueryParam("format") String format, @HeaderParam("Accept") String types)
-            throws UnsupportedEncodingException {
+            throws UnsupportedEncodingException, HttpErrorException {
         try {
             if (StringUtils.isNotBlank(uri)) {
                 if (format != null && StringUtils.isNotBlank(format)) {
@@ -359,56 +347,58 @@ public class ResourceWebService {
         }
     }
 
-    private Response get(String resource, String types) throws URISyntaxException, UnsupportedEncodingException {
+    private Response get(String resource, String types) throws URISyntaxException, UnsupportedEncodingException, HttpErrorException {
         try {
 
             RepositoryConnection conn = sesameService.getConnection();
             try {
                 conn.begin();
                 Resource r = null;
-            	if (UriUtil.validate(resource)) {
+                if (UriUtil.validate(resource)) {
                     try {
-                    	if(ResourceUtils.isSubject(conn, resource)) {  //tests if a resource is used as subject
+                        if (ResourceUtils.isSubject(conn, resource)) {  //tests if a resource is used as subject
                             r = ResourceUtils.getUriResource(conn, resource);
                         }
                     } catch (Exception e) {
-                    	log.error("Error retrieving the resource <{}>: {}", resource, e.getMessage());
-                    	log.debug("So redirecting directly to it...");
-                    	return Response.seeOther(new java.net.URI(resource)).build();
+                        log.error("Error retrieving the resource <{}>: {}", resource, e.getMessage());
+                        log.debug("So redirecting directly to it...");
+                        return Response.seeOther(new java.net.URI(resource)).build();
                     }
-            	} else {
-            		try {
-            			r = ResourceUtils.getAnonResource(conn, resource);
-	                } catch (Exception e) {
-	                	log.error("Error retrieving the blank node <{}>: {}", resource, e.getMessage());
-	                	return Response.status(Status.NOT_FOUND).entity("blank node id "  + resource + " not found").build();
-	                }
-            	}
-                if (r == null) return ResourceWebServiceHelper.buildErrorPage(resource, configurationService.getBaseUri(), Response.Status.NOT_FOUND, "the requested resource could not be found in Marmotta right now, but may be available again in the future", configurationService, templatingService);
+                } else {
+                    try {
+                        r = ResourceUtils.getAnonResource(conn, resource);
+                    } catch (Exception e) {
+                        log.error("Error retrieving the blank node <{}>: {}", resource, e.getMessage());
+                        return Response.status(Status.NOT_FOUND).entity("blank node id " + resource + " not found").build();
+                    }
+                }
+                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");
+                }
                 // FIXME String appendix = uuid == null ? "?uri=" + URLEncoder.encode(uri, "utf-8") :
                 // "/" + uuid;
 
-                List<ContentType> offeredTypes  = MarmottaHttpUtils.parseStringList(kiWiIOService.getProducedTypes());
-                for(ContentType t : offeredTypes) {
-                	t.setParameter("rel", "meta");
+                List<ContentType> offeredTypes = MarmottaHttpUtils.parseStringList(kiWiIOService.getProducedTypes());
+                for (ContentType t : offeredTypes) {
+                    t.setParameter("rel", "meta");
                 }
                 String contentmime = contentService.getContentType(r);
-                if(contentmime != null) {
-                	ContentType tContent = MarmottaHttpUtils.parseContentType(contentmime);
-                	tContent.setParameter("rel", "content");
-                	offeredTypes.add(0,tContent);
+                if (contentmime != null) {
+                    ContentType tContent = MarmottaHttpUtils.parseContentType(contentmime);
+                    tContent.setParameter("rel", "content");
+                    offeredTypes.add(0, tContent);
                 }
-                
+
                 if (types == null || types.equals("")) {
-                	return build406(Collections.<ContentType>emptyList(), offeredTypes);
+                    return build406(Collections.<ContentType>emptyList(), offeredTypes);
                 }
 
                 List<ContentType> acceptedTypes = MarmottaHttpUtils.parseAcceptHeader(types);
-                ContentType bestType = MarmottaHttpUtils.bestContentType(offeredTypes,acceptedTypes);
+                ContentType bestType = MarmottaHttpUtils.bestContentType(offeredTypes, acceptedTypes);
 
-                log.debug("identified best type: {}",bestType);
+                log.debug("identified best type: {}", bestType);
 
-                if(bestType != null) {
+                if (bestType != null) {
                     Response response = buildGetResponse(r, bestType);
                     response.getMetadata().add("Last-Modified", ResourceUtils.getLastModified(conn, r));
                     response.getMetadata().add("ETag", "W/\"" + ETagGenerator.getWeakETag(conn, r) + "\"");
@@ -427,22 +417,20 @@ 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");
-
-		StringBuilder entity = new StringBuilder();
-		entity.append("Could not find matching type for "+acceptedTypes+"\n");
-		entity.append("choose one of the following:");
-		for (ContentType contentType : offeredTypes) {
-			entity.append("  ").append(contentType).append("\n");
-		}
-		entity.append("\n");
-		response.entity(entity.toString());
-		return response.build();
-	}
-
+    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");
 
+        StringBuilder entity = new StringBuilder();
+        entity.append("Could not find matching type for " + acceptedTypes + "\n");
+        entity.append("choose one of the following:");
+        for (ContentType contentType : offeredTypes) {
+            entity.append("  ").append(contentType).append("\n");
+        }
+        entity.append("\n");
+        response.entity(entity.toString());
+        return response.build();
+    }
 
 
     // ******************************************* P U T
@@ -453,24 +441,23 @@ public class ResourceWebService {
      * Returns a Link where the given data (metadata or content) can be put to
      * the local resource
      *
-     * @param uuid
-     *            , a unique identifier (must not contain url specific
-     *            characters like /,# etc.)
+     * @param uuid , a unique identifier (must not contain url specific
+     *             characters like /,# etc.)
      * @return a link where the data can be put (depends on Content-Type)
      * @HTTP 303 resource in given format can be put under Location
      * @HTTP 404 resource cannot be found
      * @HTTP 415 Content-Type is not supported
      * @HTTP 500 Internal Error
      * @RequestHeader Content-Type type of the body; value must follow the
-     *                pattern .+/.+(;rel=(content|meta))?
+     * pattern .+/.+(;rel=(content|meta))?
      * @ResponseHeader Location (for HTTP 303) the url where data can be put
      */
     @PUT
     @Path(UUID_PATTERN)
-    public Response putLocal(@PathParam("uuid") String uuid, @HeaderParam("Content-Type") String type, @Context HttpServletRequest request) throws UnsupportedEncodingException {
+    public Response putLocal(@PathParam("uuid") String uuid, @HeaderParam("Content-Type") String type, @Context HttpServletRequest request) throws UnsupportedEncodingException, HttpErrorException {
         String uri = configurationService.getBaseUri() + "resource/" + uuid;
         try {
-            return put(uri, type, uuid,request);
+            return put(uri, type, uuid, request);
         } catch (URISyntaxException e) {
             return Response.serverError().entity(e.getMessage()).build();
         }
@@ -482,8 +469,7 @@ public class ResourceWebService {
      * Returns a Link where the given data (metadata or content) can be put to
      * the remote resource
      *
-     * @param uri
-     *            , the fully-qualified URI of the resource to create in the
+     * @param uri , the fully-qualified URI of the resource to create in the
      *            triple store
      * @return a link where the data can be put (depends on Content-Type)
      * @HTTP 303 resource in given format can be put under Location
@@ -492,11 +478,11 @@ public class ResourceWebService {
      * @HTTP 415 Content-Type is not supported
      * @HTTP 500 Internal Error
      * @RequestHeader Content-Type type of the body; value must follow the
-     *                pattern .+/.+(;rel=(content|meta))?
+     * pattern .+/.+(;rel=(content|meta))?
      * @ResponseHeader Location (for HTTP 303) the url where data can be put
      */
     @PUT
-    public Response putRemote(@QueryParam("uri") String uri, @HeaderParam("Content-Type") String type, @Context HttpServletRequest request) throws UnsupportedEncodingException {
+    public Response putRemote(@QueryParam("uri") String uri, @HeaderParam("Content-Type") String type, @Context HttpServletRequest request) throws UnsupportedEncodingException, HttpErrorException {
         try {
             if (uri != null) return put(URLDecoder.decode(uri, "utf-8"), type, null, request);
             else
@@ -506,7 +492,7 @@ public class ResourceWebService {
         }
     }
 
-    private Response put(String uri, String mimetype, String uuid, HttpServletRequest request) throws URISyntaxException, UnsupportedEncodingException {
+    private Response put(String uri, String mimetype, String uuid, HttpServletRequest request) throws URISyntaxException, UnsupportedEncodingException, HttpErrorException {
         try {
             // FIXME String appendix = uuid == null ? "?uri=" + URLEncoder.encode(uri, "utf-8") :
             // "/" + uuid;
@@ -516,24 +502,24 @@ public class ResourceWebService {
             // the offered types are those sent by the client in the Content-Type header; if the rel attribute is not
             // given, we add the default rel value
             List<ContentType> types = MarmottaHttpUtils.parseAcceptHeader(mimetype);
-            for(ContentType type : types) {
-                if(type.getParameter("rel") == null) {
-                    type.setParameter("rel",configurationService.getStringConfiguration("linkeddata.mime.rel.default", "meta"));
+            for (ContentType type : types) {
+                if (type.getParameter("rel") == null) {
+                    type.setParameter("rel", configurationService.getStringConfiguration("linkeddata.mime.rel.default", "meta"));
                 }
             }
 
             // the acceptable types are all types for content and the meta types we have parsers for; we do not care so
             // much about the order ...
             List<ContentType> acceptable = MarmottaHttpUtils.parseStringList(kiWiIOService.getProducedTypes());
-            for(ContentType a : acceptable) {
+            for (ContentType a : acceptable) {
                 a.setParameter("rel", "meta");
             }
-            ContentType allContent = new ContentType("*","*");
+            ContentType allContent = new ContentType("*", "*");
             allContent.setParameter("rel", "content");
-            acceptable.add(0,allContent);
+            acceptable.add(0, allContent);
 
             // determine the best match between the offered types and the acceptable types
-            ContentType bestType = MarmottaHttpUtils.bestContentType(types,acceptable);
+            ContentType bestType = MarmottaHttpUtils.bestContentType(types, acceptable);
 
             if (bestType != null) {
                 if (configurationService.getBooleanConfiguration("linkeddata.redirect.put", true)) {
@@ -544,15 +530,15 @@ public class ResourceWebService {
                         con.commit();
                         return Response
                                 .status(configurationService.getIntConfiguration("linkeddata.redirect.status", 303))
-                                // .location(new URI(configurationService.getBaseUri() +
-                                // bestType.getParameter("rel") + "/" + bestType.getMime() + appendix))
+                                        // .location(new URI(configurationService.getBaseUri() +
+                                        // bestType.getParameter("rel") + "/" + bestType.getMime() + appendix))
                                 .location(new java.net.URI(ResourceWebServiceHelper.buildResourceLink(resource, bestType, configurationService)))
                                 .build();
                     } finally {
                         con.close();
                     }
                 } else {
-                    if("content".equalsIgnoreCase(bestType.getParameter("rel")))
+                    if ("content".equalsIgnoreCase(bestType.getParameter("rel")))
                         return contentWebService.putContent(uri, bestType.getMime(), request);
                     else if ("meta".equalsIgnoreCase(bestType.getParameter("rel")))
                         return metaWebService.putMeta(uri, bestType.getMime(), request);
@@ -576,8 +562,7 @@ public class ResourceWebService {
     /**
      * Delete remote resource with given uri
      *
-     * @param uri
-     *            , the fully-qualified URI of the resource to create in the
+     * @param uri , the fully-qualified URI of the resource to create in the
      *            triple store
      * @return HTTP response (success or error)
      * @HTTP 200 resource deleted
@@ -592,9 +577,9 @@ public class ResourceWebService {
                 RepositoryConnection conn = sesameService.getConnection();
                 try {
                     conn.begin();
-                    Resource resource = ResourceUtils.getUriResource(conn,URLDecoder.decode(uri, "utf-8"));
+                    Resource resource = ResourceUtils.getUriResource(conn, URLDecoder.decode(uri, "utf-8"));
                     if (resource != null) {
-                        ResourceUtils.removeResource(conn,resource);
+                        ResourceUtils.removeResource(conn, resource);
                         return Response.ok().build();
                     } else
                         return Response.status(Response.Status.NOT_FOUND).build();
@@ -612,9 +597,8 @@ public class ResourceWebService {
     /**
      * Delete local resource with given uuid
      *
-     * @param uuid
-     *            , a unique identifier (must not contain url specific
-     *            characters like /,# etc.)
+     * @param uuid , a unique identifier (must not contain url specific
+     *             characters like /,# etc.)
      * @return HTTP response (success or error)
      * @HTTP 200 resource deleted
      * @HTTP 404 resource not found
@@ -632,16 +616,16 @@ 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() +
                             // appendix))
-                            .location(
-                                    new java.net.URI(ResourceWebServiceHelper.buildResourceLink(resource,
-                                            type.getParameter("rel"), type.getMime(), configurationService)))
-                                            .build();
+                    .location(
+                            new java.net.URI(ResourceWebServiceHelper.buildResourceLink(resource,
+                                    type.getParameter("rel"), type.getMime(), configurationService)))
+                    .build();
 
         } catch (Exception e) {
             return Response.serverError().build();

http://git-wip-us.apache.org/repos/asf/marmotta/blob/d297c0a2/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/ResourceWebServiceHelper.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/ResourceWebServiceHelper.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/ResourceWebServiceHelper.java
index 15abd70..55f54d8 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/ResourceWebServiceHelper.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/resource/ResourceWebServiceHelper.java
@@ -34,25 +34,24 @@ import java.util.Map;
 
 /**
  * Helper methods shared accross the difference resource web services
- * 
- * @author Sergio Fernández
  *
+ * @author Sergio Fernández
  */
 public class ResourceWebServiceHelper {
-    
+
     private static final String TEMPLATE_404 = "404.ftl";
 
-	public static void addHeader(Response response, String name, String value) {
+    public static void addHeader(Response response, String name, String value) {
         response.getMetadata().add(name, value);
     }
-    
+
     public static String appendTypes(List<String> datamimes, String mime) {
         StringBuilder sb = new StringBuilder();
         sb.append(appendContentTypes(mime));
         sb.append(appendMetaTypes(datamimes));
         return sb.toString();
-    }   
-    
+    }
+
     public static String appendMetaTypes(List<String> datamimes) {
         StringBuilder sb = new StringBuilder();
         for (int i = 0; i < datamimes.size(); i++) {
@@ -64,7 +63,7 @@ public class ResourceWebServiceHelper {
         }
         return sb.toString();
     }
-    
+
     public static String appendContentTypes(String mime) {
         if (mime != null) {
             return mime + ";rel=content";
@@ -72,9 +71,9 @@ public class ResourceWebServiceHelper {
             return "";
         }
     }
-    
+
     /**
-     * @deprecated Use {@link #buildContentLink(URI,String,ConfigurationService)} instead
+     * @deprecated Use {@link #buildContentLink(URI, String, ConfigurationService)} instead
      */
     public static String buildContentLink(URI resource, String uuid, String mime, ConfigurationService configurationService) {
         return buildContentLink(resource, mime, configurationService);
@@ -94,10 +93,10 @@ public class ResourceWebServiceHelper {
             b.append(";rel=content");
         }
         return b.toString();
-    }     
-    
+    }
+
     /**
-     * @deprecated Use {@link #buildMetaLinks(URI,List<String>,ConfigurationService)} instead
+     * @deprecated Use {@link #buildMetaLinks(URI, List<String>,ConfigurationService)} instead
      */
     public static String buildMetaLinks(URI resource, String uuid, List<String> datamimes, ConfigurationService configurationService) {
         return buildMetaLinks(resource, datamimes, configurationService);
@@ -120,7 +119,7 @@ public class ResourceWebServiceHelper {
         }
         return b.toString();
     }
-    
+
     public static String buildResourceLink(URI resource, ContentType cType, ConfigurationService configurationService) {
         return buildResourceLink(resource, cType.getParameter("rel"),
                 cType.getMime(), configurationService);
@@ -134,36 +133,16 @@ public class ResourceWebServiceHelper {
             uuid = resource.stringValue().substring((base + "resource/").length());
             return String.format("%s%s/%s/%s", base, rel, mime, uuid);
         } else {
-	    	if (resource instanceof URI) {
-	            try {  
-	                return String.format("%s%s/%s?uri=%s", src, rel, mime, URLEncoder.encode(resource.stringValue(), ResourceWebService.CHARSET));
-	            } catch (UnsupportedEncodingException e) {
-	                return String.format("%s%s/%s?uri=%s", src, rel, mime, resource.stringValue());
-	            }                    
-	    	} else {
-	    		return String.format("%s%s/%s?genid=%s", src, rel, mime, resource.stringValue());
-	    	}      
+            if (resource instanceof URI) {
+                try {
+                    return String.format("%s%s/%s?uri=%s", src, rel, mime, URLEncoder.encode(resource.stringValue(), ResourceWebService.CHARSET));
+                } catch (UnsupportedEncodingException e) {
+                    return String.format("%s%s/%s?uri=%s", src, rel, mime, resource.stringValue());
+                }
+            } else {
+                return String.format("%s%s/%s?genid=%s", src, rel, mime, resource.stringValue());
+            }
         }
     }
-    
-    public static Response buildErrorPage(String uri, String base, Status status, String message, ConfigurationService configurationService, TemplatingService templatingService) {
-        Map<String, Object> data = new HashMap<String, Object>();
-        data.put("uri", uri);
-        data.put("message", message);
-        try {
-            data.put("encoded_uri", URLEncoder.encode(uri, "UTF-8"));
-        } catch (UnsupportedEncodingException uee) {
-            data.put("encoded_uri", uri);
-        }
-
-        try {
-            return Response.status(status)
-                    .entity(templatingService.process(TEMPLATE_404, data))
-                    .build();
-        } catch (Exception e) {
-            return Response.status(Response.Status.NOT_FOUND)
-                    .entity("Not Found").build();
-        }
-    } 
 
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/d297c0a2/platform/marmotta-core/src/main/resources/templates/error.ftl
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/templates/error.ftl b/platform/marmotta-core/src/main/resources/templates/error.ftl
new file mode 100644
index 0000000..85f468d
--- /dev/null
+++ b/platform/marmotta-core/src/main/resources/templates/error.ftl
@@ -0,0 +1,83 @@
+<#--
+
+    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.
+
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
+
+  <head>
+    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+    <title>${status} ${phrase} - Marmotta Linked Data Explorer</title>
+    <script src="${SERVER_URL}webjars/jquery/1.8.2/jquery.min.js" type="text/javascript" ></script>
+    <link href="${SERVER_URL}${DEFAULT_STYLE}style.css" rel="stylesheet" type="text/css" />
+    <link href="${SERVER_URL}${DEFAULT_STYLE}rdfhtml.css" rel="stylesheet" type="text/css" />
+    <link href="${SERVER_URL}${DEFAULT_STYLE}error.css" rel="stylesheet" type="text/css" />
+  </head>
+
+  <body>
+
+    <div id="wrapper">
+    <div id="header">
+        <a id="logo" href="${SERVER_URL}" title="${PROJECT}">
+            <img src="${SERVER_URL}${LOGO}" alt="${PROJECT} logo" />
+        </a>
+        <h1>Marmotta Linked Data Explorer</h1>
+        <div class="clean"></div>
+    </div>
+    <div class="clear"></div>
+    <div id="center">
+        <div id="content">
+
+          <h2>Error: ${status} ${phrase}</h2>
+        
+          <p>
+            <strong><a href="${SERVER_URL}resource?uri=${encoded_uri}">${uri}</a></strong><a href="${uri}"><img src="${SERVER_URL}core/public/img/icon/link.png" alt="${uri}" title="go to ${uri} directly" /></a>
+          </p>
+          
+          <p>
+            Sorry, but ${message}. Further details in the logs.
+          </p>  
+        
+        </div>
+        
+    </div>
+
+    <div class="clear"></div>
+    <div id="footer">
+        <div id="footer_line">
+            <span>
+                ${FOOTER}
+            </span>
+        </div>
+    </div> 
+
+    </div>
+
+    <script type="text/javascript"> 
+
+      $(document).ready(function() {
+
+      });
+
+    </script> 
+
+  </body>
+
+</html>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/d297c0a2/platform/marmotta-core/src/main/resources/web/public/style/blue/error.css
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/public/style/blue/error.css b/platform/marmotta-core/src/main/resources/web/public/style/blue/error.css
new file mode 100644
index 0000000..fc35268
--- /dev/null
+++ b/platform/marmotta-core/src/main/resources/web/public/style/blue/error.css
@@ -0,0 +1,43 @@
+/**
+ * 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.
+ */
+
+div#header h1, div#center {
+    width: auto; 
+    min-height: 400px; 
+    margin: 0; 
+}
+
+div#center {
+    padding: 2em 30% 2em 30%;
+}
+
+div#center {
+    float: none; 
+    vertical-align: middle; 
+    padding: 2em 30% 5em 30%;
+}
+
+div#center > * {
+    margin-top: 2em;
+    font-size: 1.6em;
+}
+
+div#center > p > a > img {
+    vertical-align: text-top;
+    margin-left: 0.15em;
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/d297c0a2/platform/marmotta-core/src/main/resources/web/public/style/white/error.css
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/public/style/white/error.css b/platform/marmotta-core/src/main/resources/web/public/style/white/error.css
new file mode 100644
index 0000000..9d3b62a
--- /dev/null
+++ b/platform/marmotta-core/src/main/resources/web/public/style/white/error.css
@@ -0,0 +1,44 @@
+/**
+ * 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.
+ */
+
+div#header h1, div#center {
+    width: auto; 
+    min-height: 400px; 
+    margin: 0; 
+}
+
+div#center {
+    padding: 2em 30% 2em 30%;
+}
+
+div#center {
+    float: none; 
+    vertical-align: middle; 
+    padding: 2em 30% 5em 30%;
+}
+
+div#center > * {
+    margin-top: 2em;
+    font-size: 1.6em;
+}
+
+div#center > p > a > img {
+    vertical-align: text-top;
+    margin-left: 0.15em;
+}
+


[04/11] git commit: Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/marmotta into develop

Posted by ss...@apache.org.
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/marmotta into develop


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

Branch: refs/heads/MARMOTTA-450
Commit: 31d04b5a139891962e9d5eda652315371487c189
Parents: edb5faf dd004d3
Author: Sergio Fernández <wi...@apache.org>
Authored: Mon Mar 10 11:20:50 2014 +0100
Committer: Sergio Fernández <wi...@apache.org>
Committed: Mon Mar 10 11:20:50 2014 +0100

----------------------------------------------------------------------
 platform/backends/marmotta-backend-http/pom.xml           |  2 +-
 .../platform/core/servlet/MarmottaPreStartupListener.java | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[03/11] git commit: LMF is gone...

Posted by ss...@apache.org.
LMF is gone...


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

Branch: refs/heads/MARMOTTA-450
Commit: dd004d325462a61ebd89a36717da37338e1839ce
Parents: e2e23ef
Author: Jakob Frank <ja...@apache.org>
Authored: Mon Mar 3 14:44:48 2014 +0100
Committer: Jakob Frank <ja...@apache.org>
Committed: Mon Mar 3 14:44:48 2014 +0100

----------------------------------------------------------------------
 platform/backends/marmotta-backend-http/pom.xml           |  2 +-
 .../platform/core/servlet/MarmottaPreStartupListener.java | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/dd004d32/platform/backends/marmotta-backend-http/pom.xml
----------------------------------------------------------------------
diff --git a/platform/backends/marmotta-backend-http/pom.xml b/platform/backends/marmotta-backend-http/pom.xml
index 338e126..1087c20 100644
--- a/platform/backends/marmotta-backend-http/pom.xml
+++ b/platform/backends/marmotta-backend-http/pom.xml
@@ -97,7 +97,7 @@
                             <doclet>com.lunatech.doclets.jax.jaxrs.JAXRSDoclet</doclet>
 
                             <name>REST API</name>
-                            <description>REST API for LMF Webservices</description>
+                            <description>REST API for Marmotta Webservices</description>
 
                             <outputDirectory>${project.build.outputDirectory}/doc</outputDirectory>
                             <reportOutputDirectory>${project.build.outputDirectory}/web/doc</reportOutputDirectory>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/dd004d32/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/servlet/MarmottaPreStartupListener.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/servlet/MarmottaPreStartupListener.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/servlet/MarmottaPreStartupListener.java
index 85a8662..ba7bc47 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/servlet/MarmottaPreStartupListener.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/servlet/MarmottaPreStartupListener.java
@@ -37,7 +37,7 @@ public class MarmottaPreStartupListener implements ServletContextListener {
 
     private static Logger log = LoggerFactory.getLogger(MarmottaPreStartupListener.class);
 
-    private MarmottaStartupService lmfStartupService;
+    private MarmottaStartupService startupService;
 
     /**
      * * Notification that the web application initialization
@@ -49,8 +49,8 @@ public class MarmottaPreStartupListener implements ServletContextListener {
     @Override
     public void contextInitialized(ServletContextEvent sce) {
 
-        if(lmfStartupService == null) {
-            lmfStartupService = CDIContext.getInstance(MarmottaStartupService.class);
+        if(startupService == null) {
+            startupService = CDIContext.getInstance(MarmottaStartupService.class);
         }
 
         // we check for the presence of the configuration.override init parameter; if it exists, we load this
@@ -65,7 +65,7 @@ public class MarmottaPreStartupListener implements ServletContextListener {
             }
         }
 
-        lmfStartupService.startupConfiguration(null,override,sce.getServletContext());
+        startupService.startupConfiguration(null, override, sce.getServletContext());
 
     }
 
@@ -77,7 +77,7 @@ public class MarmottaPreStartupListener implements ServletContextListener {
      */
     @Override
     public void contextDestroyed(ServletContextEvent sce) {
-        lmfStartupService.shutdown();
+        startupService.shutdown();
     }
 
 }


[06/11] git commit: added schema.org prefix mapping by default

Posted by ss...@apache.org.
added schema.org prefix mapping by default


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

Branch: refs/heads/MARMOTTA-450
Commit: 0550b39f78e59420a9ba16bcfd8c4232e6f4996f
Parents: f77b249
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Mar 12 16:54:13 2014 +0100
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Mar 12 16:54:13 2014 +0100

----------------------------------------------------------------------
 .../marmotta-core/src/main/resources/config-defaults.properties    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/0550b39f/platform/marmotta-core/src/main/resources/config-defaults.properties
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/config-defaults.properties b/platform/marmotta-core/src/main/resources/config-defaults.properties
index 4ac724d..ba80bbf 100644
--- a/platform/marmotta-core/src/main/resources/config-defaults.properties
+++ b/platform/marmotta-core/src/main/resources/config-defaults.properties
@@ -192,7 +192,7 @@ prefix.rdf = http://www.w3.org/1999/02/22-rdf-syntax-ns#
 prefix.skos = http://www.w3.org/2004/02/skos/core#
 prefix.ldp = http://www.w3.org/ns/ldp#
 prefix.mao = http://www.w3.org/ns/ma-ont#
-
+prefix.schema = http://schema.org/
 
 contexts.default = ${kiwi.context}context/default
 contexts.inferred = ${kiwi.context}context/inferred


[07/11] git commit: more lmf cleanup

Posted by ss...@apache.org.
more lmf cleanup


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

Branch: refs/heads/MARMOTTA-450
Commit: 1ca8577c61d77a0c3cede911f7423a73bf277592
Parents: 0550b39
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Mar 12 16:56:15 2014 +0100
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Mar 12 16:56:15 2014 +0100

----------------------------------------------------------------------
 .../main/resources/config-defaults.properties   | 26 +++++++++-----------
 1 file changed, 11 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/1ca8577c/platform/marmotta-core/src/main/resources/config-defaults.properties
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/config-defaults.properties b/platform/marmotta-core/src/main/resources/config-defaults.properties
index ba80bbf..8d7ae29 100644
--- a/platform/marmotta-core/src/main/resources/config-defaults.properties
+++ b/platform/marmotta-core/src/main/resources/config-defaults.properties
@@ -17,7 +17,7 @@
 #
 
 ###############################################################################
-# LMF core configuration
+# Core configuration
 ###############################################################################
 
 # KiWi home directory (for configuration files etc)
@@ -32,16 +32,16 @@ kiwi.host = http://localhost:8080/
 #the path of the KiWi installation, e.g. /, /marmotta, /LMF or /KiWi
 kiwi.path = /
 
-# true if the LMF system host configuration has been set up, do not change
+# true if the system host configuration has been set up, do not change
 kiwi.setup.host = false
 
-# true if the LMF system database configuration has been set up, do not change
+# true if the system database configuration has been set up, do not change
 kiwi.setup.database = false
 
 # kiwi startup page
 kiwi.pages.startup = core/admin/about.html
 
-# lmf default style
+# default style
 kiwi.pages.project = marmotta
 
 # marmotta logo
@@ -50,10 +50,10 @@ kiwi.pages.project.marmotta.logo = core/public/img/logo/marmotta-logo.png
 # marmotta footer
 kiwi.pages.project.marmotta.footer = Copyright &copy; 2013-2014 The Apache Software Foundation, Licensed under the <a href\="\#">Apache License, Version 2.0.</a><br>Apache, Marmotta, the Apache feather and Marmotta logos are trademarks of The Apache Software Foundation.
 
-# lmf logo
+# custom logo
 kiwi.pages.project.custom.logo = core/public/img/logo/custom-logo.png
 
-# lmf footer
+# custom footer
 kiwi.pages.project.custom.footer = Your Footer powered by <a href="http://marmotta.apache.org/">Apache Marmotta</a>.
 
 # supported styles
@@ -66,17 +66,14 @@ debug.enabled = false
 # according to HTTP
 linkeddata.redirect.status = 303
 
-
 # determines whether to issue a redirect for PUT requests; if set to true, the resource service will return
 # a redirect to the actual content or metadata location for the resource, resulting in a second request to be issued
 # by the browser; if set to false, the resource service directly processes the content/metadata upload
 linkeddata.redirect.put = false
 
-
 # default rel value for resource interaction with HTTP (MUST be 'meta' or 'content')
 linkeddata.mime.rel.default = meta
 
-
 # sort menu entries by weight instead of alphabet
 templating.sort_by_weight = true
 
@@ -122,7 +119,6 @@ logging.file.debug.keep    = 30
 # Content Readers and Writers (in case a resource is requested with ;rel=content
 ###############################################################################
 
-
 # a reader/writer for content stored in the file system; by default, this is applied to all resources that have
 # a file:/ URI. It is disabled by default, because it potentially allows reading/writing all files in the file system
 # to only enable reading but disable writing, remove the content.filesystem.writer property
@@ -131,12 +127,12 @@ content.filesystem.writer=org.apache.marmotta.platform.core.services.content.Fil
 content.filesystem.pattern=(${marmotta.home}/resources|${kiwi.context}resource/|urn:).*
 #content.filesystem.pattern=file:/tmp/.*
 content.filesystem.enabled=true
-# if enabled allow only access to resources stored in the LMF work directory
+# if enabled allow only access to resources stored in the work directory
 content.filesystem.secure=true
 
 
 # a reader for content stored on a remote HTTP server; by default, this is applied to all resources that are not in
-# the context of the LMF web application; enabled by default, because it is a safe operation
+# the context of the web application; enabled by default, because it is a safe operation
 content.http.reader=org.apache.marmotta.platform.core.services.content.HTTPContentReader
 content.http.pattern=(?!${kiwi.context}resource)http://.*
 content.http.enabled=false
@@ -157,7 +153,7 @@ resources.servercache.enabled = false
 
 
 ###############################################################################
-# LMF importer configuration
+# Importer configuration
 ###############################################################################
 
 # generate KiWi title and text content for each imported resource in the RDF importer
@@ -167,14 +163,14 @@ importer.generate_descriptions = false
 importer.batchsize = 50
 
 ###############################################################################
-# LMF Statistics Module
+# Statistics Module
 ###############################################################################
 
 # whether collecting statistics about the execution should be enabled on start or not
 statistics.enabled = true
 
 ###############################################################################
-# LMF Default Prefixes
+# Default Prefixes
 ###############################################################################
 
 # prefixes mappings


[02/11] git commit: Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/marmotta into develop

Posted by ss...@apache.org.
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/marmotta into develop


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

Branch: refs/heads/MARMOTTA-450
Commit: edb5fafc809d3628e408e77bec33188809ccf26f
Parents: d297c0a e2e23ef
Author: Sergio Fernández <wi...@apache.org>
Authored: Mon Mar 3 09:33:46 2014 +0100
Committer: Sergio Fernández <wi...@apache.org>
Committed: Mon Mar 3 09:33:46 2014 +0100

----------------------------------------------------------------------
 .../marmotta/platform/core/startup/MarmottaStartupService.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[05/11] git commit: MARMOTTA-431: updated to jdeb 1.1.1 release for building proper .changes file

Posted by ss...@apache.org.
MARMOTTA-431: updated to jdeb 1.1.1 release for building proper .changes file


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

Branch: refs/heads/MARMOTTA-450
Commit: f77b249b3521fcb5b63379a3689ea4a1ca9c8bb1
Parents: 31d04b5
Author: Sergio Fernández <wi...@apache.org>
Authored: Tue Mar 11 08:46:14 2014 +0100
Committer: Sergio Fernández <wi...@apache.org>
Committed: Tue Mar 11 08:46:14 2014 +0100

----------------------------------------------------------------------
 launchers/marmotta-webapp/pom.xml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/f77b249b/launchers/marmotta-webapp/pom.xml
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/pom.xml b/launchers/marmotta-webapp/pom.xml
index bf7bf27..a2c435b 100644
--- a/launchers/marmotta-webapp/pom.xml
+++ b/launchers/marmotta-webapp/pom.xml
@@ -140,8 +140,7 @@
             <plugin>
                 <artifactId>jdeb</artifactId>
                 <groupId>org.vafer</groupId>
-                <!--required for generating proper .changes: <version>1.1-SNAPSHOT</version>-->
-                <version>1.0.1</version>
+                <version>1.1.1</version>
                 <executions>
                     <execution>
                         <phase>package</phase>


[10/11] git commit: MARMOTTA-467: re-implemented dataview using directly the google charts API

Posted by ss...@apache.org.
MARMOTTA-467: re-implemented dataview using directly the google charts API


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

Branch: refs/heads/MARMOTTA-450
Commit: d5b0c6d2fdd5144a2cdb7a9c90ea4f82dae82fd3
Parents: 2b732de
Author: Jakob Frank <ja...@apache.org>
Authored: Fri Mar 14 16:14:43 2014 +0100
Committer: Jakob Frank <ja...@apache.org>
Committed: Fri Mar 14 16:21:26 2014 +0100

----------------------------------------------------------------------
 platform/marmotta-core/pom.xml                  |   4 -
 .../src/main/resources/web/admin/dataview.html  | 430 ++++++++++---------
 2 files changed, 223 insertions(+), 211 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/d5b0c6d2/platform/marmotta-core/pom.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/pom.xml b/platform/marmotta-core/pom.xml
index 3c2bb95..05ac758 100644
--- a/platform/marmotta-core/pom.xml
+++ b/platform/marmotta-core/pom.xml
@@ -324,10 +324,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.marmotta.webjars</groupId>
-            <artifactId>sgvizler</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.marmotta.webjars</groupId>
             <artifactId>strftime</artifactId>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/d5b0c6d2/platform/marmotta-core/src/main/resources/web/admin/dataview.html
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/admin/dataview.html b/platform/marmotta-core/src/main/resources/web/admin/dataview.html
index 2664624..b65917c 100644
--- a/platform/marmotta-core/src/main/resources/web/admin/dataview.html
+++ b/platform/marmotta-core/src/main/resources/web/admin/dataview.html
@@ -25,240 +25,245 @@
     <meta charset="UTF-8"/>
     <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
     <script type="text/javascript" src="https://www.google.com/jsapi"></script>
-    <script type="text/javascript" src="../../webjars/sgvizler/0.5.1/sgvizler.js" id="sgvzlr_script" ></script>
     <script type="text/javascript">
+        google.load('visualization', '1.0', {'packages':['corechart']});
 
-        var HAS_DATA = true;
+        $(document).ready(function() {
+            var colors = [  '#3366CC','#DC3912','#FF9900','#109618','#990099','#0099C6','#DD4477','#66AA00','#B82E2E','#316395','#994499','#22AA99','#AAAA11',
+                'blue','red','orange','green','navy','Crimson','DarkGreen','DarkTurquoise','DodgerBlue','OliveDrab','pink','violet',
+                'GoldenRod','Fuchsia','Darkorange','DarkSlateBlue','GreenYellow','LightSeaGreen','Maroon','MediumVioletRed'];
 
-        var SERVER_URL = _SERVER_URL;
-
-        var colors = [  '#3366CC','#DC3912','#FF9900','#109618','#990099','#0099C6','#DD4477','#66AA00','#B82E2E','#316395','#994499','#22AA99','#AAAA11',
-                        'blue','red','orange','green','navy','Crimson','DarkGreen','DarkTurquoise','DodgerBlue','OliveDrab','pink','violet',
-                        'GoldenRod','Fuchsia','Darkorange','DarkSlateBlue','GreenYellow','LightSeaGreen','Maroon','MediumVioletRed']
-
-        sgvizler.option.libfolder = "../../webjars/sgvizler/0.5.1/lib";
-
-        sgvizler.option.stylepath = _SERVER_URL + _CURRENT_STYLE;
-
-        sgvizler.option.query.endpoint = SERVER_URL+"sparql/select";
-        sgvizler.option.query.endpoint_output = 'json';
-
-        function drawGraphs() {
-            //$("#graphs").empty().append(loader());
-
-            var query = "SELECT ?graph (COUNT(?s) AS ?triples) WHERE { GRAPH ?graph { ?s ?p ?o }} GROUP BY ?graph";
-
-            $("#graphs").attr('data-sgvizler-query',query);
-            $("#graphs").attr('data-sgvizler-chart','gPieChart');
-            $("#graphs").attr('data-sgvizler-log',"2");
-
-            var query = new sgvizler.query();
-            $.extend(query,sgvizler.option.query,sgvizler.ui.getQueryOptionAttr(document.getElementById('graphs')));
-            $.extend(query.chartOptions,sgvizler.ui.getChartOptionAttr(document.getElementById('graphs')));
-            query.draw({
-                'select':function(chart,data) {
-                    var selection = chart.getSelection();
-                    if(selection.length > 0) {
-                        drawClasses(data.getValue(selection[0].row,0));
-                    }
-                }
-            },{is3D:true,title:'All Graphs in the system. Click to select!',colors:colors})
-
-            if (document.getElementById('loading_graphs') != null) {
-                var l_g = document.getElementById('loading_graphs');
-                l_g.parentNode.removeChild(l_g);
+            function loader() {
+                return $("<img />", {'src':_SERVER_URL+'core/public/img/loader/lmf-loader_32.gif'});
             }
-        }
 
-        function drawClasses(graph) {
-            if(graph) {
-                $("#classes_all").removeAttr("disabled").show();
+            function sparql(query,onsuccess,onfailure) {
+                $.ajax({
+                    'url': _SERVER_URL+"sparql/select?output=json&query="+encodeURIComponent(query),
+                    'success': onsuccess,
+                    'error': onfailure,
+                    'async': true
+                });
             }
-            else $("#classes_all").prop("disabled", "disabled").hide();
-
-            var title = graph ? "Classes in graph "+graph : "Classes in all graphs";
 
-            var query = graph ?
-                    "SELECT ?class (COUNT(?s) AS ?count) WHERE { GRAPH <"+graph+"> {{?s a ?class} UNION {SELECT ?s WHERE { GRAPH <"+graph+"> { ?s ?a ?b. FILTER NOT EXISTS{?s a ?class}}}GROUP BY ?s}}}GROUP BY ?class" :
-                    "SELECT ?class (COUNT(?s) AS ?count) WHERE {{?s a ?class} UNION {SELECT ?s WHERE{ ?s ?a ?b. FILTER NOT EXISTS{?s a ?class}}GROUP BY ?s}}GROUP BY ?class";
-
-            $("#classes").attr('data-sgvizler-query',query);
-            $("#classes").attr('data-sgvizler-chart','gPieChart');
-            $("#classes").attr('data-sgvizler-log',"2");
-
-            var query = new sgvizler.query();
-            $.extend(query,sgvizler.option.query,sgvizler.ui.getQueryOptionAttr(document.getElementById('classes')));
-            $.extend(query.chartOptions,sgvizler.ui.getChartOptionAttr(document.getElementById('classes')));
-            query.draw({
-                'select':function(chart,data) {
-                    var selection = chart.getSelection();
-                    if(selection.length > 0) {
-                        drawResources(graph,data.getValue(selection[0].row,0),undefined,colors[selection[0].row]);
-                    }
-                }
-            },{is3D:true,title:title,colors:colors},function(data){
-               drawResources(graph,data.getValue(0,0),undefined,colors[0]);
-            });
-        }
-
-
-        function drawResources(graph,clazz,lim,color) {
-            var limit = lim ? lim : 5;
-            var query;
-            var l_s = limit=="all" ? "":" LIMIT "+limit;
-            if(graph) {
-                if(clazz) {
-                    query = "SELECT ?a ?b ?c WHERE { GRAPH <"+graph+"> {?a ?b ?c.{SELECT ?a WHERE {GRAPH <"+graph+"> {?a a <"+clazz+">}}ORDER BY ?a "+l_s+"}}}";
-                } else {
-                   query = "SELECT ?a ?b ?c WHERE { GRAPH <"+graph+"> {?a ?b ?c.{SELECT ?a WHERE {GRAPH <"+graph+"> {?a ?b ?c.FILTER NOT EXISTS {?a a ?class}}}ORDER BY ?a "+l_s+"}}}";
+            function toGoogleDataTable(data) {
+                function getValue(d) {
+                    return d?d.value:"";
                 }
-            } else {
-                if(clazz) {
-                   query = "SELECT ?a ?b ?c WHERE {?a ?b ?c.{SELECT ?a WHERE {?a a <"+clazz+">}ORDER BY ?a "+l_s+"}}";
-                } else {
-                   query = "SELECT ?a ?b ?c WHERE {?a ?b ?c.{SELECT ?a WHERE {?a ?b ?c.FILTER NOT EXISTS {?a a ?class}}ORDER BY ?a "+l_s+"}}";
+                var tbl = new google.visualization.DataTable(),
+                        c1 = data.head.vars[0],
+                        c2 = data.head.vars[1];
+                tbl.addColumn('string', c1);
+                tbl.addColumn('number', c2);
+                var bind = data.results.bindings;
+                for( var i = 0; i < bind.length; i++) {
+                    tbl.addRow([ getValue(bind[i][c1]), parseInt( getValue(bind[i][c2]) )||0 ]);
                 }
+                return tbl;
             }
 
-            if (document.getElementById('loading_types') != null) {
-                var l_t = document.getElementById('loading_types');
-                l_t.parentNode.removeChild(l_t);
-            }
-            
-            sparql(query,function(data){
-                $("#resources").empty();
-                if(data.results.bindings.length==0) return $("#resources").append("<p>Nothing to display!</p>");
-                else {
-                   var sel = $("<select></select>")
-                           .append("<option>5</option>")
-                           .append("<option>10</option>")
-                           .append("<option>25</option>")
-                           .append("<option>50</option>")
-                           .append("<option>all</option>")
-                           .change(function(){
-                                drawResources(graph,clazz,$(this).val(),color);
-                           });
-                    sel.val(limit);
-                    var c_s = clazz ? " of type "+clazz : " without type relation";
-                    var g_s = graph ? " in graph "+graph : "";
-                    $("#resources").append($("<div></div>").append("Show ").append(sel).append(" items"+c_s+g_s));
-                    $("#resources").append(parse(data,color));
+            google.setOnLoadCallback(drawStatistics);
+            function drawStatistics() {
+                var target = $("#overview").empty().append(loader());
+                function error() {
+                    target.text("Error loading statistics");
                 }
 
-            },function(){alert("cannot show data")});
-
-            if (document.getElementById('loading_resources') != null) {
-                var l_r = document.getElementById('loading_resources');
-                l_r.parentNode.removeChild(l_r);
+                var stats = {};
+                sparql("SELECT (COUNT (?s) AS ?triples) WHERE { ?s ?p ?o }",
+                    function(data) {
+                        stats.triples = data.results.bindings[0].triples.value;
+                        if (stats.triples == 0) {
+                            target.empty().text("System does not contain any data");
+                            $("#details").hide();
+                            return;
+                        }
+                        sparql("SELECT (COUNT (?s) AS ?subjects) WHERE { SELECT ?s WHERE { ?s ?p ?o } GROUP BY ?s }",
+                            function(data){
+                                stats.subjects = data.results.bindings[0].subjects.value;
+                                sparql("SELECT (COUNT (?x) AS ?graphs) WHERE { SELECT ?x {GRAPH ?x { ?s ?p ?o }} GROUP BY ?x}",
+                                    function(data) {
+                                        stats.graphs = data.results.bindings[0].graphs.value;
+                                        var s = "System contains $2 subjects with overall $1 triples in $3 graphs.";
+                                        s = s.replace(/\$1/g,stats.triples);
+                                        s = s.replace(/\$2/g,stats.subjects);
+                                        s = s.replace(/\$3/g,stats.graphs);
+                                        target.empty().text(s);
+
+                                        $("#details").slideDown();
+                                        drawGraphs();
+                                        drawClasses(undefined);
+                                    },
+                                    error
+                                );
+                            },
+                            error
+                        );
+                    },
+                    error
+                );
             }
-        }
 
-        //return a result object
-        function parse(data,color) {
-            var x = 0;
-            var current;
-            var table;
-            var res = $("<div style='margin:10px'></div>");
-            for(var i=0; i<data.results.bindings.length;i++) {
-               var d = data.results.bindings[i];
-                if(d.a.value!=current) {
-                    x = 0;
-                    current = d.a.value;
-                    table = $("<table class='resource' style='margin-bottom:10px'></table>").append("<th style='background-color:"+color+" !important' colspan='2'><a target='_blank' href='../../../../resource?uri="+encodeURIComponent(d.a.value)+"'>"+d.a.value+"</a></th>");
-                    res.append(table);
+            var _graph = undefined, _type = undefined;
+            function drawGraphs() {
+                var target = $("#graphs").empty().append(loader());
+                function error() {
+                    target.empty().text("Could not load graphs");
                 }
-                var style = x%2==0 ? "white" : "#efefef";
-                x++;
-                var value = d.c.type=="uri" ? "<a target='_blank' href='../../../../resource?uri="+encodeURIComponent(d.c.value)+"'>"+d.c.value+"</a>" : d.c.value;
-                table.append($("<tr></tr>")
-                        .append("<td style='background-color:"+style+"'>"+d.b.value+"</td>")
-                        .append("<td style='background-color:"+style+"'>"+value+"</td></tr>"));
+                sparql("SELECT ?graph (COUNT(?s) AS ?triples) WHERE { GRAPH ?graph { ?s ?p ?o }} GROUP BY ?graph",
+                    function(data){
+                        var tbl = toGoogleDataTable(data),
+                            options = {
+                                is3D:true,
+                                height: 350,
+                                title:'All Graphs in the system. Click to select!',
+                                slices: {},
+                                colors:colors };
+
+                        var chart = new google.visualization.PieChart(document.getElementById('graphs'));
+                        google.visualization.events.addListener(chart, 'select', function() {
+                            var selection = chart.getSelection()[0];
+                            if (selection) {
+                                _graph = tbl.getValue(selection.row, 0);
+                                _type = undefined;
+                                if (tbl.getNumberOfRows() > 1) {
+                                    if (options.slices[selection.row]) {
+                                        options.slices = {};
+                                        _graph = undefined;
+                                    } else {
+                                        options.slices = {};
+                                        options['slices'][selection.row] =  { 'offset': .2};
+                                    }
+                                }
+                                chart.draw(tbl, options);
+                                drawClasses(_graph);
+                            }
+                        });
+                        chart.draw(tbl, options);
+                    },
+                    error
+                );
             }
-            return res;
-        }
-
-        function drawStatistics() {
-
-            $("#view").append("<h2>Overview <img id='loading_overview' src='../public/img/loader/lmf-loader_32.gif'></h2>");
-            $("#view").append("<div id='statistics'></div>");
-            //$("#statistics").append(loader());
-            count();
-
-            function count() {
-                var statistics = {};
-
-                //count triples
-                var Q1 = "SELECT (COUNT (?s) AS ?triples) WHERE { ?s ?p ?o }";
-                sparql(Q1,function(data){
-                    statistics.triples = data.results.bindings[0].triples.value;
 
-                },error);
-
-                if(statistics.triples == 0) {
-                    draw(statistics);
-                    HAS_DATA = false;
-                    return;
+            function drawClasses(graph) {
+                _graph = graph || _graph;
+                $("#resources").empty().append(loader());
+                var target = $("#types").empty().append(loader()),
+                    query = _graph ?
+                        "SELECT ?class (COUNT(?s) AS ?count) WHERE { GRAPH <"+_graph+"> {{?s a ?class} UNION {SELECT ?s WHERE { GRAPH <"+_graph+"> { ?s ?a ?b. FILTER NOT EXISTS{?s a ?class}}}GROUP BY ?s}}}GROUP BY ?class" :
+                        "SELECT ?class (COUNT(?s) AS ?count) WHERE {{?s a ?class} UNION {SELECT ?s WHERE{ ?s ?a ?b. FILTER NOT EXISTS{?s a ?class}}GROUP BY ?s}}GROUP BY ?class";
+                function error() {
+                    target.empty().text("Could not load classes");
                 }
 
-                //count subjects
-                var Q2 = "SELECT (COUNT (?s) AS ?subjects) WHERE { SELECT ?s WHERE { ?s ?p ?o } GROUP BY ?s }";
-                sparql(Q2,function(data){
-                    statistics.subjects = data.results.bindings[0].subjects.value;
-                },error);
-
-                //count graphs
-                var Q3 = "SELECT (COUNT (?x) AS ?graphs) WHERE { SELECT ?x {GRAPH ?x { ?s ?p ?o }} GROUP BY ?x}";
-                sparql(Q3,function(data){
-                    statistics.graphs = data.results.bindings[0].graphs.value;
-                },error);
-
-                draw(statistics);
-                
+                sparql(query,
+                    function(data) {
+                        var tbl = toGoogleDataTable(data),
+                            options = {
+                                is3D:true,
+                                height: 350,
+                                title: "All classes in "+(_graph?_graph:"the System. Click to select!"),
+                                slices: {},
+                                colors:colors };
+
+                        var chart = new google.visualization.PieChart(document.getElementById('types'));
+                        google.visualization.events.addListener(chart, 'select', function() {
+                            var selection = chart.getSelection()[0];
+                            if (selection) {
+                                _type = tbl.getValue(selection.row, 0);
+                                var _c = colors[selection.row];
+                                if (tbl.getNumberOfRows() > 1) {
+                                    if (options.slices[selection.row]) {
+                                        options.slices = {};
+                                        _type = undefined;
+                                        _c = "#333";
+                                    } else {
+                                        options.slices = {};
+                                        options['slices'][selection.row] =  { 'offset': .2};
+                                    }
+                                }
+                                chart.draw(tbl, options);
+                                drawResources(_graph, _type, undefined, _c);
+                            }
+                        });
+                        chart.draw(tbl, options);
+                        drawResources(_graph, _type, undefined, "#333");
+                    },
+                    error
+                );
             }
 
-            function draw(statistics) {
-               if(statistics.triples == 0) {
-                    $("#statistics").empty().html("System does not contain any data");
-               } else {
-                   var s = "System contains $2 subjects with overall $1 triples in $3 graphs";
-                   s = s.replace(/\$1/g,statistics.triples);
-                   s = s.replace(/\$2/g,statistics.subjects);
-                   s = s.replace(/\$3/g,statistics.graphs);
-                   $("#statistics").empty().text(s);
-               }
-                if (document.getElementById('loading_overview') != null) {
-                    var l_o = document.getElementById('loading_overview');
-                    l_o.parentNode.removeChild(l_o);
+            function drawResources(graph, type, limit, color) {
+                limit = limit || 5;
+                var target = $("#resources").empty().append(loader()),
+                    query,
+                    l_s = limit=="all" ? "":" LIMIT "+limit;
+
+                if(graph) {
+                    if(type) {
+                        query = "SELECT ?a ?b ?c WHERE { GRAPH <"+graph+"> {?a ?b ?c.{SELECT ?a WHERE {GRAPH <"+graph+"> {?a a <"+type+">}}ORDER BY ?a "+l_s+"}}}";
+                    } else {
+                        query = "SELECT ?a ?b ?c WHERE { GRAPH <"+graph+"> {?a ?b ?c.{SELECT ?a WHERE {GRAPH <"+graph+"> {?a ?b ?c.FILTER NOT EXISTS {?a a ?class}}}ORDER BY ?a "+l_s+"}}}";
+                    }
+                } else {
+                    if(type) {
+                        query = "SELECT ?a ?b ?c WHERE {?a ?b ?c.{SELECT ?a WHERE {?a a <"+type+">}ORDER BY ?a "+l_s+"}}";
+                    } else {
+                        query = "SELECT ?a ?b ?c WHERE {?a ?b ?c.{SELECT ?a WHERE {?a ?b ?c.FILTER NOT EXISTS {?a a ?class}}ORDER BY ?a "+l_s+"}}";
+                    }
                 }
-            }
 
-            function error() {
-                alert("an error occurred!");
-            }
-        }
+                function error() {
+                    target.empty().text("Could not load resources");
+                }
 
-        function sparql(query,onsuccess,onfailure) {
-           $.ajax({url:SERVER_URL+"sparql/select?output=json&query="+encodeURIComponent(query),success:onsuccess,error:onfailure,async:false});
-        }
+                sparql(query, function(data) {
+                    target.empty();
+                    if(data.results.bindings.length==0) {
+                        target.text("Nothing to display");
+                        return;
+                    }
 
-        function loader() {
-            return $("<img src='../public/img/loader/lmf-loader_32.gif'>");
-        }
+                    var sel = $("<select />")
+                        .append("<option>5</option>")
+                        .append("<option>10</option>")
+                        .append("<option>25</option>")
+                        .append("<option>50</option>")
+                        .append("<option>all</option>")
+                        .change(function(){
+                            drawResources(graph,type,$(this).val(),color);
+                        });
+                    sel.val(limit);
+                    var c_s = type ? " of type "+type : " without type relation";
+                    var g_s = graph ? " in graph "+graph : "";
 
-        sgvizler.go(function(){
-            drawStatistics();
-            if(HAS_DATA) {
-                $("#view").append("<h2>Graphs <img id='loading_graphs' src='../public/img/loader/lmf-loader_32.gif'></h2>");
-                $("#view").append("<div id='graphs' style='height:350px;'></div>");
-                $("#view").append($("<h2>Types <img id='loading_types' src='../public/img/loader/lmf-loader_32.gif'></h2>").append($("<button id='classes_all' style='font-size: 12px;margin-left:5px;'>(show types of all graphs)</button>").click(function(){drawClasses()})));
-                $("#view").append("<div id='classes' style='height:350px;'></div>");
-                $("#view").append("<h2>Resources <img id='loading_resources' src='../public/img/loader/lmf-loader_32.gif'></h2>");
-                $("#view").append("<div id='resources' style=''></div>");
-                drawGraphs();
-                drawClasses();
-            }
-    });
+                    target.append($("<div />").append("Show ").append(sel).append(" items"+c_s+g_s));
+
+                    var x = 0, current, table,
+                            res = $("<div />", {'style':'margin:10px'});
+
+                    for(var i=0; i<data.results.bindings.length;i++) {
+                        var d = data.results.bindings[i];
+                        if(d.a.value!=current) {
+                            x = 0;
+                            current = d.a.value;
+                            table = $("<table />", {'class':'resource', 'style':'margin-bottom:10px'})
+                                    .append($("<th/>", {'style':"background-color:"+color+" !important", 'colspan':'2'})
+                                            .append($("<a/>", {'target':'_blank', 'href':_SERVER_URL+"resource?uri="+encodeURIComponent(d.a.value), 'text':d.a.value})));
+                            res.append(table);
+                        }
+                        var style = x%2==0 ? "white" : "#efefef";
+                        x++;
+                        var value = (d.c.type=="uri" ? $("<a/>", {'target':'_blank', 'href':_SERVER_URL+"resource?uri="+encodeURIComponent(d.c.value)}) : $("<span/>")).text(d.c.value);
+                        table.append($("<tr />")
+                            .append($("<td />", {'style':"background-color:"+style+";", 'text':d.b.value}))
+                            .append($("<td />", {'style':"background-color:"+style+";"}).append(value)));
+                    }
+                    target.append(res);
 
+                }, error);
+            }
+        });
     </script>
     <style type="text/css">
         .resource {
@@ -286,7 +291,18 @@
 <body>
   <!--###BEGIN_CONTENT###-->
   <h1>Dataview</h1>
-  <div id="view"></div>
+  <div id="view">
+      <h2>Overview</h2>
+      <div id="overview"></div>
+      <div id="details" style="display: none;">
+          <h2>Graphs</h2>
+          <div id="graphs"></div>
+          <h2>Types</h2>
+          <div id="types"></div>
+          <h2>Resources</h2>
+          <div id="resources"></div>
+      </div>
+  </div>
   <!--###END_CONTENT###-->
 </body>
 </html>


[11/11] git commit: Merge branch 'develop' into MARMOTTA-450

Posted by ss...@apache.org.
Merge branch 'develop' into MARMOTTA-450


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

Branch: refs/heads/MARMOTTA-450
Commit: cebdd640424d6f50b3f2552d17d668b8ec037381
Parents: b07ed13 d5b0c6d
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Mon Mar 17 09:53:25 2014 +0100
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Mon Mar 17 09:53:25 2014 +0100

----------------------------------------------------------------------
 launchers/marmotta-webapp/pom.xml               |   3 +-
 platform/backends/marmotta-backend-http/pom.xml |   2 +-
 platform/marmotta-core/pom.xml                  |   4 -
 .../core/exception/HttpErrorException.java      | 107 +++++
 .../core/jaxrs/HttpErrorExceptionMapper.java    |  91 ++++
 .../jaxrs/MarmottaImportExceptionMapper.java    |   1 -
 .../servlet/MarmottaPreStartupListener.java     |  10 +-
 .../webservices/resource/ContentWebService.java |  83 ++--
 .../webservices/resource/MetaWebService.java    | 194 ++++-----
 .../resource/ResourceWebService.java            | 282 ++++++------
 .../resource/ResourceWebServiceHelper.java      |  65 +--
 .../main/resources/config-defaults.properties   |  28 +-
 .../src/main/resources/templates/error.ftl      |  83 ++++
 .../src/main/resources/web/admin/dataview.html  | 430 ++++++++++---------
 .../web/public/img/logo/marmotta-sad.png        | Bin 0 -> 37916 bytes
 .../resources/web/public/style/blue/error.css   |  31 ++
 .../resources/web/public/style/white/error.css  |  31 ++
 17 files changed, 867 insertions(+), 578 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/cebdd640/launchers/marmotta-webapp/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/marmotta/blob/cebdd640/platform/marmotta-core/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/marmotta/blob/cebdd640/platform/marmotta-core/src/main/resources/config-defaults.properties
----------------------------------------------------------------------


[08/11] git commit: MARMOTTA-238: fixed error in the template

Posted by ss...@apache.org.
MARMOTTA-238: fixed error in the template


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

Branch: refs/heads/MARMOTTA-450
Commit: bb52d27bae31b1ce66fd2c480899411e0474183f
Parents: 1ca8577
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Mar 12 18:00:51 2014 +0100
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Mar 12 18:00:51 2014 +0100

----------------------------------------------------------------------
 platform/marmotta-core/src/main/resources/templates/error.ftl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/bb52d27b/platform/marmotta-core/src/main/resources/templates/error.ftl
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/templates/error.ftl b/platform/marmotta-core/src/main/resources/templates/error.ftl
index 85f468d..ef39fbb 100644
--- a/platform/marmotta-core/src/main/resources/templates/error.ftl
+++ b/platform/marmotta-core/src/main/resources/templates/error.ftl
@@ -24,7 +24,7 @@
 
   <head>
     <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-    <title>${status} ${phrase} - Marmotta Linked Data Explorer</title>
+    <title>${status} ${reason} - Linked Data Explorer - Apache Marmotta</title>
     <script src="${SERVER_URL}webjars/jquery/1.8.2/jquery.min.js" type="text/javascript" ></script>
     <link href="${SERVER_URL}${DEFAULT_STYLE}style.css" rel="stylesheet" type="text/css" />
     <link href="${SERVER_URL}${DEFAULT_STYLE}rdfhtml.css" rel="stylesheet" type="text/css" />
@@ -45,7 +45,7 @@
     <div id="center">
         <div id="content">
 
-          <h2>Error: ${status} ${phrase}</h2>
+          <h2>Error: ${status} ${reason}</h2>
         
           <p>
             <strong><a href="${SERVER_URL}resource?uri=${encoded_uri}">${uri}</a></strong><a href="${uri}"><img src="${SERVER_URL}core/public/img/icon/link.png" alt="${uri}" title="go to ${uri} directly" /></a>


[09/11] git commit: MARMOTTA-182: added some minimum stule, plus the image with the sad marmot created by Oliver

Posted by ss...@apache.org.
MARMOTTA-182: added some minimum stule, plus the image with the sad marmot created by Oliver


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

Branch: refs/heads/MARMOTTA-450
Commit: 2b732de378389c2b9c22b0308945e2c074d388d7
Parents: bb52d27
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Mar 12 18:14:45 2014 +0100
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Mar 12 18:14:45 2014 +0100

----------------------------------------------------------------------
 .../src/main/resources/templates/error.ftl      |   4 +--
 .../web/public/img/logo/marmotta-sad.png        | Bin 0 -> 37916 bytes
 .../resources/web/public/style/blue/error.css   |  28 +++++-------------
 .../resources/web/public/style/white/error.css  |  29 +++++--------------
 4 files changed, 18 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/2b732de3/platform/marmotta-core/src/main/resources/templates/error.ftl
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/templates/error.ftl b/platform/marmotta-core/src/main/resources/templates/error.ftl
index ef39fbb..9e1f35d 100644
--- a/platform/marmotta-core/src/main/resources/templates/error.ftl
+++ b/platform/marmotta-core/src/main/resources/templates/error.ftl
@@ -24,7 +24,7 @@
 
   <head>
     <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-    <title>${status} ${reason} - Linked Data Explorer - Apache Marmotta</title>
+    <title>${status} ${reason} - Marmotta Error</title>
     <script src="${SERVER_URL}webjars/jquery/1.8.2/jquery.min.js" type="text/javascript" ></script>
     <link href="${SERVER_URL}${DEFAULT_STYLE}style.css" rel="stylesheet" type="text/css" />
     <link href="${SERVER_URL}${DEFAULT_STYLE}rdfhtml.css" rel="stylesheet" type="text/css" />
@@ -38,7 +38,7 @@
         <a id="logo" href="${SERVER_URL}" title="${PROJECT}">
             <img src="${SERVER_URL}${LOGO}" alt="${PROJECT} logo" />
         </a>
-        <h1>Marmotta Linked Data Explorer</h1>
+        <h1>Marmotta Error</h1>
         <div class="clean"></div>
     </div>
     <div class="clear"></div>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2b732de3/platform/marmotta-core/src/main/resources/web/public/img/logo/marmotta-sad.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/public/img/logo/marmotta-sad.png b/platform/marmotta-core/src/main/resources/web/public/img/logo/marmotta-sad.png
new file mode 100644
index 0000000..cbd3b2e
Binary files /dev/null and b/platform/marmotta-core/src/main/resources/web/public/img/logo/marmotta-sad.png differ

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2b732de3/platform/marmotta-core/src/main/resources/web/public/style/blue/error.css
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/public/style/blue/error.css b/platform/marmotta-core/src/main/resources/web/public/style/blue/error.css
index fc35268..623acb4 100644
--- a/platform/marmotta-core/src/main/resources/web/public/style/blue/error.css
+++ b/platform/marmotta-core/src/main/resources/web/public/style/blue/error.css
@@ -16,28 +16,16 @@
  * limitations under the License.
  */
 
-div#header h1, div#center {
-    width: auto; 
-    min-height: 400px; 
-    margin: 0; 
-}
-
 div#center {
-    padding: 2em 30% 2em 30%;
+    float: none;
+    width: 60%;
+    padding-left: 20%;
+    padding-bottom: 8em;
 }
 
-div#center {
-    float: none; 
-    vertical-align: middle; 
-    padding: 2em 30% 5em 30%;
-}
-
-div#center > * {
-    margin-top: 2em;
+div#content {
+    min-height: 200px;
     font-size: 1.6em;
-}
-
-div#center > p > a > img {
-    vertical-align: text-top;
-    margin-left: 0.15em;
+    background: #ffffff url('../../img/logo/marmotta-sad.png') no-repeat right top;
+    padding-right: 220px;
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/2b732de3/platform/marmotta-core/src/main/resources/web/public/style/white/error.css
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/web/public/style/white/error.css b/platform/marmotta-core/src/main/resources/web/public/style/white/error.css
index 9d3b62a..623acb4 100644
--- a/platform/marmotta-core/src/main/resources/web/public/style/white/error.css
+++ b/platform/marmotta-core/src/main/resources/web/public/style/white/error.css
@@ -16,29 +16,16 @@
  * limitations under the License.
  */
 
-div#header h1, div#center {
-    width: auto; 
-    min-height: 400px; 
-    margin: 0; 
-}
-
-div#center {
-    padding: 2em 30% 2em 30%;
-}
-
 div#center {
-    float: none; 
-    vertical-align: middle; 
-    padding: 2em 30% 5em 30%;
+    float: none;
+    width: 60%;
+    padding-left: 20%;
+    padding-bottom: 8em;
 }
 
-div#center > * {
-    margin-top: 2em;
+div#content {
+    min-height: 200px;
     font-size: 1.6em;
+    background: #ffffff url('../../img/logo/marmotta-sad.png') no-repeat right top;
+    padding-right: 220px;
 }
-
-div#center > p > a > img {
-    vertical-align: text-top;
-    margin-left: 0.15em;
-}
-