You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by dg...@apache.org on 2005/07/19 02:03:45 UTC

svn commit: r219584 - in /struts/sandbox/trunk/tiles: ./ src/conf/ src/java/org/apache/tiles/servlets/ src/java/org/apache/tiles/util/

Author: dgeary
Date: Mon Jul 18 17:03:23 2005
New Revision: 219584

URL: http://svn.apache.org/viewcvs?rev=219584&view=rev
Log:
This checkin gives us a viable tiles-core.jar. I tested it against the
simple example from tiles-original. I thought of copying over that example
and the accompanying document, but we already have an examples directory
here under tiles-documentation, so I thought better of it. Perhaps later.

There's still some work to be done in the tiles-documentation directory and
we also should think about testing. Evidently, the only test in sight for
Tiles is the TilesPluginTest, which of course, is Struts specific and should 
probably be removed from this source tree, no? Integration tests would be easy 
enough with something like Canoo. What about unit tests?

Anyway, here's what this checkin entails:

1. Added the Tiles servlet from tiles-original
2. svn copied RequestUtils from the Struts utils directory and removed Struts-related code
(We only use 2 methods from RequestUtils, but I kept everything that wasn't Struts-related,
for good measure)
3. Changed ...org.apache.taglib.tiles... to ...org.apache.tiles.taglib... in tiles-core.tld

I also think we need to change the flush attribute's default to false. If you use
tiles:insert in the body of an enclosing tag, you'll get an exception, which forces
you to use flush="false" more often than not.




Added:
    struts/sandbox/trunk/tiles/src/java/org/apache/tiles/servlets/
    struts/sandbox/trunk/tiles/src/java/org/apache/tiles/servlets/TilesServlet.java
      - copied, changed from r219349, struts/sandbox/trunk/tiles-original/core-library/src/java/org/apache/tiles/servlets/TilesServlet.java
    struts/sandbox/trunk/tiles/src/java/org/apache/tiles/util/
    struts/sandbox/trunk/tiles/src/java/org/apache/tiles/util/RequestUtils.java
      - copied, changed from r219345, struts/core/trunk/src/share/org/apache/struts/util/RequestUtils.java
Modified:
    struts/sandbox/trunk/tiles/build.xml
    struts/sandbox/trunk/tiles/src/conf/tiles-core.tld

Modified: struts/sandbox/trunk/tiles/build.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/tiles/build.xml?rev=219584&r1=219583&r2=219584&view=diff
==============================================================================
--- struts/sandbox/trunk/tiles/build.xml (original)
+++ struts/sandbox/trunk/tiles/build.xml Mon Jul 18 17:03:23 2005
@@ -279,7 +279,7 @@
 
 
   <target        name="download-dependencies"
-          description="Doanload freely available dependencies">
+          description="Download freely available dependencies">
 
     <mkdir        dir="${lib.home}"/>
 

Modified: struts/sandbox/trunk/tiles/src/conf/tiles-core.tld
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/tiles/src/conf/tiles-core.tld?rev=219584&r1=219583&r2=219584&view=diff
==============================================================================
--- struts/sandbox/trunk/tiles/src/conf/tiles-core.tld (original)
+++ struts/sandbox/trunk/tiles/src/conf/tiles-core.tld Mon Jul 18 17:03:23 2005
@@ -14,7 +14,7 @@
 <uri>http://jakarta.apache.org/tiles</uri>
 <tag>
 <name>insert</name>
-<tagclass>org.apache.taglib.tiles.InsertTag</tagclass>
+<tagclass>org.apache.tiles.taglib.InsertTag</tagclass>
 <bodycontent>JSP</bodycontent>
 <attribute>
 <name>template</name>
@@ -89,7 +89,7 @@
 </tag>
 <tag>
 <name>definition</name>
-<tagclass>org.apache.taglib.tiles.DefinitionTag</tagclass>
+<tagclass>org.apache.tiles.taglib.DefinitionTag</tagclass>
 <bodycontent>JSP</bodycontent>
 <attribute>
 <name>id</name>
@@ -124,7 +124,7 @@
 </tag>
 <tag>
 <name>put</name>
-<tagclass>org.apache.taglib.tiles.PutTag</tagclass>
+<tagclass>org.apache.tiles.taglib.PutTag</tagclass>
 <bodycontent>JSP</bodycontent>
 <attribute>
 <name>name</name>
@@ -174,7 +174,7 @@
 </tag>
 <tag>
 <name>putList</name>
-<tagclass>org.apache.taglib.tiles.PutListTag</tagclass>
+<tagclass>org.apache.tiles.taglib.PutListTag</tagclass>
 <bodycontent>JSP</bodycontent>
 <attribute>
 <name>name</name>
@@ -184,7 +184,7 @@
 </tag>
 <tag>
 <name>add</name>
