You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by og...@apache.org on 2011/03/31 12:39:57 UTC

svn commit: r1087244 - in /incubator/stanbol/branches/http-endpoint-refactoring/commons/web: base/src/main/java/org/apache/stanbol/commons/web/base/ base/src/main/java/org/apache/stanbol/commons/web/base/resource/ home/src/main/resources/org/apache/sta...

Author: ogrisel
Date: Thu Mar 31 10:39:56 2011
New Revision: 1087244

URL: http://svn.apache.org/viewvc?rev=1087244&view=rev
Log:
STANBOL-120: more fixes for dynamic links

Modified:
    incubator/stanbol/branches/http-endpoint-refactoring/commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/JerseyEndpoint.java
    incubator/stanbol/branches/http-endpoint-refactoring/commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/resource/BaseStanbolResource.java
    incubator/stanbol/branches/http-endpoint-refactoring/commons/web/home/src/main/resources/org/apache/stanbol/commons/web/home/templates/imports/common.ftl

Modified: incubator/stanbol/branches/http-endpoint-refactoring/commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/JerseyEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/http-endpoint-refactoring/commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/JerseyEndpoint.java?rev=1087244&r1=1087243&r2=1087244&view=diff
==============================================================================
--- incubator/stanbol/branches/http-endpoint-refactoring/commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/JerseyEndpoint.java (original)
+++ incubator/stanbol/branches/http-endpoint-refactoring/commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/JerseyEndpoint.java Thu Mar 31 10:39:56 2011
@@ -102,6 +102,7 @@ public class JerseyEndpoint {
         // services
         servletContext = container.getServletContext();
         servletContext.setAttribute(BundleContext.class.getName(), ctx.getBundleContext());
+        servletContext.setAttribute(BaseStanbolResource.ROOT_URL, applicationAlias);
         servletContext.setAttribute(BaseStanbolResource.STATIC_RESOURCES_ROOT_URL, staticUrlRoot);
         servletContext.setAttribute(BaseStanbolResource.LINK_RESOURCES, linkResources);
         servletContext.setAttribute(BaseStanbolResource.SCRIPT_RESOURCES, scriptResources);

Modified: incubator/stanbol/branches/http-endpoint-refactoring/commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/resource/BaseStanbolResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/http-endpoint-refactoring/commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/resource/BaseStanbolResource.java?rev=1087244&r1=1087243&r2=1087244&view=diff
==============================================================================
--- incubator/stanbol/branches/http-endpoint-refactoring/commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/resource/BaseStanbolResource.java (original)
+++ incubator/stanbol/branches/http-endpoint-refactoring/commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/resource/BaseStanbolResource.java Thu Mar 31 10:39:56 2011
@@ -19,11 +19,13 @@ import org.apache.stanbol.commons.web.ba
  */
 public class BaseStanbolResource {
 
-    public static final String LINK_RESOURCES = "org.apache.stanbol.commons.web.resource.links";
+    public static final String LINK_RESOURCES = "org.apache.stanbol.commons.web.base.resource.links";
 
-    public static final String SCRIPT_RESOURCES = "org.apache.stanbol.commons.web.resource.scripts";
+    public static final String SCRIPT_RESOURCES = "org.apache.stanbol.commons.web.base.resource.scripts";
 
-    public static final String STATIC_RESOURCES_ROOT_URL = "org.apache.stanbol.commons.web.resource.static.url.root";
+    public static final String STATIC_RESOURCES_ROOT_URL = "org.apache.stanbol.commons.web.base.resource.static.root";
+
+    public static final String ROOT_URL = "org.apache.stanbol.commons.web.base.root";
 
     @Context
     protected UriInfo uriInfo;
@@ -36,8 +38,9 @@ public class BaseStanbolResource {
     }
 
     public List<MenuItem> getMainMenuItems() {
-        return Arrays.asList(new MenuItem("/engines", "/engines", uriInfo), new MenuItem("/store", "/store",
-                uriInfo), new MenuItem("/sparql", "/sparql", uriInfo));
+        return Arrays.asList(new MenuItem("/engines", getRootUrl() + "/engines", uriInfo), new MenuItem(
+                "/store", getRootUrl() + "/store", uriInfo), new MenuItem("/sparql",
+                getRootUrl() + "/sparql", uriInfo));
     }
 
     public static class MenuItem {
@@ -68,6 +71,10 @@ public class BaseStanbolResource {
 
     }
 
+    public String getRootUrl() {
+        return (String) servletContext.getAttribute(ROOT_URL);
+    }
+    
     public String getStaticRootUrl() {
         return (String) servletContext.getAttribute(STATIC_RESOURCES_ROOT_URL);
     }

Modified: incubator/stanbol/branches/http-endpoint-refactoring/commons/web/home/src/main/resources/org/apache/stanbol/commons/web/home/templates/imports/common.ftl
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/http-endpoint-refactoring/commons/web/home/src/main/resources/org/apache/stanbol/commons/web/home/templates/imports/common.ftl?rev=1087244&r1=1087243&r2=1087244&view=diff
==============================================================================
--- incubator/stanbol/branches/http-endpoint-refactoring/commons/web/home/src/main/resources/org/apache/stanbol/commons/web/home/templates/imports/common.ftl (original)
+++ incubator/stanbol/branches/http-endpoint-refactoring/commons/web/home/src/main/resources/org/apache/stanbol/commons/web/home/templates/imports/common.ftl Thu Mar 31 10:39:56 2011
@@ -6,8 +6,8 @@
     <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
 
     <!-- to be moved in the dedicated fragment -->
-    <link rel="stylesheet" href="/static/home/style/stanbol.css" />
-    <link rel="icon" type="image/png" href="/static/home/images/favicon.png" />
+    <link rel="stylesheet" href="${it.staticRootUrl}/home/style/stanbol.css" />
+    <link rel="icon" type="image/png" href="${it.staticRootUrl}/home/images/favicon.png" />
 
     <#list it.registeredLinkResources as link>
     <link rel="${link.rel}" href="${it.staticRootUrl}/${link.fragmentName}/${link.relativePath}" />
@@ -20,7 +20,7 @@
   </head>
 
   <body>
-    <div class="home"><a href="/"><img src="/static/home/images/apache_stanbol_logo_cropped.png" alt="Stanbol Home" /></a></div>
+    <div class="home"><a href="${it.rootUrl}"><img src="${it.staticRootUrl}/home/images/apache_stanbol_logo_cropped.png" alt="Stanbol Home" /></a></div>
     <div class="header">
       <h1>The RESTful Semantic Engine</h1>
 
@@ -63,9 +63,9 @@ $(".restapitabs a").click(function () {
 
     <div class="column">
       <a href="http://www.w3.org/standards/semanticweb/"><img class="swcube"
-        src="/static/home/images/sw-cube.png"/></a>
+        src="${it.staticRootUrl}/home/images/sw-cube.png"/></a>
       <a href="http://www.iks-project.eu"><img
-        height="60px" alt="IKS Project" src="/static/home/images/iks_project_logo.jpg" /></a>
+        height="60px" alt="IKS Project" src="${it.staticRootUrl}/home/images/iks_project_logo.jpg" /></a>
     </div>
     <div class="column right">
       <em>The research leading to these results has received funding from the European Community's