You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ri...@apache.org on 2005/02/23 21:22:18 UTC

svn commit: r155064 - in incubator/beehive/trunk/netui/src: pageflow/org/apache/beehive/netui/pageflow/ pageflow/org/apache/beehive/netui/pageflow/internal/ pageflow/org/apache/beehive/netui/pageflow/util/ tags-html/org/apache/beehive/netui/tags/ tags-html/org/apache/beehive/netui/tags/html/ tags-html/org/apache/beehive/netui/tags/javascript/ util/org/apache/beehive/netui/core/urls/

Author: rich
Date: Wed Feb 23 12:22:14 2005
New Revision: 155064

URL: http://svn.apache.org/viewcvs?view=rev&rev=155064
Log:
This is a contribution from Carlin Rogers to address http://issues.apache.org/jira/browse/BEEHIVE-251 : Change URLRewriterService method rewriteName() to just get the name prefix without requiring the name argument

Thanks Carlin!

DRT/BVT: netui (WinXP)
BB: self (linux)


Modified:
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowConstants.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultURLRewriter.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/OldURLRewriterWrapper.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/AbstractClassicTag.java
    incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java
    incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java
    incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/javaScript.properties
    incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urls/URLRewriter.java
    incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urls/URLRewriterService.java

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowConstants.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowConstants.java?view=diff&r1=155063&r2=155064
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowConstants.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowConstants.java Wed Feb 23 12:22:14 2005
@@ -98,13 +98,30 @@
     public static final String FORWARD_OVERFLOW_COUNT_PARAM = "jpf-forward-overflow-count";
     
     /**
-     * Servlet context-param that configures the maximum depth of the page flow nesting stack.
+     * Servlet context-param that configures the maximum depth of the Page Flow nesting stack.
      * 
      * @deprecated Instead of this context-param, use the <code>max-nesting-stack-depth</code> element within
      *             <code>pageflow-config</code> in /WEB-INF/netui-config.xml.
      */ 
     public static final String NESTING_OVERFLOW_COUNT_PARAM = "jpf-nesting-overflow-count";
     