-<tagclass>org.apache.taglib.tiles.AddTag</tagclass>
+<tagclass>org.apache.tiles.taglib.AddTag</tagclass>
 <bodycontent>JSP</bodycontent>
 <attribute>
 <name>value</name>
@@ -229,7 +229,7 @@
 </tag>
 <tag>
 <name>get</name>
-<tagclass>org.apache.taglib.tiles.GetTag</tagclass>
+<tagclass>org.apache.tiles.taglib.GetTag</tagclass>
 <bodycontent>empty</bodycontent>
 <attribute>
 <name>name</name>
@@ -254,7 +254,7 @@
 </tag>
 <tag>
 <name>getAsString</name>
-<tagclass>org.apache.taglib.tiles.GetAttributeTag</tagclass>
+<tagclass>org.apache.tiles.taglib.GetAttributeTag</tagclass>
 <bodycontent>empty</bodycontent>
 <attribute>
 <name>name</name>
@@ -274,8 +274,8 @@
 </tag>
 <tag>
 <name>useAttribute</name>
-<tagclass>org.apache.taglib.tiles.UseAttributeTag</tagclass>
-<teiclass>org.apache.taglib.tiles.UseAttributeTei</teiclass>
+<tagclass>org.apache.tiles.taglib.UseAttributeTag</tagclass>
+<teiclass>org.apache.tiles.taglib.UseAttributeTei</teiclass>
 <bodycontent>empty</bodycontent>
 <attribute>
 <name>id</name>
@@ -305,7 +305,7 @@
 </tag>
 <tag>
 <name>importAttribute</name>
-<tagclass>org.apache.taglib.tiles.ImportAttributeTag</tagclass>
+<tagclass>org.apache.tiles.taglib.ImportAttributeTag</tagclass>
 <bodycontent>empty</bodycontent>
 <attribute>
 <name>name</name>
@@ -325,7 +325,7 @@
 </tag>
 <tag>
 <name>initComponentDefinitions</name>
-<tagclass>org.apache.taglib.tiles.InitDefinitionsTag</tagclass>
+<tagclass>org.apache.tiles.taglib.InitDefinitionsTag</tagclass>
 <bodycontent>empty</bodycontent>
 <attribute>
 <name>file</name>

Copied: struts/sandbox/trunk/tiles/src/java/org/apache/tiles/servlets/TilesServlet.java (from r219349, struts/sandbox/trunk/tiles-original/core-library/src/java/org/apache/tiles/servlets/TilesServlet.java)
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/tiles/src/java/org/apache/tiles/servlets/TilesServlet.java?p2=struts/sandbox/trunk/tiles/src/java/org/apache/tiles/servlets/TilesServlet.java&p1=struts/sandbox/trunk/tiles-original/core-library/src/java/org/apache/tiles/servlets/TilesServlet.java&r1=219349&r2=219584&rev=219584&view=diff
==============================================================================
--- struts/sandbox/trunk/tiles-original/core-library/src/java/org/apache/tiles/servlets/TilesServlet.java (original)
+++ struts/sandbox/trunk/tiles/src/java/org/apache/tiles/servlets/TilesServlet.java Mon Jul 18 17:03:23 2005
@@ -168,7 +168,7 @@
 			fconfig.setModuleAware(false);
 
 			ServletContext context = config.getServletContext();
-			TilesUtil.setTilesUtil(new TilesUtilStrutsImpl());
+			TilesUtil.setTilesUtil(new TilesUtilImpl());
 			initDefinitionsFactory(context, fconfig);
 		}
 		catch(Exception ex) {
@@ -250,6 +250,6 @@
 	   logger.warning("Caught exception when initializing definitions factory");
 	   logger.warning(ex.getMessage());
 	   logger.warning(ex.toString());
-	   config.getServletContext().setAttribute(Globals.TILES_INIT_EXCEPTION, ex.getMessage());
+	   //config.getServletContext().setAttribute(Globals.TILES_INIT_EXCEPTION, ex.getMessage());
 	}
 }

Copied: struts/sandbox/trunk/tiles/src/java/org/apache/tiles/util/RequestUtils.java (from r219345, struts/core/trunk/src/share/org/apache/struts/util/RequestUtils.java)
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/tiles/src/java/org/apache/tiles/util/RequestUtils.java?p2=struts/sandbox/trunk/tiles/src/java/org/apache/tiles/util/RequestUtils.java&p1=struts/core/trunk/src/share/org/apache/struts/util/RequestUtils.java&r1=219345&r2=219584&rev=219584&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/util/RequestUtils.java (original)
+++ struts/sandbox/trunk/tiles/src/java/org/apache/tiles/util/RequestUtils.java Mon Jul 18 17:03:23 2005
@@ -16,40 +16,19 @@
  * limitations under the License.
  */
 
