Added: 
incubator/stanbol/trunk/commons/web/sparql/src/main/resources/org/apache/stanbol/commons/web/sparql/templates/imports/sparqlDescription.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/sparql/src/main/resources/org/apache/stanbol/commons/web/sparql/templates/imports/sparqlDescription.ftl?rev=1088603&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/commons/web/sparql/src/main/resources/org/apache/stanbol/commons/web/sparql/templates/imports/sparqlDescription.ftl
 (added)
+++ 
incubator/stanbol/trunk/commons/web/sparql/src/main/resources/org/apache/stanbol/commons/web/sparql/templates/imports/sparqlDescription.ftl
 Mon Apr  4 13:02:49 2011
@@ -0,0 +1,4 @@
+This is the <strong>SPARQL endpoint</strong> for the Stanbol store.
+<a href="http://en.wikipedia.org/wiki/Sparql";>SPARQL</a> is the
+standard query language the most commonly used to provide interactive
+access to semantic knowledge bases.
\ No newline at end of file

Added: 
incubator/stanbol/trunk/commons/web/sparql/src/main/resources/org/apache/stanbol/commons/web/sparql/templates/org/apache/stanbol/commons/web/sparql/resource/SparqlEndpointResource/index.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/sparql/src/main/resources/org/apache/stanbol/commons/web/sparql/templates/org/apache/stanbol/commons/web/sparql/resource/SparqlEndpointResource/index.ftl?rev=1088603&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/commons/web/sparql/src/main/resources/org/apache/stanbol/commons/web/sparql/templates/org/apache/stanbol/commons/web/sparql/resource/SparqlEndpointResource/index.ftl
 (added)
+++ 
incubator/stanbol/trunk/commons/web/sparql/src/main/resources/org/apache/stanbol/commons/web/sparql/templates/org/apache/stanbol/commons/web/sparql/resource/SparqlEndpointResource/index.ftl
 Mon Apr  4 13:02:49 2011
@@ -0,0 +1,21 @@
+<#import "/imports/common.ftl" as common>
+<#import "/imports/sparql.ftl" as sparql>
+<#escape x as x?html>
+<@common.page title="SPARQL Endpoint" hasrestapi=false>
+
+  <p><a href="http://en.wikipedia.org/wiki/Sparql";>SPARQL</a> is the
+    standard query language the most commonly used to provide interactive
+    access to semantic knowledge bases.</p>
+    
+  <p>A SPARQL endpoint is a standardized HTTP access to perform SPARQL queries.
+    Developers of REST clients will find all the necessary documentation in the
+    official <a 
href="http://www.w3.org/TR/rdf-sparql-protocol/#query-bindings-http";>W3C
+    page for the RDF SPARQL protocol</a>.
+       
+  <p>The Stanbol enhancer SPARQL endpoint gives access to all the semantic
+    enhancements related to content items from the Stanbol enhancer <a 
href="/store">store</a>.</p>
+
+  <@sparql.form/>
+
+</@common.page>
+</#escape>

Modified: 
incubator/stanbol/trunk/enhancer/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancerTestBase.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancerTestBase.java?rev=1088603&r1=1088602&r2=1088603&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancerTestBase.java
 (original)
+++ 
incubator/stanbol/trunk/enhancer/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancerTestBase.java
 Mon Apr  4 13:02:49 2011
@@ -63,10 +63,10 @@ public class EnhancerTestBase extends St
                  */
                 executor.execute(
                         builder.buildGetRequest("/engines")
-                        .withHeader("Accept", "text/plain")
+                        .withHeader("Accept", "text/html")
                 )
                 .assertStatus(200)
