You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rw...@apache.org on 2012/07/06 10:34:55 UTC
svn commit: r1358074 - in /incubator/stanbol/trunk:
commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/resource/
commons/web/home/src/main/resources/org/apache/stanbol/commons/web/home/templates/org/apache/stanbol/commons/web/home/resou...
Author: rwesten
Date: Fri Jul 6 08:34:54 2012
New Revision: 1358074
URL: http://svn.apache.org/viewvc?rev=1358074&view=rev
Log:
fixes STANBOL-671: Applied the latest path attached to this Issue and also modified the Web UI of the Stanbol Enhancer to use this new functionality.
Modified:
incubator/stanbol/trunk/commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/resource/BaseStanbolResource.java
incubator/stanbol/trunk/commons/web/home/src/main/resources/org/apache/stanbol/commons/web/home/templates/org/apache/stanbol/commons/web/home/resource/StanbolRootResource/index.ftl
incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/imports/enhancerweb.ftl
incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/ChainsRootResource/index.ftl
incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancementEngineResource/index.ftl
incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancementEnginesRootResource/index.ftl
Modified: incubator/stanbol/trunk/commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/resource/BaseStanbolResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/resource/BaseStanbolResource.java?rev=1358074&r1=1358073&r2=1358074&view=diff
==============================================================================
--- incubator/stanbol/trunk/commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/resource/BaseStanbolResource.java (original)
+++ incubator/stanbol/trunk/commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/resource/BaseStanbolResource.java Fri Jul 6 08:34:54 2012
@@ -23,8 +23,10 @@ import java.util.List;
import javax.servlet.ServletContext;
import javax.ws.rs.core.Context;
+import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
+import org.apache.commons.io.FilenameUtils;
import org.apache.stanbol.commons.web.base.LinkResource;
import org.apache.stanbol.commons.web.base.NavigationLink;
import org.apache.stanbol.commons.web.base.ScriptResource;
@@ -45,6 +47,8 @@ public class BaseStanbolResource {
public static final String NAVIGATION_LINKS = "org.apache.stanbol.commons.web.base.navigation.link";
public static final String ROOT_URL = "org.apache.stanbol.commons.web.base.root";
+
+ public static final String SYSTEM_CONSOLE = "system/console";
@Context
protected UriInfo uriInfo;
@@ -59,6 +63,31 @@ public class BaseStanbolResource {
public URI getPublicBaseUri() {
return uriInfo.getBaseUri();
}
+ /**
+ * The Apache Felix Webconsole base URL does not depend on alias configured
+ * for the Stanbol JerseyEndpoint. However they is affected by the base
+ * path of the Servlet when Stanbol is running as WAR within a web container.<p>
+ * <i>LIMITATION</i> this does not take into account the path configured
+ * for the Apache Felix Webconsole (property: <code>manager.root</code>
+ * class: <code>org.apache.felix.webconsole.internal.servlet.OsgiManager</code>)
+ * Because of this it will only work with the default {@link #SYSTEM_CONSOLE}.
+ * @return The URI for the Apache Felix Webconsole
+ */
+ public URI getConsoleBaseUri() {
+ String root = getRootUrl();
+ UriBuilder consolePathBuilder;
+ if(root != null && !root.isEmpty() && !"/".equals(root)){
+ String request = uriInfo.getRequestUri().toString();
+ int alaiasIndex = request.lastIndexOf(root);
+ if(alaiasIndex > 0){
+ request = request.substring(0,request.lastIndexOf(root));
+ }
+ consolePathBuilder = UriBuilder.fromUri(request);
+ } else {
+ consolePathBuilder = uriInfo.getRequestUriBuilder();
+ }
+ return consolePathBuilder.path(SYSTEM_CONSOLE).build();
+ }
/**
* @return the sorted list of navigation links data transfer objects
Modified: incubator/stanbol/trunk/commons/web/home/src/main/resources/org/apache/stanbol/commons/web/home/templates/org/apache/stanbol/commons/web/home/resource/StanbolRootResource/index.ftl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/home/src/main/resources/org/apache/stanbol/commons/web/home/templates/org/apache/stanbol/commons/web/home/resource/StanbolRootResource/index.ftl?rev=1358074&r1=1358073&r2=1358074&view=diff
==============================================================================
--- incubator/stanbol/trunk/commons/web/home/src/main/resources/org/apache/stanbol/commons/web/home/templates/org/apache/stanbol/commons/web/home/resource/StanbolRootResource/index.ftl (original)
+++ incubator/stanbol/trunk/commons/web/home/src/main/resources/org/apache/stanbol/commons/web/home/templates/org/apache/stanbol/commons/web/home/resource/StanbolRootResource/index.ftl Fri Jul 6 08:34:54 2012
@@ -38,7 +38,7 @@ view that documents the matching RESTful
</#if>
</#list>
- <dt><a href="system/console">/system/console</a><dt>
+ <dt><a href="${it.consoleBaseUri}">/system/console</a><dt>
<dd>
<p>This is the OSGi administration console (for administrators and developers). The initial
username / password is set to <em>admin / admin</em>.</p>
@@ -48,7 +48,7 @@ view that documents the matching RESTful
source folder and run the following command:</p>
<pre>
mvn install -o -DskipTests -PinstallBundle \
- -Dsling.url=${it.publicBaseUri}system/console
+ -Dsling.url=${it.consoleBaseUri}
</pre>
</dd>
Modified: incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/imports/enhancerweb.ftl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/imports/enhancerweb.ftl?rev=1358074&r1=1358073&r2=1358074&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/imports/enhancerweb.ftl (original)
+++ incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/imports/enhancerweb.ftl Fri Jul 6 08:34:54 2012
@@ -18,11 +18,11 @@
<#if !it.executionNodes??>
<p><em>There seams to be a problem with the Enhancement Chain <b>${it.chain.name}</b>.
To fix this an Administrator needs to install, configure and enable enhancement
- chains and -engines by using the <a href="/system/console">OSGi console</a>.</em></p>
+ chains and -engines by using the <a href="${it.consoleBaseUri}">OSGi console</a>.</em></p>
<#elseif it.executionNodes?size == 0>
<p><em>There is no active engines for Enhancement Chain <b>${it.chain.name}</b>.
Administrators can install, configure and enable enhancement chains and
- -engines by using the <a href="/system/console">OSGi console</a>.</em></p>
+ -engines by using the <a href="${it.consoleBaseUri}">OSGi console</a>.</em></p>
<#else>
<#assign executionNodes = it.executionNodes>
<div class="enginelisting">
Modified: incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/ChainsRootResource/index.ftl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/ChainsRootResource/index.ftl?rev=1358074&r1=1358073&r2=1358074&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/ChainsRootResource/index.ftl (original)
+++ incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/ChainsRootResource/index.ftl Fri Jul 6 08:34:54 2012
@@ -31,7 +31,7 @@ Currently the following Chains are avail
id: ${it.getServiceId(name)}, ranking: ${it.getServiceRanking(name)},
impl: ${chain.class.simpleName}
)<#if it.getServicePid(name)??>:
- <a href="/system/console/configMgr/${it.getServicePid(name)}">configure</a></#if>
+ <a href="${it.consoleBaseUri}/configMgr/${it.getServicePid(name)}">configure</a></#if>
</#list>
</ul>
<p>Enhancement Request for the <a href="${it.publicBaseUri}enhancer">
@@ -44,7 +44,7 @@ and the highest <code>service.ranking</c
(regardless of the name).<p>
<p class="note">
-You can configure Chains by using the the <a href="/system/console/configMgr">
+You can configure Chains by using the the <a href="${it.consoleBaseUri}/configMgr">
Configuration Tab</a> of the OSGi console.</p>
</div>
Modified: incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancementEngineResource/index.ftl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancementEngineResource/index.ftl?rev=1358074&r1=1358073&r2=1358074&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancementEngineResource/index.ftl (original)
+++ incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancementEngineResource/index.ftl Fri Jul 6 08:34:54 2012
@@ -27,7 +27,7 @@
<li> service.id : ${it.id}
<li> service.ranking: ${it.ranking}
</ul>
-<p class="note"> You can <a href="/system/console/configMgr/${it.pid}">
+<p class="note"> You can <a href=${it.consoleBaseUri}/configMgr/${it.pid}">
configure this engine</a> by using the the Configuration Tab of the OSGi console.</p>
<#--
Modified: incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancementEnginesRootResource/index.ftl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancementEnginesRootResource/index.ftl?rev=1358074&r1=1358073&r2=1358074&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancementEnginesRootResource/index.ftl (original)
+++ incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancementEnginesRootResource/index.ftl Fri Jul 6 08:34:54 2012
@@ -29,7 +29,7 @@
(id: ${it.getServiceId(name)}, ranking: ${it.getServiceRanking(name)},
impl: ${engine.class.simpleName}
)<#if it.getServicePid(name)??>:
- <a href="/system/console/configMgr/${it.getServicePid(name)}">configure</a></#if>
+ <a href="${it.consoleBaseUri}/configMgr/${it.getServicePid(name)}">configure</a></#if>
</#list>
</ul>
<p>
@@ -37,7 +37,7 @@ EnhancementEngines are used to define <a
Enhancement Chains</a> that can than be used to enhance content parsed to the
Stanbol Enhancer.</p>
<p class="note"> You can configure Chains by using the the
-<a href="/system/console/configMgr">Configuration Tab</a> of the OSGi console.</p>
+<a href="${it.consoleBaseUri}/configMgr">Configuration Tab</a> of the OSGi console.</p>
</div>
<div class="panel" id="restapi" style="display: none;">