+    /**
+     * Default value for the maximum number of consecutive server forwards before error.
+     * 
+     * @deprecated This constant will be removed without replacement in a future release.  The value is read from
+     *     netui-config.xsd (the schema for netui-config.xml).
+     */ 
+    public static final int DEFAULT_FORWARD_OVERFLOW_COUNT = 50;
+    
+    /**
+     * Default value for the maximum depth of the Page Flow nesting stack.
+     * 
+     * @deprecated This constant will be removed without replacement in a future release.  The value is read from
+     *     netui-config.xsd (the schema for netui-config.xml).
+     */ 
+    public static final int DEFAULT_NESTING_OVERFLOW_COUNT = 25;
+
+     
     /**
      * Servlet context-param that configures whether to apply security constraints on server forwards to page
      * flow actions.  Normally, security constraints are not applied on server forwards.

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java?view=diff&r1=155063&r2=155064
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java Wed Feb 23 12:22:14 2005
@@ -1666,7 +1666,7 @@
             String hash = Integer.toString( request.hashCode() );
             String key = makeRedirectedRequestAttrsKey( webappRelativeURI, hash );
             request.getSession().setAttribute( key, attrs );
-            queryString = URLRewriterService.getNamePrefix( servletContext, request )
+            queryString = URLRewriterService.getNamePrefix( servletContext, request, REDIRECT_REQUEST_ATTRS_PARAM )
                           + REDIRECT_REQUEST_ATTRS_PARAM + '=' + hash;
         }
 

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultURLRewriter.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultURLRewriter.java?view=diff&r1=155063&r2=155064
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultURLRewriter.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultURLRewriter.java Wed Feb 23 12:22:14 2005
@@ -34,7 +34,7 @@
 {
     private static final Logger _log = Logger.getInstance( DefaultURLRewriter.class );
 
-    public String getNamePrefix( ServletContext servletContext, ServletRequest request )
+    public String getNamePrefix( ServletContext servletContext, ServletRequest request, String name )
     {
         return "";
     }

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/OldURLRewriterWrapper.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/OldURLRewriterWrapper.java?view=diff&r1=155063&r2=155064
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/OldURLRewriterWrapper.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/OldURLRewriterWrapper.java Wed Feb 23 12:22:14 2005
@@ -56,9 +56,25 @@
         return _oldURLRewriter;
     }
 
-    public String getNamePrefix( ServletContext servletContext, ServletRequest request )
+    public String getNamePrefix( ServletContext servletContext, ServletRequest request, String name )
     {
-        return _oldURLRewriter.rewriteName( servletContext, request, "" );
+        String prefix = "";
+        String rewrittenName = _oldURLRewriter.rewriteName( servletContext, request, name );
+
+        //
+        // This logic assumes that the old rewritters are only adding a prefix when
+        // rewriting a parameter name.
+        //
+        if ( rewrittenName != null )
+        {
+            int index = rewrittenName.lastIndexOf( name );
+            if ( index > 0 )
+            {
+                prefix = rewrittenName.substring( 0, index );
+            }
+        }
+
+        return prefix;
     }
 
     public void rewriteURL( ServletContext servletContext, ServletRequest request,

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/URLRewriterService.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/URLRewriterService.java?view=diff&r1=155063&r2=155064
==============================================================================
--- 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 Wed Feb 23 12:22:14 2005
@@ -60,7 +60,7 @@
      */ 
     public static String rewriteName(ServletContext servletContext, ServletRequest request, String name)
     {
-        return org.apache.beehive.netui.core.urls.URLRewriterService.getNamePrefix( servletContext, request ) + name;
+        return org.apache.beehive.netui.core.urls.URLRewriterService.getNamePrefix( servletContext, request, name ) + name;
     }
 
     /**

Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/AbstractClassicTag.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/AbstractClassicTag.java?view=diff&r1=155063&r2=155064
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/AbstractClassicTag.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/AbstractClassicTag.java Wed Feb 23 12:22:14 2005
@@ -274,7 +274,7 @@
      */
     final protected String rewriteName(String name)
     {
-        return URLRewriterService.getNamePrefix(pageContext.getServletContext(), pageContext.getRequest()) + name;
+        return URLRewriterService.getNamePrefix(pageContext.getServletContext(), pageContext.getRequest(), name) + name;
     }
 
     /**

Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java?view=diff&r1=155063&r2=155064
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java Wed Feb 23 12:22:14 2005
@@ -326,7 +326,7 @@
                 String overrideAction = ACTION_OVERRIDE + _action;
                 overrideAction = HtmlUtils.addParams(overrideAction, _params, response.getCharacterEncoding());
                 String buttonOutput = URLRewriterService.getNamePrefix(pageContext.getServletContext(),
-                        pageContext.getRequest()) + overrideAction;
+                        pageContext.getRequest(), overrideAction) + overrideAction;
                 if (buttonOutput.indexOf(";") > -1) {
                     buttonOutput = buttonOutput.substring(0, buttonOutput.indexOf(";"));
                 }

Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java?view=diff&r1=155063&r2=155064
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java Wed Feb 23 12:22:14 2005
@@ -737,12 +737,14 @@
                 if (paramValue instanceof String[]) {
                     String[] paramValArray = (String[]) paramValue;
                     for (int i = 0; i < paramValArray.length; i++) {
-                        String paramName = URLRewriterService.getNamePrefix(servletContext, request) + paramKey.toString();
+                        String name = paramKey.toString();
+                        String paramName = URLRewriterService.getNamePrefix(servletContext, request, name) + name;
                         writeHiddenParam(paramName, paramValArray[i], writer, request, true);
                     }
                 }
                 else {
-                    String paramName = URLRewriterService.getNamePrefix(servletContext, request) + paramKey.toString();
+                    String name = paramKey.toString();
+                    String paramName = URLRewriterService.getNamePrefix(servletContext, request, name) + name;
                     writeHiddenParam(paramName, paramValue.toString(), writer, request, true);
                 }
             }

Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/javaScript.properties
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/javaScript.properties?view=diff&r1=155063&r2=155064
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/javaScript.properties (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/javaScript.properties Wed Feb 23 12:22:14 2005
@@ -31,11 +31,11 @@
 anchorFormSubmitAction=anchor_submit_form(''{0}'',''{1}'');return false;
 
 # The action event that will call the form submit javascript only if this link has not been clicked.
-anchorDisableAndSubmitFormAction=if (this.clicked) return false; anchor_submit_form(''{0}'',''{1}''); \
-this.clicked=true; return false;
+anchorDisableAndSubmitFormAction=if (this.netui_clicked) return false; anchor_submit_form(''{0}'',''{1}''); \
+this.netui_clicked=true; return false;
 
 # The action event that will disable the anchor after it has been clicked.
-anchorDisableAction=if (this.clicked) return false; this.clicked=true;
+anchorDisableAction=if (this.netui_clicked) return false; this.netui_clicked=true;
 
 # generic method to disable a button and submit a form, used by Button.
 # The following method will be written out once an may be called by

Modified: incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urls/URLRewriter.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urls/URLRewriter.java?view=diff&r1=155063&r2=155064
==============================================================================
--- incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urls/URLRewriter.java (original)
+++ incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urls/URLRewriter.java Wed Feb 23 12:22:14 2005
@@ -56,9 +56,10 @@
      *
      * @param servletContext the current ServletContext.
      * @param request the current ServletRequest.
-     * @return a prefix to use to rewrite a query parameter name..
+     * @param name the name of the query parameter.
+     * @return a prefix to use to rewrite a query parameter name.
      */
-    public abstract String getNamePrefix( ServletContext servletContext, ServletRequest request );
+    public abstract String getNamePrefix( ServletContext servletContext, ServletRequest request, String name );
 
     /**
      * Rewrite the given URL.

Modified: incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urls/URLRewriterService.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urls/URLRewriterService.java?view=diff&r1=155063&r2=155064
==============================================================================
--- incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urls/URLRewriterService.java (original)
+++ incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urls/URLRewriterService.java Wed Feb 23 12:22:14 2005
@@ -62,9 +62,10 @@
      *
      * @param servletContext the current ServletContext.
      * @param request        the current ServletRequest.
+     * @param name           the name of the query parameter.
      * @return a prefix to use to rewrite a query parameter name.
      */
-    public static String getNamePrefix( ServletContext servletContext, ServletRequest request )
+    public static String getNamePrefix( ServletContext servletContext, ServletRequest request, String name )
     {
         ArrayList< URLRewriter > rewriters = getRewriters( request );
 
@@ -74,7 +75,7 @@
         {
             for ( URLRewriter rewriter : rewriters )
             {
-                String nextPrefix = rewriter.getNamePrefix( servletContext, request );
+                String nextPrefix = rewriter.getNamePrefix( servletContext, request, name );
                 if ( nextPrefix != null ) { prefix.append( nextPrefix ); }
             }
         }