-                .assertContentType("text/plain")
+                .assertContentType("text/html")
                 .assertContentRegexp(
                     "org.apache.stanbol.*MetaxaEngine",
                     "org.apache.stanbol.*LangIdEnhancementEngine",

Modified: 
incubator/stanbol/trunk/enhancer/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/HomepageTest.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/HomepageTest.java?rev=1088603&r1=1088602&r2=1088603&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/HomepageTest.java
 (original)
+++ 
incubator/stanbol/trunk/enhancer/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/HomepageTest.java
 Mon Apr  4 13:02:49 2011
@@ -34,7 +34,7 @@ public class HomepageTest extends Stanbo
         .assertStatus(200)
         .assertContentType("text/html")
         .assertContentContains(
-            "/static/style/stanbol.css", 
+            "/static/home/style/stanbol.css", 
             "The RESTful Semantic Engine")
         .assertContentRegexp(
             "stylesheet.*stanbol.css",

Modified: incubator/stanbol/trunk/enhancer/jersey/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/pom.xml?rev=1088603&r1=1088602&r2=1088603&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/jersey/pom.xml (original)
+++ incubator/stanbol/trunk/enhancer/jersey/pom.xml Mon Apr  4 13:02:49 2011
@@ -44,7 +44,6 @@
                                                        
org.apache.stanbol.enhancer.jersey.*
                                </Export-Package>
                                                
<Embed-Dependency>*;scope=compile|runtime;inline=false;artifactId=jersey-json|jettison|jackson-core-asl</Embed-Dependency>
-                                               
<Embed-Dependency>freemarker</Embed-Dependency>
                                                
<Embed-Transitive>true</Embed-Transitive>
                                                <Import-Package>
                                                        !javax.servlet.jsp.*,
@@ -81,7 +80,10 @@
                        <groupId>org.apache.stanbol</groupId>
                        <artifactId>org.apache.stanbol.jsonld</artifactId>
                </dependency>
-               
+               <dependency>
+          <groupId>org.apache.stanbol</groupId>
+          <artifactId>org.apache.stanbol.commons.web.base</artifactId>
+        </dependency>
                <!-- Clerezza dependencies -->
                <dependency>
                        <groupId>org.apache.clerezza</groupId>

Added: 
incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/fragment/EnhancerWebFragment.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/fragment/EnhancerWebFragment.java?rev=1088603&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/fragment/EnhancerWebFragment.java
 (added)
+++ 
incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/fragment/EnhancerWebFragment.java
 Mon Apr  4 13:02:49 2011
@@ -0,0 +1,104 @@
+package org.apache.stanbol.enhancer.jersey.fragment;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.stanbol.commons.web.base.LinkResource;
+import org.apache.stanbol.commons.web.base.NavigationLink;
+import org.apache.stanbol.commons.web.base.ScriptResource;
+import org.apache.stanbol.commons.web.base.WebFragment;
+import org.apache.stanbol.enhancer.jersey.resource.EnginesRootResource;
+import org.apache.stanbol.enhancer.jersey.resource.StoreRootResource;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentContext;
+
+import freemarker.cache.ClassTemplateLoader;
+import freemarker.cache.TemplateLoader;
+
+/**
+ * Statically define the list of available resources and providers to be 
contributed to the the Stanbol JAX-RS
+ * Endpoint.
+ */
+@Component(immediate = true, metatype = true)
+@Service
+public class EnhancerWebFragment implements WebFragment {
+
+    private static final String NAME = "enhancer";
+
+    private static final String STATIC_RESOURCE_PATH = 
"/org/apache/stanbol/enhancer/jersey/static";
+
+    private static final String TEMPLATE_PATH = 
"/org/apache/stanbol/enhancer/jersey/templates";
+
+    private BundleContext bundleContext;
+
+    @Override
+    public String getName() {
+        return NAME;
+    }
+
+    @Activate
+    protected void activate(ComponentContext ctx) {
+        this.bundleContext = ctx.getBundleContext();
+    }
+
+    @Override
+    public Set<Class<?>> getJaxrsResourceClasses() {
+        Set<Class<?>> classes = new HashSet<Class<?>>();
+        // resources
+        classes.add(EnginesRootResource.class);
+        classes.add(StoreRootResource.class);
+        return classes;
+    }
+
+    @Override
+    public Set<Object> getJaxrsResourceSingletons() {
+        return Collections.emptySet();
+    }
+
+    @Override
+    public String getStaticResourceClassPath() {
+        return STATIC_RESOURCE_PATH;
+    }
+
+    @Override
+    public TemplateLoader getTemplateLoader() {
+        return new ClassTemplateLoader(getClass(), TEMPLATE_PATH);
+    }
+
+    @Override
+    public List<LinkResource> getLinkResources() {
+        List<LinkResource> resources = new ArrayList<LinkResource>();
+        resources.add(new LinkResource("stylesheet", 
"openlayers-2.9/theme/default/style.css", this, 10));
+        resources.add(new LinkResource("stylesheet", 
"scripts/prettify/prettify.css", this, 20));
+        return resources;
+    }
+
+    @Override
+    public List<ScriptResource> getScriptResources() {
+        List<ScriptResource> resources = new ArrayList<ScriptResource>();
+        resources.add(new ScriptResource("text/javascript", 
"openlayers-2.9/OpenLayers.js", this, 10));
+        resources.add(new ScriptResource("text/javascript", 
"scripts/prettify/prettify.js", this, 20));
+        resources.add(new ScriptResource("text/javascript", 
"scripts/jquery-1.4.2.js", this, 30));
+        return resources;
+    }
+
+    @Override
+    public List<NavigationLink> getNavigationLinks() {
+        List<NavigationLink> links = new ArrayList<NavigationLink>();
+        links.add(new NavigationLink("engines", "/engines", 
"/imports/enginesDescription.ftl", 10));
+        links.add(new NavigationLink("store", "/store", 
"/imports/storeDescription.ftl", 20));
+        return links;
+    }
+
+    @Override
+    public BundleContext getBundleContext() {
+        return bundleContext;
+    }
+
+}

Modified: 
incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ContentItemResource.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ContentItemResource.java?rev=1088603&r1=1088602&r2=1088603&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ContentItemResource.java
 (original)
+++ 
incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ContentItemResource.java
 Mon Apr  4 13:02:49 2011
@@ -1,5 +1,12 @@
 package org.apache.stanbol.enhancer.jersey.resource;
 
+import static javax.ws.rs.core.MediaType.TEXT_HTML;
+import static 
org.apache.stanbol.enhancer.servicesapi.rdf.OntologicalClasses.DBPEDIA_ORGANISATION;
+import static 
org.apache.stanbol.enhancer.servicesapi.rdf.OntologicalClasses.DBPEDIA_PERSON;
+import static 
org.apache.stanbol.enhancer.servicesapi.rdf.OntologicalClasses.DBPEDIA_PLACE;
+import static org.apache.stanbol.enhancer.servicesapi.rdf.Properties.GEO_LAT;
+import static org.apache.stanbol.enhancer.servicesapi.rdf.Properties.GEO_LONG;
+
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
@@ -13,7 +20,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 
-import javax.ws.rs.core.UriBuilder;
+import javax.servlet.ServletContext;
+import javax.ws.rs.GET;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.clerezza.rdf.core.Graph;
@@ -39,41 +49,26 @@ import org.apache.clerezza.rdf.core.spar
 import org.apache.clerezza.rdf.core.sparql.query.SelectQuery;
 import org.apache.clerezza.rdf.utils.GraphNode;
 import org.apache.commons.io.IOUtils;
+import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
 import org.apache.stanbol.enhancer.servicesapi.ContentItem;
 import org.apache.stanbol.enhancer.servicesapi.rdf.Properties;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.sun.jersey.api.view.ImplicitProduces;
+import com.sun.jersey.api.view.Viewable;
 
-
-import static javax.ws.rs.core.MediaType.TEXT_HTML;
-import static 
org.apache.stanbol.enhancer.servicesapi.rdf.OntologicalClasses.DBPEDIA_ORGANISATION;
-import static 
org.apache.stanbol.enhancer.servicesapi.rdf.OntologicalClasses.DBPEDIA_PERSON;
-import static 
org.apache.stanbol.enhancer.servicesapi.rdf.OntologicalClasses.DBPEDIA_PLACE;
-import static org.apache.stanbol.enhancer.servicesapi.rdf.Properties.GEO_LAT;
-import static org.apache.stanbol.enhancer.servicesapi.rdf.Properties.GEO_LONG;
-
-@ImplicitProduces(TEXT_HTML + ";qs=2")
-public class ContentItemResource extends NavigationMixin {
+public class ContentItemResource extends BaseStanbolResource {
 
     @SuppressWarnings("unused")
     private final Logger log = LoggerFactory.getLogger(getClass());
 
     // TODO make this configurable trough a property
-    public static final UriRef SUMMARY = new UriRef(
-            "http://www.w3.org/2000/01/rdf-schema#comment";);
+    public static final UriRef SUMMARY = new 
UriRef("http://www.w3.org/2000/01/rdf-schema#comment";);
 
     // TODO make this configurable trough a property
-    public static final UriRef THUMBNAIL = new UriRef(
-            "http://dbpedia.org/ontology/thumbnail";);
+    public static final UriRef THUMBNAIL = new 
UriRef("http://dbpedia.org/ontology/thumbnail";);
 
-    public static final Map<UriRef, String> DEFAULT_THUMBNAILS = new 
HashMap<UriRef, String>();
-    static {
-        DEFAULT_THUMBNAILS.put(DBPEDIA_PERSON, "/static/images/user_48.png");
-        DEFAULT_THUMBNAILS.put(DBPEDIA_ORGANISATION, 
"/static/images/organization_48.png");
-        DEFAULT_THUMBNAILS.put(DBPEDIA_PLACE, "/static/images/compass_48.png");
-    }
+    public final Map<UriRef,String> defaultThumbnails = new 
HashMap<UriRef,String>();
 
     protected ContentItem contentItem;
 
@@ -101,31 +96,38 @@ public class ContentItemResource extends
 
     protected Collection<EntityExtractionSummary> places;
 
-    public ContentItemResource(String localId, ContentItem ci,
-            TripleCollection remoteEntityCache, UriInfo uriInfo,
-            TcManager tcManager, Serializer serializer) throws IOException {
+    public ContentItemResource(String localId,
+                               ContentItem ci,
+                               TripleCollection remoteEntityCache,
+                               UriInfo uriInfo,
+                               TcManager tcManager,
+                               Serializer serializer,
+                               ServletContext servletContext) throws 
IOException {
         this.contentItem = ci;
         this.localId = localId;
         this.uriInfo = uriInfo;
         this.tcManager = tcManager;
         this.serializer = serializer;
         this.remoteEntityCache = remoteEntityCache;
+        this.servletContext = servletContext;
 
         if (localId != null) {
-            URI rawURI = UriBuilder.fromPath("/store/raw/" + localId).build();
+            URI rawURI = 
uriInfo.getBaseUriBuilder().path("/store/raw").path(localId).build();
             if (ci.getMimeType().equals("text/plain")) {
                 this.textContent = IOUtils.toString(ci.getStream(), "UTF-8");
             } else if (ci.getMimeType().startsWith("image/")) {
                 this.imageSrc = rawURI;
             }
             this.downloadHref = rawURI;
-            this.metadataHref = UriBuilder.fromPath(
-                    "/store/metadata/" + localId).build();
+            this.metadataHref = 
uriInfo.getBaseUriBuilder().path("/store/metadata").path(localId).build();
         }
+        defaultThumbnails.put(DBPEDIA_PERSON, getStaticRootUrl() + 
"/home/images/user_48.png");
+        defaultThumbnails.put(DBPEDIA_ORGANISATION, getStaticRootUrl() + 
"/home/organization_48.png");
+        defaultThumbnails.put(DBPEDIA_PLACE, getStaticRootUrl() + 
"/home/images/compass_48.png");
+
     }
 
-    public String getRdfMetadata(String mediatype)
-            throws UnsupportedEncodingException {
+    public String getRdfMetadata(String mediatype) throws 
UnsupportedEncodingException {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         serializer.serialize(out, contentItem.getMetadata(), mediatype);
         return out.toString("utf-8");
@@ -159,51 +161,44 @@ public class ContentItemResource extends
         return metadataHref;
     }
 
-    public Collection<EntityExtractionSummary> getPersonOccurrences()
-            throws ParseException {
+    public Collection<EntityExtractionSummary> getPersonOccurrences() throws 
ParseException {
         if (people == null) {
             people = getOccurrences(DBPEDIA_PERSON);
         }
         return people;
     }
 
-    public Collection<EntityExtractionSummary> getOrganizationOccurrences()
-            throws ParseException {
+    public Collection<EntityExtractionSummary> getOrganizationOccurrences() 
throws ParseException {
         if (organizations == null) {
             organizations = getOccurrences(DBPEDIA_ORGANISATION);
         }
         return organizations;
     }
 
-    public Collection<EntityExtractionSummary> getPlaceOccurrences()
-            throws ParseException {
+    public Collection<EntityExtractionSummary> getPlaceOccurrences() throws 
ParseException {
         if (places == null) {
             places = getOccurrences(DBPEDIA_PLACE);
         }
         return places;
     }
 
-    public Collection<EntityExtractionSummary> getOccurrences(UriRef type)
-            throws ParseException {
+    public Collection<EntityExtractionSummary> getOccurrences(UriRef type) 
throws ParseException {
         MGraph graph = contentItem.getMetadata();
         String q = "PREFIX enhancer: <http://fise.iks-project.eu/ontology/> "
-                + "PREFIX dc:   <http://purl.org/dc/terms/> "
-                + "SELECT ?textAnnotation ?text ?entity ?entity_label 
?confidence WHERE { "
-                + "  ?textAnnotation a enhancer:TextAnnotation ."
-                + "  ?textAnnotation dc:type %s ."
-                + "  ?textAnnotation enhancer:selected-text ?text ."
-                + " OPTIONAL {"
-                + "   ?entityAnnotation dc:relation ?textAnnotation ."
-                + "   ?entityAnnotation a enhancer:EntityAnnotation . "
-                + "   ?entityAnnotation enhancer:entity-reference ?entity ."
-                + "   ?entityAnnotation enhancer:entity-label ?entity_label ."
-                + "   ?entityAnnotation enhancer:confidence ?confidence . }"
-                + "} ORDER BY ?text ";
+                   + "PREFIX dc:   <http://purl.org/dc/terms/> "
+                   + "SELECT ?textAnnotation ?text ?entity ?entity_label 
?confidence WHERE { "
+                   + "  ?textAnnotation a enhancer:TextAnnotation ." + "  
?textAnnotation dc:type %s ."
+                   + "  ?textAnnotation enhancer:selected-text ?text ." + " 
OPTIONAL {"
+                   + "   ?entityAnnotation dc:relation ?textAnnotation ."
+                   + "   ?entityAnnotation a enhancer:EntityAnnotation . "
+                   + "   ?entityAnnotation enhancer:entity-reference ?entity ."
+                   + "   ?entityAnnotation enhancer:entity-label ?entity_label 
."
+                   + "   ?entityAnnotation enhancer:confidence ?confidence . 
}" + "} ORDER BY ?text ";
         q = String.format(q, type);
 
         SelectQuery query = (SelectQuery) QueryParser.getInstance().parse(q);
         ResultSet result = tcManager.executeSparqlQuery(query, graph);
-        Map<String, EntityExtractionSummary> occurrenceMap = new 
TreeMap<String, EntityExtractionSummary>();
+        Map<String,EntityExtractionSummary> occurrenceMap = new 
TreeMap<String,EntityExtractionSummary>();
         LiteralFactory lf = LiteralFactory.getInstance();
         while (result.hasNext()) {
             SolutionMapping mapping = result.next();
@@ -221,14 +216,13 @@ public class ContentItemResource extends
 
             EntityExtractionSummary entity = occurrenceMap.get(text);
             if (entity == null) {
-                entity = new EntityExtractionSummary(text, type);
+                entity = new EntityExtractionSummary(text, type, 
defaultThumbnails);
                 occurrenceMap.put(text, entity);
             }
             UriRef entityUri = (UriRef) mapping.get("entity");
             if (entityUri != null) {
                 String label = ((Literal) 
mapping.get("entity_label")).getLexicalForm();
-                Double confidence = lf.createObject(Double.class,
-                        (TypedLiteral) mapping.get("confidence"));
+                Double confidence = lf.createObject(Double.class, 
(TypedLiteral) mapping.get("confidence"));
                 Graph properties = new GraphNode(entityUri, 
remoteEntityCache).getNodeContext();
                 entity.addSuggestion(entityUri, label, confidence, properties);
             }
@@ -236,8 +230,7 @@ public class ContentItemResource extends
         return occurrenceMap.values();
     }
 
-    public static class EntityExtractionSummary implements
-            Comparable<EntityExtractionSummary> {
+    public static class EntityExtractionSummary implements 
Comparable<EntityExtractionSummary> {
 
         protected final String name;
 
@@ -247,16 +240,18 @@ public class ContentItemResource extends
 
         protected List<String> mentions = new ArrayList<String>();
 
-        public EntityExtractionSummary(String name, UriRef type) {
+        public final Map<UriRef,String> defaultThumbnails;
+
+        public EntityExtractionSummary(String name, UriRef type, 
Map<UriRef,String> defaultThumbnails) {
             this.name = name;
             this.type = type;
             mentions.add(name);
+            this.defaultThumbnails = defaultThumbnails;
         }
 
-        public void addSuggestion(UriRef uri, String label, Double confidence,
-                TripleCollection properties) {
-            EntitySuggestion suggestion = new EntitySuggestion(uri, type,
-                    label, confidence, properties);
+        public void addSuggestion(UriRef uri, String label, Double confidence, 
TripleCollection properties) {
+            EntitySuggestion suggestion = new EntitySuggestion(uri, type, 
label, confidence, properties,
+                    defaultThumbnails);
             if (!suggestions.contains(suggestion)) {
                 suggestions.add(suggestion);
                 Collections.sort(suggestions);
@@ -288,13 +283,13 @@ public class ContentItemResource extends
 
         public String getThumbnailSrc() {
             if (suggestions.isEmpty()) {
-                return DEFAULT_THUMBNAILS.get(type);
+                return defaultThumbnails.get(type);
             }
             return suggestions.get(0).getThumbnailSrc();
         }
 
         public String getMissingThumbnailSrc() {
-            return DEFAULT_THUMBNAILS.get(type);
+            return defaultThumbnails.get(type);
         }
 
         public EntitySuggestion getBestGuess() {
@@ -337,8 +332,7 @@ public class ContentItemResource extends
         }
     }
 
-    public static class EntitySuggestion implements
-            Comparable<EntitySuggestion> {
+    public static class EntitySuggestion implements 
Comparable<EntitySuggestion> {
 
         protected final UriRef uri;
 
@@ -350,13 +344,20 @@ public class ContentItemResource extends
 
         protected TripleCollection entityProperties;
 
-        public EntitySuggestion(UriRef uri, UriRef type, String label,
-                Double confidence, TripleCollection entityProperties) {
+        protected final Map<UriRef,String> defaultThumbnails;
+
+        public EntitySuggestion(UriRef uri,
+                                UriRef type,
+                                String label,
+                                Double confidence,
+                                TripleCollection entityProperties,
+                                Map<UriRef,String> defaultThumbnails) {
             this.uri = uri;
             this.label = label;
             this.type = type;
             this.confidence = confidence;
             this.entityProperties = entityProperties;
+            this.defaultThumbnails = defaultThumbnails;
         }
 
         @Override
@@ -378,24 +379,22 @@ public class ContentItemResource extends
         }
 
         public String getThumbnailSrc() {
-            Iterator<Triple> abstracts = entityProperties.filter(uri,
-                    THUMBNAIL, null);
+            Iterator<Triple> abstracts = entityProperties.filter(uri, 
THUMBNAIL, null);
             while (abstracts.hasNext()) {
                 Resource object = abstracts.next().getObject();
                 if (object instanceof UriRef) {
                     return ((UriRef) object).getUnicodeString();
                 }
             }
-            return DEFAULT_THUMBNAILS.get(type);
+            return defaultThumbnails.get(type);
         }
 
         public String getMissingThumbnailSrc() {
-            return DEFAULT_THUMBNAILS.get(type);
+            return defaultThumbnails.get(type);
         }
 
         public String getSummary() {
-            Iterator<Triple> abstracts = entityProperties.filter(uri, SUMMARY,
-                    null);
+            Iterator<Triple> abstracts = entityProperties.filter(uri, SUMMARY, 
null);
             while (abstracts.hasNext()) {
                 Resource object = abstracts.next().getObject();
                 if (object instanceof PlainLiteral) {
@@ -420,18 +419,13 @@ public class ContentItemResource extends
 
         @Override
         public boolean equals(Object obj) {
-            if (this == obj)
-                return true;
-            if (obj == null)
-                return false;
-            if (getClass() != obj.getClass())
-                return false;
+            if (this == obj) return true;
+            if (obj == null) return false;
+            if (getClass() != obj.getClass()) return false;
             EntitySuggestion other = (EntitySuggestion) obj;
             if (uri == null) {
-                if (other.uri != null)
-                    return false;
-            } else if (!uri.equals(other.uri))
-                return false;
+                if (other.uri != null) return false;
+            } else if (!uri.equals(other.uri)) return false;
             return true;
         }
 
@@ -444,8 +438,7 @@ public class ContentItemResource extends
     /**
      * @return an RDF/JSON descriptions of places for the word map widget
      */
-    public String getPlacesAsJSON() throws ParseException,
-            UnsupportedEncodingException {
+    public String getPlacesAsJSON() throws ParseException, 
UnsupportedEncodingException {
         MGraph g = new SimpleMGraph();
         if (remoteEntityCache != null) {
             LiteralFactory lf = LiteralFactory.getInstance();
@@ -455,17 +448,15 @@ public class ContentItemResource extends
                     continue;
                 }
                 UriRef uri = new UriRef(bestGuess.getUri());
-                Iterator<Triple> latitudes = remoteEntityCache.filter(uri,
-                        GEO_LAT, null);
+                Iterator<Triple> latitudes = remoteEntityCache.filter(uri, 
GEO_LAT, null);
                 if (latitudes.hasNext()) {
                     g.add(latitudes.next());
                 }
-                Iterator<Triple> longitutes = remoteEntityCache.filter(uri,
-                        GEO_LONG, null);
+                Iterator<Triple> longitutes = remoteEntityCache.filter(uri, 
GEO_LONG, null);
                 if (longitutes.hasNext()) {
                     g.add(longitutes.next());
-                    g.add(new TripleImpl(uri, Properties.RDFS_LABEL,
-                            lf.createTypedLiteral(bestGuess.getLabel())));
+                    g.add(new TripleImpl(uri, Properties.RDFS_LABEL, 
lf.createTypedLiteral(bestGuess
+                            .getLabel())));
                 }
             }
         }
@@ -474,4 +465,10 @@ public class ContentItemResource extends
         return out.toString("utf-8");
     }
 
+    @GET
+    @Produces(TEXT_HTML)
+    public Response get() {
+        return Response.ok(new Viewable("index", this), TEXT_HTML).build();
+    }
+
 }

Modified: 
incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnginesRootResource.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnginesRootResource.java?rev=1088603&r1=1088602&r2=1088603&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnginesRootResource.java
 (original)
+++ 
incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnginesRootResource.java
 Mon Apr  4 13:02:49 2011
@@ -1,23 +1,6 @@
-/*
- * 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.stanbol.enhancer.jersey.resource;
 
 import static javax.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED;
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
 import static javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE;
 import static javax.ws.rs.core.MediaType.TEXT_HTML;
 import static javax.ws.rs.core.MediaType.TEXT_PLAIN;
@@ -26,8 +9,6 @@ import static org.apache.clerezza.rdf.co
 import static 
org.apache.clerezza.rdf.core.serializedform.SupportedFormat.RDF_XML;
 
 import java.io.IOException;
-import java.net.URI;
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
@@ -42,37 +23,35 @@ import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
 
 import org.apache.clerezza.rdf.core.MGraph;
 import org.apache.clerezza.rdf.core.TripleCollection;
 import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
 import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import org.apache.stanbol.commons.web.base.ContextHelper;
+import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
 import org.apache.stanbol.enhancer.jersey.cache.EntityCacheProvider;
 import org.apache.stanbol.enhancer.servicesapi.ContentItem;
 import org.apache.stanbol.enhancer.servicesapi.EngineException;
 import org.apache.stanbol.enhancer.servicesapi.EnhancementEngine;
 import org.apache.stanbol.enhancer.servicesapi.EnhancementJobManager;
 import org.apache.stanbol.enhancer.servicesapi.helper.InMemoryContentItem;
-import org.codehaus.jettison.json.JSONArray;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.sun.jersey.api.view.ImplicitProduces;
 import com.sun.jersey.api.view.Viewable;
 
 /**
- * RESTful interface to browse the list of available engines and allow to call
- * them in a stateless, synchronous way.
+ * RESTful interface to browse the list of available engines and allow to call 
them in a stateless,
+ * synchronous way.
  * <p>
- * If you need the content of the extractions to be stored on the server, use
- * the StoreRootResource API instead.
+ * If you need the content of the extractions to be stored on the server, use 
the StoreRootResource API
+ * instead.
  */
 @Path("/engines")
-@ImplicitProduces(TEXT_HTML + ";qs=2")
-public class EnginesRootResource extends NavigationMixin {
+public class EnginesRootResource extends BaseStanbolResource {
 
-    @SuppressWarnings("unused")
     private final Logger log = LoggerFactory.getLogger(getClass());
 
     protected EnhancementJobManager jobManager;
@@ -85,15 +64,27 @@ public class EnginesRootResource extends
 
     // bind the job manager by looking it up from the servlet request context
     public EnginesRootResource(@Context ServletContext context) {
-        jobManager = (EnhancementJobManager) 
context.getAttribute(EnhancementJobManager.class.getName());
-        tcManager = (TcManager) 
context.getAttribute(TcManager.class.getName());
-        serializer = (Serializer) 
context.getAttribute(Serializer.class.getName());
-        EntityCacheProvider entityCacheProvider = (EntityCacheProvider) 
context.getAttribute(EntityCacheProvider.class.getName());
-        if (entityCacheProvider != null) {
-            entityCache = entityCacheProvider.getEntityCache();
+        jobManager = 
ContextHelper.getServiceFromContext(EnhancementJobManager.class, context);
+        tcManager = ContextHelper.getServiceFromContext(TcManager.class, 
context);
+        serializer = ContextHelper.getServiceFromContext(Serializer.class, 
context);
+        entityCache = new SimpleMGraph().getGraph();
+        try {
+            EntityCacheProvider entityCacheProvider = 
ContextHelper.getServiceFromContext(
+                EntityCacheProvider.class, context);
+            if (entityCacheProvider != null) {
+                entityCache = entityCacheProvider.getEntityCache();
+            }
+        } catch (NullPointerException e) {
+            // service lookup can raise null pointer exception, fall back to 
empty cache
         }
     }
 
+    @GET
+    @Produces(TEXT_HTML)
+    public Response get() {
+        return Response.ok(new Viewable("index", this), TEXT_HTML).build();
+    }
+
     public List<EnhancementEngine> getActiveEngines() {
         if (jobManager != null) {
             return jobManager.getActiveEngines();
@@ -102,89 +93,56 @@ public class EnginesRootResource extends
         }
     }
 
-    private List<EnhancementEngine> getEngines() {
-        if (jobManager != null) {
-            return jobManager.getActiveEngines();
-        }
-        return new ArrayList<EnhancementEngine>();
-    }
-    
-    @GET
-    @Produces(APPLICATION_JSON)
-    public JSONArray getEnginesAsJsonArray() {
-        JSONArray uriArray = new JSONArray();
-        for (EnhancementEngine engine : getEngines()) {
-            UriBuilder ub = uriInfo.getAbsolutePathBuilder();
-            URI userUri = ub.path(makeEngineId(engine)).build();
-            uriArray.put(userUri.toASCIIString());
-        }
-        return uriArray;
-    }
-
-    @GET
-    @Produces(TEXT_PLAIN)
-    public String getEnginesAsString() {
-        final StringBuilder sb = new StringBuilder();
-        for (EnhancementEngine engine : getEngines()) {
-            sb.append(engine.getClass().getName());
-            sb.append("\n");
-        }
-        return sb.toString();
-    }
-
     public static String makeEngineId(EnhancementEngine engine) {
         // TODO: add a property on engines to provided custom local ids and 
make
         // this static method a method of the interface EnhancementEngine
         String engineClassName = engine.getClass().getSimpleName();
         String suffixToRemove = "EnhancementEngine";
         if (engineClassName.endsWith(suffixToRemove)) {
-            engineClassName = engineClassName.substring(0,
-                    engineClassName.length() - suffixToRemove.length());
+            engineClassName = engineClassName
+                    .substring(0, engineClassName.length() - 
suffixToRemove.length());
         }
         return engineClassName.toLowerCase();
     }
 
     /**
      * Form-based OpenCalais-compatible interface
-     *
-     * TODO: should we parse the OpenCalais paramsXML and find the closest 
-     * Stanbol Enhancer semantics too?
-     *
+     * 
+     * TODO: should we parse the OpenCalais paramsXML and find the closest 
Stanbol Enhancer semantics too?
+     * 
      * Note: the format parameter is not part of the official API
-     *
-     * @throws EngineException if the content is somehow corrupted
+     * 
+     * @throws EngineException
+     *             if the content is somehow corrupted
      * @throws IOException
      */
     @POST
     @Consumes(APPLICATION_FORM_URLENCODED)
     public Response enhanceFromForm(@FormParam("content") String content,
-            @FormParam("format") String format,
-            @FormParam("ajax") boolean buildAjaxview,
-            @Context HttpHeaders headers) throws EngineException, IOException {
-        if(content == null) {
-            throw new IllegalArgumentException("Content is null");
-        }
-        log.info("enhance from From: "+content);        
-        ContentItem ci = new InMemoryContentItem(
-                content.getBytes("UTF-8"),
-                TEXT_PLAIN);
+                                    @FormParam("format") String format,
+                                    @FormParam("ajax") boolean buildAjaxview,
+                                    @Context HttpHeaders headers) throws 
EngineException, IOException {
+        log.info("enhance from From: " + content);
+        ContentItem ci = new InMemoryContentItem(content.getBytes("UTF-8"), 
TEXT_PLAIN);
         return enhanceAndBuildResponse(format, headers, ci, buildAjaxview);
     }
 
     /**
      * Media-Type based handling of the raw POST data.
-     *
-     * @param data binary payload to analyze
-     * @param uri optional URI for the content items (to be used as an
-     *            identifier in the enhancement graph)
-     * @throws EngineException if the content is somehow corrupted
+     * 
+     * @param data
+     *            binary payload to analyze
+     * @param uri
+     *            optional URI for the content items (to be used as an 
identifier in the enhancement graph)
+     * @throws EngineException
+     *             if the content is somehow corrupted
      * @throws IOException
      */
     @POST
     @Consumes(WILDCARD)
     public Response enhanceFromData(byte[] data,
-            @QueryParam(value = "uri") String uri, @Context HttpHeaders 
headers)
-            throws EngineException, IOException {
+                                    @QueryParam(value = "uri") String uri,
+                                    @Context HttpHeaders headers) throws 
EngineException, IOException {
         String format = TEXT_PLAIN;
         if (headers.getMediaType() != null) {
             format = headers.getMediaType().toString();
@@ -198,27 +156,26 @@ public class EnginesRootResource extends
     }
 
     protected Response enhanceAndBuildResponse(String format,
-            HttpHeaders headers, ContentItem ci, boolean buildAjaxview)
-            throws EngineException, IOException {
+                                               HttpHeaders headers,
+                                               ContentItem ci,
+                                               boolean buildAjaxview) throws 
EngineException, IOException {
         if (jobManager != null) {
             jobManager.enhanceContent(ci);
         }
         MGraph graph = ci.getMetadata();
 
         if (buildAjaxview) {
-            ContentItemResource contentItemResource = new ContentItemResource(
-                    null, ci, entityCache, uriInfo, tcManager, serializer);
+            ContentItemResource contentItemResource = new 
ContentItemResource(null, ci, entityCache, uriInfo,
+                    tcManager, serializer, servletContext);
             contentItemResource.setRdfSerializationFormat(format);
-            Viewable ajaxView = new Viewable("/ajax/contentitem",
-                    contentItemResource);
+            Viewable ajaxView = new Viewable("/ajax/contentitem", 
contentItemResource);
             return Response.ok(ajaxView).type(TEXT_HTML).build();
         }
         if (format != null) {
             // force mimetype from form params
             return Response.ok(graph, format).build();
         }
-        if (headers.getAcceptableMediaTypes().contains(
-                APPLICATION_JSON_TYPE)) {
+        if (headers.getAcceptableMediaTypes().contains(APPLICATION_JSON_TYPE)) 
{
             // force RDF JSON media type (TODO: move this logic
             return Response.ok(graph, RDF_JSON).build();
         } else if (headers.getAcceptableMediaTypes().isEmpty()) {

Modified: 
incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/StoreRootResource.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/StoreRootResource.java?rev=1088603&r1=1088602&r2=1088603&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/StoreRootResource.java
 (original)
+++ 
incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/StoreRootResource.java
 Mon Apr  4 13:02:49 2011
@@ -1,5 +1,18 @@
 package org.apache.stanbol.enhancer.jersey.resource;
 
+import static javax.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED;
+import static javax.ws.rs.core.MediaType.APPLICATION_OCTET_STREAM_TYPE;
+import static javax.ws.rs.core.MediaType.MULTIPART_FORM_DATA;
+import static javax.ws.rs.core.MediaType.TEXT_HTML;
+import static javax.ws.rs.core.MediaType.TEXT_PLAIN_TYPE;
+import static javax.ws.rs.core.MediaType.WILDCARD;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.N3;
+import static 
org.apache.clerezza.rdf.core.serializedform.SupportedFormat.N_TRIPLE;
+import static 
org.apache.clerezza.rdf.core.serializedform.SupportedFormat.RDF_JSON;
+import static 
org.apache.clerezza.rdf.core.serializedform.SupportedFormat.RDF_XML;
+import static 
org.apache.clerezza.rdf.core.serializedform.SupportedFormat.TURTLE;
+import static 
org.apache.clerezza.rdf.core.serializedform.SupportedFormat.X_TURTLE;
+
 import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
@@ -30,7 +43,6 @@ import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.clerezza.rdf.core.MGraph;
@@ -39,7 +51,6 @@ import org.apache.clerezza.rdf.core.Trip
 import org.apache.clerezza.rdf.core.UriRef;
 import org.apache.clerezza.rdf.core.access.TcManager;
 import org.apache.clerezza.rdf.core.serializedform.Serializer;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
 import org.apache.clerezza.rdf.core.sparql.ParseException;
 import org.apache.clerezza.rdf.core.sparql.QueryParser;
 import org.apache.clerezza.rdf.core.sparql.ResultSet;
@@ -47,6 +58,8 @@ import org.apache.clerezza.rdf.core.spar
 import org.apache.clerezza.rdf.core.sparql.query.SelectQuery;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
+import org.apache.stanbol.commons.web.base.ContextHelper;
+import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
 import org.apache.stanbol.enhancer.jersey.cache.EntityCacheProvider;
 import org.apache.stanbol.enhancer.servicesapi.ContentItem;
 import org.apache.stanbol.enhancer.servicesapi.EngineException;
@@ -60,10 +73,6 @@ import org.slf4j.LoggerFactory;
 import com.sun.jersey.api.view.Viewable;
 import com.sun.jersey.core.header.FormDataContentDisposition;
 
-
-import static javax.ws.rs.core.MediaType.*;
-import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.*;
-
 /**
  * Resource to provide a CRU[D] REST API for content items and there related
  * enhancements.
@@ -80,7 +89,7 @@ import static org.apache.clerezza.rdf.co
  * The Delete operation is not implemented yet.
  */
 @Path("/store")
-public class StoreRootResource extends NavigationMixin {
+public class StoreRootResource extends BaseStanbolResource {
 
     public static final Set<String> RDF_MEDIA_TYPES = new TreeSet<String>(
             Arrays.asList(N3, N_TRIPLE, RDF_XML, TURTLE, X_TURTLE, RDF_JSON));
@@ -141,21 +150,21 @@ public class StoreRootResource extends N
     }
 
     public StoreRootResource(@Context ServletContext context,
-            @Context UriInfo uriInfo, @QueryParam(value = "offset") int offset,
-            @QueryParam(value = "pageSize") @DefaultValue("5") int pageSize)
-            throws ParseException {
-        tcManager = (TcManager) 
context.getAttribute(TcManager.class.getName());
-        store = (Store) context.getAttribute(Store.class.getName());
-        jobManager = (EnhancementJobManager) 
context.getAttribute(EnhancementJobManager.class.getName());
-        serializer = (Serializer) 
context.getAttribute(Serializer.class.getName());
-        EntityCacheProvider entityCacheProvider = (EntityCacheProvider) 
context.getAttribute(EntityCacheProvider.class.getName());
+                             @Context UriInfo uriInfo,
+                             @QueryParam(value = "offset") int offset,
+                             @QueryParam(value = "pageSize") 
@DefaultValue("5") int pageSize) throws ParseException {
+        store = ContextHelper.getServiceFromContext(Store.class, context);
+        jobManager = 
ContextHelper.getServiceFromContext(EnhancementJobManager.class, context);
+        tcManager = ContextHelper.getServiceFromContext(TcManager.class, 
context);
+        serializer = ContextHelper.getServiceFromContext(Serializer.class, 
context);
+        EntityCacheProvider entityCacheProvider = 
ContextHelper.getServiceFromContext(
+            EntityCacheProvider.class, context);
         if (entityCacheProvider != null) {
             entityCache = entityCacheProvider.getEntityCache();
         }
 
         if (store == null || tcManager == null) {
-            log.error("Missing either store={} or tcManager={}", store,
-                    tcManager);
+            log.error("Missing either store={} or tcManager={}", store, 
tcManager);
             throw new WebApplicationException(404);
         }
         this.uriInfo = uriInfo;
@@ -259,20 +268,20 @@ public class StoreRootResource extends N
         // handle smart redirection to browser view
         for (MediaType mt : headers.getAcceptableMediaTypes()) {
             if (mt.toString().startsWith(TEXT_HTML)) {
-                return Response.temporaryRedirect(
-                        UriBuilder.fromPath("/store/page/" + 
localId).build()).build();
+                URI pageUri = 
uriInfo.getBaseUriBuilder().path("/store/page").path(localId).build();
+                return Response.temporaryRedirect(pageUri).build();
             }
         }
 
         // handle smart redirection to RDF metadata view
         for (MediaType mt : headers.getAcceptableMediaTypes()) {
             if (RDF_MEDIA_TYPES.contains(mt.toString())) {
-                return Response.temporaryRedirect(
-                        UriBuilder.fromPath("/store/metadata/" + 
localId).build()).build();
+                URI metadataUri = 
uriInfo.getBaseUriBuilder().path("/store/metadata").path(localId).build();
+                return Response.temporaryRedirect(metadataUri).build();
             }
         }
-        return Response.temporaryRedirect(
-                UriBuilder.fromPath("/store/raw/" + localId).build()).build();
+        URI rawUri = 
uriInfo.getBaseUriBuilder().path("/store/raw").path(localId).build();
+        return Response.temporaryRedirect(rawUri).build();
     }
 
     @GET
@@ -297,7 +306,7 @@ public class StoreRootResource extends N
             throw new WebApplicationException(404);
         }
         return new ContentItemResource(localId, ci, entityCache, uriInfo,
-                tcManager, serializer);
+                tcManager, serializer, servletContext);
     }
 
     @GET


Reply via email to