You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2004/08/13 14:24:44 UTC

svn commit: rev 36338 - cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/environment/portlet

Author: vgritsenko
Date: Fri Aug 13 05:24:44 2004
New Revision: 36338

Modified:
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/environment/portlet/PortletRequest.java
Log:
Implement getRequstURI


Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/environment/portlet/PortletRequest.java
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/environment/portlet/PortletRequest.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/environment/portlet/PortletRequest.java	Fri Aug 13 05:24:44 2004
@@ -41,7 +41,7 @@
  *
  * @author <a href="mailto:alex.rudnev@dc.gov">Alex Rudnev</a>
  * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
- * @version CVS $Id: PortletRequest.java,v 1.6 2004/07/12 13:27:57 cziegeler Exp $
+ * @version CVS $Id$
  */
 public abstract class PortletRequest implements Request {
 
@@ -71,7 +71,7 @@
     protected String portletRequestURI;
 
     private final Map attributes = new HashMap();
-    
+
     /**
      * Creates a PortletRequest based on a real PortletRequest object
      */
@@ -234,22 +234,25 @@
     }
 
     public String getRequestURI() {
-        // TODO: getRequestURI
         if (this.portletRequestURI == null) {
-            this.portletRequestURI = this.request.getContextPath();
-            /*
-            this.portletRequestURI = this.request.getRequestURI();
-            if (this.portletRequestURI.equals("/")) {
-                String s = this.request.getServletPath();
-                final StringBuffer buffer = new StringBuffer();
-                if (null != s)
-                    buffer.append(s);
-                s = this.request.getPathInfo();
-                if (null != s)
-                    buffer.append(s);
-                this.portletRequestURI = buffer.toString();
+            final StringBuffer buffer = new StringBuffer();
+            buffer.append(this.request.getContextPath());
+
+            if (getServletPath() != null) {
+                if (buffer.charAt(buffer.length()-1) != '/') {
+                    buffer.append('/');
+                }
+                buffer.append(getServletPath());
             }
-            */
+
+            if (getPathInfo() != null) {
+                if (buffer.charAt(buffer.length()-1) != '/') {
+                    buffer.append('/');
+                }
+                buffer.append(getPathInfo());
+            }
+
+            this.portletRequestURI = buffer.toString();
         }
         return this.portletRequestURI;
     }
@@ -498,21 +501,21 @@
     public Object getAttribute(String name) {
         return this.getAttribute(name, Request.GLOBAL_SCOPE);
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.cocoon.environment.Request#getAttributeNames()
      */
     public Enumeration getAttributeNames() {
         return this.getAttributeNames(Request.GLOBAL_SCOPE);
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.cocoon.environment.Request#setAttribute(java.lang.String, java.lang.Object)
      */
     public void setAttribute(String name, Object value) {
         this.setAttribute(name, value, Request.GLOBAL_SCOPE);
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.cocoon.environment.Request#removeAttribute(java.lang.String)
      */
@@ -530,7 +533,7 @@
             return this.request.getAttribute(name);
         }
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.cocoon.environment.Request#getAttributeNames(int)
      */
@@ -541,7 +544,7 @@
             return this.request.getAttributeNames();
         }
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.cocoon.environment.Request#setAttribute(java.lang.String, java.lang.Object, int)
      */
@@ -552,7 +555,7 @@
             this.request.setAttribute(name, value);
         }
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.cocoon.environment.Request#removeAttribute(java.lang.String, int)
      */
@@ -563,5 +566,5 @@
             this.request.removeAttribute(name);
         }
     }
-    
+
 }