svn commit: r581244 - /lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/cms/publication/util/OutgoingLinkRewriter.java

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Tue Oct  2 07:01:49 2007
New Revision: 581244

URL: http://svn.apache.org/viewvc?rev=581244&view=rev
Log:
Obtain context path only if necessary

Modified:
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/cms/publication/util/OutgoingLinkRewriter.java

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/cms/publication/util/OutgoingLinkRewriter.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/cms/publication/util/OutgoingLinkRewriter.java?rev=581244&r1=581243&r2=581244&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/cms/publication/util/OutgoingLinkRewriter.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/cms/publication/util/OutgoingLinkRewriter.java Tue Oct  2 07:01:49 2007
@@ -61,7 +61,7 @@
         URLInformation info = new URLInformation(webappUrl);
         String pubId = info.getPublicationId();
         String area = info.getArea();
-        
+
         String proxyUrl = null;
 
         if (pubId != null && area != null) {
@@ -70,7 +70,6 @@
                 contextUtil = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
                 Request request = ObjectModelHelper.getRequest(contextUtil.getObjectModel());
                 Context context = ObjectModelHelper.getContext(contextUtil.getObjectModel());
-                String contextPath = request.getContextPath();
                 String servletContextPath = context.getRealPath("");
                 Publication pub = PublicationFactory.getPublication(pubId, servletContextPath);
 
@@ -81,7 +80,7 @@
                     if (proxy != null) {
                         proxyUrl = proxy.getURL(doc);
                     } else {
-                    		webappUrl = contextPath + webappUrl;
+                        webappUrl = request.getContextPath() + webappUrl;
                     }
                 }
 
@@ -93,7 +92,7 @@
                 }
             }
         }
-        
+
         return proxyUrl != null ? proxyUrl : webappUrl;
 
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.