You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by jo...@apache.org on 2006/03/23 16:04:48 UTC

svn commit: r388186 - /lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/LinkRewriterImpl.java

Author: josias
Date: Thu Mar 23 07:04:27 2006
New Revision: 388186

URL: http://svn.apache.org/viewcvs?rev=388186&view=rev
Log:
removed context path, because internal links don't contain the context path anymore. this makes link-rewriting work with deployment outside of the root context.

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/LinkRewriterImpl.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/LinkRewriterImpl.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/LinkRewriterImpl.java?rev=388186&r1=388185&r2=388186&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/LinkRewriterImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/LinkRewriterImpl.java Thu Mar 23 07:04:27 2006
@@ -86,12 +86,10 @@
         }
 
         Request request = ObjectModelHelper.getRequest(this.objectModel);
-        String contextPath = request.getContextPath();
 
         if (getLogger().isDebugEnabled()) {
             getLogger().debug("Rewriting source: [" + originalTargetDocument + "]");
             getLogger().debug("Rewriting target: [" + newTargetDocument + "]");
-            getLogger().debug("Rewriting context path: [" + contextPath + "]");
         }
 
         try {
@@ -139,8 +137,8 @@
                                         getLogger().debug("Rewriting: Check URL [" + url + "]");
                                     }
 
-                                    if (url.startsWith(contextPath + "/" + publication.getId())) {
-                                        final String webappUrl = url.substring(contextPath.length());
+                                    if (url.startsWith("/" + publication.getId())) {
+                                        final String webappUrl = url;
                                         if (identityMap.isDocument(webappUrl)) {
                                             Document targetDocument = identityMap.getFromURL(webappUrl);
                                             if (getLogger().isDebugEnabled()) {
@@ -156,7 +154,7 @@
                                                     getLogger().debug("Rewrite URL [" + webappUrl
                                                             + "] to [" + newTargetUrl + "]");
                                                 }
-                                                attribute.setValue(contextPath + newTargetUrl);
+                                                attribute.setValue(newTargetUrl);
                                                 linksRewritten = true;
                                             }
                                         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org