Author: dolander
Date: Thu Aug 12 13:45:16 2004
New Revision: 36297

Modified:
   
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/PageflowTagUtils.java
   
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/URLRewriterService.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Anchor.java
Log:
Fix for an error applying security to an action with a context path on it.




Modified: 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/PageflowTagUtils.java
==============================================================================
--- 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/PageflowTagUtils.java
     (original)
+++ 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/PageflowTagUtils.java
     Thu Aug 12 13:45:16 2004
@@ -80,7 +80,7 @@
 
         String templateType = URLRewriter.ACTION_UNSECURE;
 
-        if (URLRewriterService.needsSecure(request, servletContext, url, 
false))
+        if (URLRewriterService.needsSecure(request, servletContext, url, true))
             templateType = URLRewriter.ACTION_SECURE;
 
         url = URLRewriterService.rewriteURL(servletContext, request, response, 
url, templateType);
@@ -109,6 +109,7 @@
 
         String templateType = URLRewriter.RESOURCE_UNSECURE;
 
+        if (URLRewriterService.needsSecure(request, servletContext, url, true))
         if (URLRewriterService.needsSecure(request, servletContext, url, true))
             templateType = URLRewriter.RESOURCE_SECURE;
 

Modified: 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/URLRewriterService.java
==============================================================================
--- 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/URLRewriterService.java
   (original)
+++ 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/URLRewriterService.java
   Thu Aug 12 13:45:16 2004
@@ -239,12 +239,13 @@
         String secureCheck = uri;
         if (stripContextPath)
         {
-            if (secureCheck.substring(1).indexOf("/") > -1)
-            {
-                secureCheck = secureCheck.substring(1);
-                secureCheck = secureCheck.substring(secureCheck.indexOf("/"));
-            }
-        }
+            String contextPath = 
((HttpServletRequest)request).getContextPath();
+
+             if (secureCheck.startsWith(contextPath))
+             {
+                 secureCheck = secureCheck.substring(contextPath.length());
+             }
+         }
         boolean secure = false;
         if (secureCheck.indexOf("?") > -1)
         {

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Anchor.java
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Anchor.java
  (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Anchor.java
  Thu Aug 12 13:45:16 2004
@@ -715,7 +715,7 @@
                 // simply set this to the result of mangling the action
                 String actionUrl = PageflowTagUtils.getActionPath(pageContext, 
_action);
                 if (URLRewriterService.needsSecure(request, ctxt,
-                        actionUrl, false))
+                        actionUrl, true))
                     type = URLRewriter.ACTION_SECURE;
 
                 internalHref = PageflowTagUtils.createActionURL(pageContext, 
_action);

Reply via email to