-package org.apache.struts.util;
+package org.apache.tiles.util;
 
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Locale;
-import java.util.Map;
 
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
 
-import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.struts.Globals;
-import org.apache.struts.action.ActionForm;
-import org.apache.struts.action.ActionMapping;
-import org.apache.struts.action.ActionServlet;
-import org.apache.struts.action.ActionServletWrapper;
-import org.apache.struts.config.ActionConfig;
-import org.apache.struts.config.FormBeanConfig;
-import org.apache.struts.config.ForwardConfig;
-import org.apache.struts.config.ModuleConfig;
-import org.apache.struts.upload.MultipartRequestHandler;
-import org.apache.struts.upload.MultipartRequestWrapper;
 
 /**
  * <p>General purpose utility methods related to processing a servlet request
- * in the Struts controller framework.</p>
+ * with Tiles.</p>
  *
  * @version $Rev$ $Date$
  */
@@ -179,441 +158,6 @@
     }
 
     /**
-     * <p>Create (if necessary) and return an <code>ActionForm</code> instance appropriate
-     * for this request.  If no <code>ActionForm</code> instance is required, return
-     * <code>null</code>.</p>
-     *
-     * @param request The servlet request we are processing
-     * @param mapping The action mapping for this request
-     * @param moduleConfig The configuration for this module
-     * @param servlet The action servlet
-     *
-     * @return ActionForm instance associated with this request
-     */
-    public static ActionForm createActionForm(
-            HttpServletRequest request,
-            ActionMapping mapping,
-            ModuleConfig moduleConfig,
-            ActionServlet servlet) {
-
-        // Is there a form bean associated with this mapping?
-        String attribute = mapping.getAttribute();
-        if (attribute == null) {
-            return (null);
-        }
-
-        // Look up the form bean configuration information to use
-        String name = mapping.getName();
-        FormBeanConfig config = moduleConfig.findFormBeanConfig(name);
-        if (config == null) {
-            log.warn("No FormBeanConfig found under '" + name + "'");
-            return (null);
-        }
-
-        ActionForm instance = lookupActionForm(request, attribute, mapping.getScope());
-
-        // Can we recycle the existing form bean instance (if there is one)?
-        if (instance != null && config.canReuse(instance)) {
-            return (instance);
-        }
-
-        return createActionForm(config, servlet);
-    }
-
-
-
-    private static ActionForm lookupActionForm(HttpServletRequest request, String attribute, String scope)
-    {
-        // Look up any existing form bean instance
-        if (log.isDebugEnabled()) {
-            log.debug(
-                    " Looking for ActionForm bean instance in scope '"
-                    + scope
-                    + "' under attribute key '"
-                    + attribute
-                    + "'");
-        }
-        ActionForm instance = null;
-        HttpSession session = null;
-        if ("request".equals(scope)) {
-            instance = (ActionForm) request.getAttribute(attribute);
-        } else {
-            session = request.getSession();
-            instance = (ActionForm) session.getAttribute(attribute);
-        }
-
-        return (instance);
-    }
-
-    /**
-     * <p>Create and return an <code>ActionForm</code> instance appropriate
-     * to the information in <code>config</code>.</p>
-     *
-     * <p>Does not perform any checks to see if an existing ActionForm exists
-     * which could be reused.</p>
-     *
-     * @param config The configuration for the Form bean which is to be created.
-     * @param servlet The action servlet
-     *
-     * @return ActionForm instance associated with this request
-     */
-    public static ActionForm createActionForm(FormBeanConfig config, ActionServlet servlet)
-    {
-        if (config == null)
-        {
-            return (null);
-        }
-
-        ActionForm instance = null;
-
-        // Create and return a new form bean instance
-        try {
-
-            instance = config.createActionForm(servlet);
-            if (log.isDebugEnabled()) {
-                log.debug(
-                        " Creating new "
-                        + (config.getDynamic() ? "DynaActionForm" : "ActionForm")
-                        + " instance of type '"
-                        + config.getType()
-                        + "'");
-                log.trace(" --> " + instance);
-            }
-
-        } catch(Throwable t) {
-            log.error(servlet.getInternal().getMessage("formBean", config.getType()), t);
-        }
-
-        return (instance);
-
-    }
-
-
-    /**
-     * <p>Look up and return current user locale, based on the specified parameters.</p>
-     *
-     * @param request The request used to lookup the Locale
-     * @param locale Name of the session attribute for our user's Locale.  If this is
-     * <code>null</code>, the default locale key is used for the lookup.
-     * @return current user locale
-     * @since Struts 1.2
-     */
-    public static Locale getUserLocale(HttpServletRequest request, String locale) {
-
-        Locale userLocale = null;
-        HttpSession session = request.getSession(false);
-
-        if (locale == null) {
-            locale = Globals.LOCALE_KEY;
-        }
-
-        // Only check session if sessions are enabled
-        if (session != null) {
-            userLocale = (Locale) session.getAttribute(locale);
-        }
-
-        if (userLocale == null) {
-            // Returns Locale based on Accept-Language header or the server default
-            userLocale = request.getLocale();
-        }
-
-        return userLocale;
-
-    }
-
-
-    /**
-     * <p>Populate the properties of the specified JavaBean from the specified
-     * HTTP request, based on matching each parameter name against the
-     * corresponding JavaBeans "property setter" methods in the bean's class.
-     * Suitable conversion is done for argument types as described under
-     * <code>convert()</code>.</p>
-     *
-     * @param bean The JavaBean whose properties are to be set
-     * @param request The HTTP request whose parameters are to be used
-     *                to populate bean properties
-     *
-     * @exception ServletException if an exception is thrown while setting
-     *            property values
-     */
-    public static void populate(Object bean, HttpServletRequest request) throws ServletException {
-
-        populate(bean, null, null, request);
-
-    }
-
-
-    /**
-     * <p>Populate the properties of the specified JavaBean from the specified
-     * HTTP request, based on matching each parameter name (plus an optional
-     * prefix and/or suffix) against the corresponding JavaBeans "property
-     * setter" methods in the bean's class. Suitable conversion is done for
-     * argument types as described under <code>setProperties</code>.</p>
-     *
-     * <p>If you specify a non-null <code>prefix</code> and a non-null
-     * <code>suffix</code>, the parameter name must match <strong>both</strong>
-     * conditions for its value(s) to be used in populating bean properties.
-     * If the request's content type is "multipart/form-data" and the
-     * method is "POST", the <code>HttpServletRequest</code> object will be wrapped in
-     * a <code>MultipartRequestWrapper</code object.</p>
-     *
-     * @param bean The JavaBean whose properties are to be set
-     * @param prefix The prefix (if any) to be prepend to bean property
-     *               names when looking for matching parameters
-     * @param suffix The suffix (if any) to be appended to bean property
-     *               names when looking for matching parameters
-     * @param request The HTTP request whose parameters are to be used
-     *                to populate bean properties
-     *
-     * @exception ServletException if an exception is thrown while setting
-     *            property values
-     */
-    public static void populate(
-            Object bean,
-            String prefix,
-            String suffix,
-            HttpServletRequest request)
-            throws ServletException {
-
-        // Build a list of relevant request parameters from this request
-        HashMap properties = new HashMap();
-        // Iterator of parameter names
-        Enumeration names = null;
-        // Map for multipart parameters
-        Map multipartParameters = null;
-
-        String contentType = request.getContentType();
-        String method = request.getMethod();
-        boolean isMultipart = false;
-
-        if ((contentType != null)
-                && (contentType.startsWith("multipart/form-data"))
-                && (method.equalsIgnoreCase("POST"))) {
-
-            // Get the ActionServletWrapper from the form bean
-            ActionServletWrapper servlet;
-            if (bean instanceof ActionForm) {
-                servlet = ((ActionForm) bean).getServletWrapper();
-            } else {
-                throw new ServletException(
-                        "bean that's supposed to be "
-                        + "populated from a multipart request is not of type "
-                        + "\"org.apache.struts.action.ActionForm\", but type "
-                        + "\""
-                        + bean.getClass().getName()
-                        + "\"");
-            }
-
-            // Obtain a MultipartRequestHandler
-            MultipartRequestHandler multipartHandler = getMultipartHandler(request);
-
-            // Set the multipart request handler for our ActionForm.
-            // If the bean isn't an ActionForm, an exception would have been
-            // thrown earlier, so it's safe to assume that our bean is
-            // in fact an ActionForm.
-            ((ActionForm) bean).setMultipartRequestHandler(multipartHandler);
-
-            if (multipartHandler != null) {
-                isMultipart = true;
-                // Set servlet and mapping info
-                servlet.setServletFor(multipartHandler);
-                multipartHandler.setMapping(
-                        (ActionMapping) request.getAttribute(Globals.MAPPING_KEY));
-                // Initialize multipart request class handler
-                multipartHandler.handleRequest(request);
-                //stop here if the maximum length has been exceeded
-                Boolean maxLengthExceeded =
-                        (Boolean) request.getAttribute(
-                                MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED);
-                if ((maxLengthExceeded != null) && (maxLengthExceeded.booleanValue())) {
-                    return;
-                }
-                //retrieve form values and put into properties
-                multipartParameters = getAllParametersForMultipartRequest(
-                        request, multipartHandler);
-                names = Collections.enumeration(multipartParameters.keySet());
-            }
-        }
-
-        if (!isMultipart) {
-            names = request.getParameterNames();
-        }
-
-        while (names.hasMoreElements()) {
-            String name = (String) names.nextElement();
-            String stripped = name;
-            if (prefix != null) {
-                if (!stripped.startsWith(prefix)) {
-                    continue;
-                }
-                stripped = stripped.substring(prefix.length());
-            }
-            if (suffix != null) {
-                if (!stripped.endsWith(suffix)) {
-                    continue;
-                }
-                stripped = stripped.substring(0, stripped.length() - suffix.length());
-            }
-            Object parameterValue = null;
-            if (isMultipart) {
-                parameterValue = multipartParameters.get(name);
-            } else {
-                parameterValue = request.getParameterValues(name);
-            }
-
-            // Populate parameters, except "standard" struts attributes
-            // such as 'org.apache.struts.action.CANCEL'
-            if (!(stripped.startsWith("org.apache.struts."))) {
-                properties.put(stripped, parameterValue);
-            }
-        }
-
-        // Set the corresponding properties of our bean
-        try {
-            BeanUtils.populate(bean, properties);
-        } catch(Exception e) {
-            throw new ServletException("BeanUtils.populate", e);
-        }
-
-    }
-
-
-    /**
-     * <p>Try to locate a multipart request handler for this request. First, look
-     * for a mapping-specific handler stored for us under an attribute. If one
-     * is not present, use the global multipart handler, if there is one.</p>
-     *
-     * @param request The HTTP request for which the multipart handler should
-     *                be found.
-     * @return the multipart handler to use, or null if none is
-     *         found.
-     *
-     * @exception ServletException if any exception is thrown while attempting
-     *                             to locate the multipart handler.
-     */
-    private static MultipartRequestHandler getMultipartHandler(HttpServletRequest request)
-            throws ServletException {
-
-        MultipartRequestHandler multipartHandler = null;
-        String multipartClass = (String) request.getAttribute(Globals.MULTIPART_KEY);
-        request.removeAttribute(Globals.MULTIPART_KEY);
-
-        // Try to initialize the mapping specific request handler
-        if (multipartClass != null) {
-            try {
-                multipartHandler = (MultipartRequestHandler) applicationInstance(multipartClass);
-            } catch(ClassNotFoundException cnfe) {
-                log.error(
-                        "MultipartRequestHandler class \""
-                        + multipartClass
-                        + "\" in mapping class not found, "
-                        + "defaulting to global multipart class");
-            } catch(InstantiationException ie) {
-                log.error(
-                        "InstantiationException when instantiating "
-                        + "MultipartRequestHandler \""
-                        + multipartClass
-                        + "\", "
-                        + "defaulting to global multipart class, exception: "
-                        + ie.getMessage());
-            } catch(IllegalAccessException iae) {
-                log.error(
-                        "IllegalAccessException when instantiating "
-                        + "MultipartRequestHandler \""
-                        + multipartClass
-                        + "\", "
-                        + "defaulting to global multipart class, exception: "
-                        + iae.getMessage());
-            }
-
-            if (multipartHandler != null) {
-                return multipartHandler;
-            }
-        }
-
-        ModuleConfig moduleConfig =
-                ModuleUtils.getInstance().getModuleConfig(request);
-
-        multipartClass = moduleConfig.getControllerConfig().getMultipartClass();
-
-        // Try to initialize the global request handler
-        if (multipartClass != null) {
-            try {
-                multipartHandler = (MultipartRequestHandler) applicationInstance(multipartClass);
-
-            } catch(ClassNotFoundException cnfe) {
-                throw new ServletException(
-                        "Cannot find multipart class \""
-                        + multipartClass
-                        + "\""
-                        + ", exception: "
-                        + cnfe.getMessage());
-
-            } catch(InstantiationException ie) {
-                throw new ServletException(
-                        "InstantiationException when instantiating "
-                        + "multipart class \""
-                        + multipartClass
-                        + "\", exception: "
-                        + ie.getMessage());
-
-            } catch(IllegalAccessException iae) {
-                throw new ServletException(
-                        "IllegalAccessException when instantiating "
-                        + "multipart class \""
-                        + multipartClass
-                        + "\", exception: "
-                        + iae.getMessage());
-            }
-
-            if (multipartHandler != null) {
-                return multipartHandler;
-            }
-        }
-
-        return multipartHandler;
-    }
-
-
-    /**
-     *<p>Create a <code>Map</code> containing all of the parameters supplied for a multipart
-     * request, keyed by parameter name. In addition to text and file elements
-     * from the multipart body, query string parameters are included as well.</p>
-     *
-     * @param request The (wrapped) HTTP request whose parameters are to be
-     *                added to the map.
-     * @param multipartHandler The multipart handler used to parse the request.
-     *
-     * @return the map containing all parameters for this multipart request.
-     */
-    private static Map getAllParametersForMultipartRequest(
-            HttpServletRequest request,
-            MultipartRequestHandler multipartHandler) {
-
-        Map parameters = new HashMap();
-        Hashtable elements = multipartHandler.getAllElements();
-        Enumeration e = elements.keys();
-        while (e.hasMoreElements()) {
-            String key = (String) e.nextElement();
-            parameters.put(key, elements.get(key));
-        }
-
-        if (request instanceof MultipartRequestWrapper) {
-            request = ((MultipartRequestWrapper) request).getRequest();
-            e = request.getParameterNames();
-            while (e.hasMoreElements()) {
-                String key = (String) e.nextElement();
-                parameters.put(key, request.getParameterValues(key));
-            }
-        } else {
-            log.debug("Gathering multipart parameters for unwrapped request");
-        }
-
-        return parameters;
-    }
-
-
-    /**
      * <p>Compute the printable representation of a URL, leaving off the
      * scheme/host/port part if no host is specified. This will typically
      * be the case for URLs that were originally created from relative
@@ -643,208 +187,6 @@
 
 
     /**
-     * <p>Return the context-relative URL that corresponds to the specified
-     * {@link ActionConfig}, relative to the module associated
-     * with the current modules's {@link ModuleConfig}.</p>
-     *
-     * @param request The servlet request we are processing
-     * @param action ActionConfig to be evaluated
-     * @param pattern URL pattern used to map the controller servlet
-
-     * @return  context-relative URL relative to the module
-     *
-     * @since Struts 1.1
-     */
-    public static String actionURL(
-            HttpServletRequest request,
-            ActionConfig action,
-            String pattern) {
-
-        StringBuffer sb = new StringBuffer();
-        if (pattern.endsWith("/*")) {
-            sb.append(pattern.substring(0, pattern.length() - 2));
-            sb.append(action.getPath());
-
-        } else if (pattern.startsWith("*.")) {
-            ModuleConfig appConfig =
-                    ModuleUtils.getInstance().getModuleConfig(request);
-            sb.append(appConfig.getPrefix());
-            sb.append(action.getPath());
-            sb.append(pattern.substring(1));
-
-        } else {
-            throw new IllegalArgumentException(pattern);
-        }
-
-        return sb.toString();
-
-    }
-  /**
-     * <p>Return the context-relative URL that corresponds to the specified
-     * <code>ForwardConfig</code>. The URL is calculated based on the properties
-     * of the {@link ForwardConfig} instance as follows:</p>
-     * <ul>
-     * <li>If the <code>contextRelative</code> property is set, it is
-     *     assumed that the <code>path</code> property contains a path
-     *     that is already context-relative:
-     *     <ul>
-     *     <li>If the <code>path</code> property value starts with a slash,
-     *         it is returned unmodified.</li>
-     *     <li>If the <code>path</code> property value does not start
-     *         with a slash, a slash is prepended.</li>
-     *     </ul></li>
-     * <li>Acquire the <code>forwardPattern</code> property from the
-     *     <code>ControllerConfig</code> for the application module used
-     *     to process this request. If no pattern was configured, default
-     *     to a pattern of <code>$M$P</code>, which is compatible with the
-     *     hard-coded mapping behavior in Struts 1.0.</li>
-     * <li>Process the acquired <code>forwardPattern</code>, performing the
-     *     following substitutions:
-     *     <ul>
-     *     <li><strong>$M</strong> - Replaced by the module prefix for the
-     *         application module processing this request.</li>
-     *     <li><strong>$P</strong> - Replaced by the <code>path</code>
-     *         property of the specified {@link ForwardConfig}, prepended
-     *         with a slash if it does not start with one.</li>
-     *     <li><strong>$$</strong> - Replaced by a single dollar sign
-     *         character.</li>
-     *     <li><strong>$x</strong> (where "x" is any charater not listed
-     *         above) - Silently omit these two characters from the result
-     *         value.  (This has the side effect of causing all other
-     *         $+letter combinations to be reserved.)</li>
-     *     </ul></li>
-     * </ul>
-     *
-     * @param request The servlet request we are processing
-     * @param forward ForwardConfig to be evaluated
-     *
-     * @return context-relative URL
-     * @since Struts 1.1
-     */
-    public static String forwardURL(HttpServletRequest request, ForwardConfig forward) {
-         return forwardURL(request,forward,null);
-    }
-
-    /**
-     * <p>Return the context-relative URL that corresponds to the specified
-     * <code>ForwardConfig</code>. The URL is calculated based on the properties
-     * of the {@link ForwardConfig} instance as follows:</p>
-     * <ul>
-     * <li>If the <code>contextRelative</code> property is set, it is
-     *     assumed that the <code>path</code> property contains a path
-     *     that is already context-relative:
-     *     <ul>
-     *     <li>If the <code>path</code> property value starts with a slash,
-     *         it is returned unmodified.</li>
-     *     <li>If the <code>path</code> property value does not start
-     *         with a slash, a slash is prepended.</li>
-     *     </ul></li>
-     * <li>Acquire the <code>forwardPattern</code> property from the
-     *     <code>ControllerConfig</code> for the application module used
-     *     to process this request. If no pattern was configured, default
-     *     to a pattern of <code>$M$P</code>, which is compatible with the
-     *     hard-coded mapping behavior in Struts 1.0.</li>
-     * <li>Process the acquired <code>forwardPattern</code>, performing the
-     *     following substitutions:
-     *     <ul>
-     *     <li><strong>$M</strong> - Replaced by the module prefix for the
-     *         application module processing this request.</li>
-     *     <li><strong>$P</strong> - Replaced by the <code>path</code>
-     *         property of the specified {@link ForwardConfig}, prepended
-     *         with a slash if it does not start with one.</li>
-     *     <li><strong>$$</strong> - Replaced by a single dollar sign
-     *         character.</li>
-     *     <li><strong>$x</strong> (where "x" is any charater not listed
-     *         above) - Silently omit these two characters from the result
-     *         value.  (This has the side effect of causing all other
-     *         $+letter combinations to be reserved.)</li>
-     *     </ul></li>
-     * </ul>
-     *
-     * @param request The servlet request we are processing
-     * @param forward ForwardConfig to be evaluated
-   * @param moduleConfig Base forward on this module config.
-     *
-     * @return context-relative URL
-     * @since Struts 1.2
-     */
-    public static String forwardURL(HttpServletRequest request, ForwardConfig forward, ModuleConfig moduleConfig) {
-        //load the current moduleConfig, if null
-        if(moduleConfig == null) {
-            moduleConfig = ModuleUtils.getInstance().getModuleConfig(request);
-        }
-
-        String path = forward.getPath();
-        //load default prefix
-        String prefix = moduleConfig.getPrefix();
-
-        //override prefix if supplied by forward
-        if(forward.getModule() != null) {
-            prefix = forward.getModule();
-            if ("/".equals(prefix)) {
-                prefix = "";
-            }
-        }
-
-        // Handle a ForwardConfig marked as context relative
-        StringBuffer sb = new StringBuffer();
-        if (forward.getContextRelative()) {
-            if (!path.startsWith("/")) {
-                sb.append("/");
-            }
-            sb.append(path);
-            return (sb.toString());
-        }
-
-        // Calculate a context relative path for this ForwardConfig
-        String forwardPattern = moduleConfig.getControllerConfig().getForwardPattern();
-        if (forwardPattern == null) {
-            // Performance optimization for previous default behavior
-            sb.append(prefix);
-            // smoothly insert a '/' if needed
-            if (!path.startsWith("/")) {
-                sb.append("/");
-            }
-            sb.append(path);
-
-        } else {
-            boolean dollar = false;
-            for (int i = 0; i < forwardPattern.length(); i++) {
-                char ch = forwardPattern.charAt(i);
-                if (dollar) {
-                    switch (ch) {
-                        case 'M':
-                            sb.append(prefix);
-                            break;
-                        case 'P':
-                            // add '/' if needed
-                            if (!path.startsWith("/")) {
-                                sb.append("/");
-                            }
-                            sb.append(path);
-                            break;
-                        case '$':
-                            sb.append('$');
-                            break;
-                        default :
-                            ; // Silently swallow
-                    }
-                    dollar = false;
-                    continue;
-                } else if (ch == '$') {
-                    dollar = true;
-                } else {
-                    sb.append(ch);
-                }
-            }
-        }
-
-        return (sb.toString());
-
-    }
-
-
-    /**
      * <p>Return the URL representing the current request. This is equivalent
      * to <code>HttpServletRequest.getRequestURL</code> in Servlet 2.3.</p>
      *
@@ -963,151 +305,6 @@
         StringBuffer serverUri = createServerStringBuffer(scheme,server,port);
         serverUri.append(uri);
         return serverUri;
-
-    }
-
-
-    // ------------------------------------- Deprecated in favor of ModuleUtils
-
-
-
-    /**
-     * <p>Select the module to which the specified request belongs, and
-     * add corresponding request attributes to this request.</p>
-     *
-     * @param prefix The module prefix of the desired module
-     * @param request The servlet request we are processing
-     * @param context The ServletContext for this web application
-     *
-     * @since Struts 1.1
-     * @deprecated Use {@link org.apache.struts.util.ModuleUtils#selectModule(String,HttpServletRequest,ServletContext)} instead.
-     * This will be removed after Struts 1.2.
-     */
-    public static void selectModule(
-            String prefix,
-            HttpServletRequest request,
-            ServletContext context) {
-        // :TODO: Remove after Struts 1.2
-
-        ModuleUtils.getInstance().selectModule(prefix, request, context);
-
-    }
-
-
-    /**
-     * <p>Select the module to which the specified request belongs, and
-     * add corresponding request attributes to this request.</p>
-     *
-     * @param request The servlet request we are processing
-     * @param context The ServletContext for this web application
-     *
-     * @deprecated Use {@link org.apache.struts.util.ModuleUtils#selectModule(HttpServletRequest,ServletContext)} instead.
-     * This will be removed after Struts 1.2.
-     */
-    public static void selectModule(HttpServletRequest request, ServletContext context) {
-        // :TODO: Remove after Struts 1.2
-
-        ModuleUtils.getInstance().selectModule(request, context);
-
-    }
-
-
-    /**
-     * Get the module name to which the specified request belong.
-     * @param request The servlet request we are processing
-     * @param context The ServletContext for this web application
-     * @return The module prefix or ""
-     * @deprecated Use Use {@link org.apache.struts.util.ModuleUtils#getModuleName(HttpServletRequest,ServletContext)} instead.
-     * This will be removed after Struts 1.2.
-     */
-    public static String getModuleName(HttpServletRequest request, ServletContext context) {
-        // :TODO: Remove after Struts 1.2
-
-        return ModuleUtils.getInstance().getModuleName(request, context);
-
-    }
-
-
-    /**
-     * <p>Get the module name to which the specified uri belong.</p>
-     *
-     * @param matchPath The uri from which we want the module name.
-     * @param context The ServletContext for this web application
-     *
-     * @return The module prefix or ""
-     * @deprecated Use {@link org.apache.struts.util.ModuleUtils#getModuleName(String,ServletContext)} instead.
-     * This will be removed after Struts 1.2.
-     */
-    public static String getModuleName(String matchPath, ServletContext context) {
-        // :TODO: Remove after Struts 1.2
-
-        return ModuleUtils.getInstance().getModuleName(matchPath, context);
-
-    }
-
-
-    /**
-     * <p>Return the current <code>ModuleConfig</code> object stored in request,
-     * if it exists, null otherwise.
-     * This method can be used by a {@link org.apache.struts.action.PlugIn} to
-     * retrieve the current module config object. If no moduleConfig is found,
-     * this means that the request hasn't hit the server through the Struts servlet.
-     * The appropriate module config can be set and found with
-     * <code>{@link RequestUtils#selectModule(HttpServletRequest, ServletContext)} </code>.
-     *
-     * @param request The servlet request we are processing
-     *
-     * @return the ModuleConfig object from request, or null if none is set in
-     * the request.
-     * @since Struts 1.1
-     * @deprecated Use {@link org.apache.struts.util.ModuleUtils#getModuleConfig(HttpServletRequest)} instead.
-     * This will be removed after Struts 1.2.
-     */
-    public static ModuleConfig getRequestModuleConfig(HttpServletRequest request) {
-        // :TODO: Remove after Struts 1.2
-
-        return ModuleUtils.getInstance().getModuleConfig(request);
-
-    }
-
-
-    /**
-     * <p>Return the ModuleConfig object is it exists, null otherwise.</p>
-     *
-     * @param request The servlet request we are processing
-     * @param context The ServletContext for this web application
-     *
-     * @return the ModuleConfig object
-     * @since Struts 1.1
-     * @deprecated Use {@link org.apache.struts.util.ModuleUtils#getModuleConfig(HttpServletRequest,ServletContext)} instead.
-     * This will be removed after Struts 1.2.
-     */
-    public static ModuleConfig getModuleConfig(
-            HttpServletRequest request,
-            ServletContext context) {
-        // :TODO: Remove after Struts 1.2
-
-        return ModuleUtils.getInstance().getModuleConfig(request, context);
-
-    }
-
-
-    /**
-     * <p>Return the list of module prefixes that are defined for
-     * this web application. <strong>NOTE</strong> -
-     * the "" prefix for the default module is not included in this list.</p>
-     *
-     * @param context The ServletContext for this web application.
-     *
-     * @return An array of module prefixes.
-     * @since Struts 1.1
-     * @deprecated Use {@link org.apache.struts.util.ModuleUtils#getModulePrefixes(ServletContext)} instead.
-     * This will be removed after Struts 1.2.
-     */
-    public static String[] getModulePrefixes(ServletContext context) {
-        // :TODO: Remove after Struts 1.2
-
-        return ModuleUtils.getInstance().getModulePrefixes(context);
 
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org