You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2006/03/11 21:55:35 UTC

svn commit: r385164 [25/32] - in /jakarta/tapestry/trunk: ./ .settings/ annotations/src/java/org/apache/tapestry/annotations/ annotations/src/test/org/apache/tapestry/annotations/ config/ contrib/src/documentation/content/xdocs/tapestry-contrib/Compone...

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/LocalizedWebContextResourceFinder.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/LocalizedWebContextResourceFinder.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/LocalizedWebContextResourceFinder.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/LocalizedWebContextResourceFinder.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@
 
 public class LocalizedWebContextResourceFinder
 {
-
     private WebContext _context;
 
     public LocalizedWebContextResourceFinder(WebContext context)
@@ -37,12 +36,11 @@
     }
 
     /**
-     * Resolves the resource, returning a path representing the closest match
-     * (with respect to the provided locale). Returns null if no match.
+     * Resolves the resource, returning a path representing the closest match (with respect to the
+     * provided locale). Returns null if no match.
      * <p>
-     * The provided path is split into a base path and a suffix (at the last
-     * period character). The locale will provide different suffixes to the base
-     * path and the first match is returned.
+     * The provided path is split into a base path and a suffix (at the last period character). The
+     * locale will provide different suffixes to the base path and the first match is returned.
      */
 
     public LocalizedResource resolve(String contextPath, Locale locale)
@@ -50,21 +48,20 @@
         int dotx = contextPath.lastIndexOf('.');
         String basePath;
         String suffix;
-        if (dotx >= 0)
-        {
-            basePath = contextPath.substring(0, dotx);
-            suffix = contextPath.substring(dotx);
+        if (dotx >= 0) {
+        	basePath = contextPath.substring(0, dotx);
+        	suffix = contextPath.substring(dotx);
         }
         else
         {
-            // Resource without extension
-            basePath = contextPath;
-            suffix = "";
+        	// Resource without extension
+        	basePath = contextPath;
+        	suffix = "";
         }
 
         LocalizedNameGenerator generator = new LocalizedNameGenerator(basePath, locale, suffix);
 
-        while(generator.more())
+        while (generator.more())
         {
             String candidatePath = generator.next();
 
@@ -79,4 +76,4 @@
     {
         return _context.getResource(path) != null;
     }
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/ServletWebContext.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/ServletWebContext.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/ServletWebContext.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/ServletWebContext.java Sat Mar 11 12:54:27 2006
@@ -14,9 +14,11 @@
 
 package org.apache.tapestry.web;
 
+import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.List;
+import java.util.Set;
 
 import javax.servlet.ServletContext;
 
@@ -37,18 +39,18 @@
 
     private final ServletContext _servletContext;
 
-    public void describeTo(DescriptionReceiver receiver)
-    {
-        receiver.describeAlternate(_servletContext);
-    }
-
     public ServletWebContext(ServletContext context)
     {
         Defense.notNull(context, "context");
 
         _servletContext = context;
     }
-
+    
+    public void describeTo(DescriptionReceiver receiver)
+    {
+        receiver.describeAlternate(_servletContext);
+    }
+    
     public List getAttributeNames()
     {
         return WebUtils.toSortedList(_servletContext.getAttributeNames());
@@ -96,4 +98,16 @@
     {
         return _servletContext.getMimeType(resourcePath);
     }
+
+	public String getRealPath(String path) {
+		return _servletContext.getRealPath(path);
+	}
+
+	public InputStream getResourceAsStream(String path) {
+		return _servletContext.getResourceAsStream(path);
+	}
+
+	public Set getResourcePaths(String path) {
+		return _servletContext.getResourcePaths(path);
+	}
 }

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebActivator.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebActivator.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebActivator.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebActivator.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -17,16 +17,13 @@
 import org.apache.tapestry.describe.Describable;
 
 /**
- * A wrapper around a {@link javax.servlet.http.HttpServlet} or
+ * A wrapper around a {@link javax.servlet.http.HttpServlet}&nbsp;or {@link *
  * {@link javax.portlet.Portlet}.
- * <p>
- * A better name for this would have been <em>entry point</em>.
  * 
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
 public interface WebActivator extends InitializationParameterHolder, Describable
 {
-
-    String getActivatorName();
-}
+    public String getActivatorName();
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebContext.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebContext.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebContext.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebContext.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -14,31 +14,64 @@
 
 package org.apache.tapestry.web;
 
+import java.io.InputStream;
 import java.net.URL;
+import java.util.Set;
 
 import org.apache.tapestry.describe.Describable;
 
 /**
- * A representation of a set of servlets (or portlets) packaged together as a
- * web application archive. Attributes stored within the context are global to
- * all 'lets (but not distributed across a server cluster).
+ * A representation of a set of servlets (or portlets) packaged together as a web application
+ * archive. Attributes stored within the context are global to all 'lets (but not distributed across
+ * a server cluster).
  * 
  * @author Howard M. Lewis Ship
  */
 public interface WebContext extends AttributeHolder, InitializationParameterHolder, Describable
 {
-
     /**
-     * Returns a URL to the resource that is mapped to a specified path. The
-     * path must begin with a "/" and is interpreted as relative to the current
-     * context root.
+     * Returns a URL to the resource that is mapped to a specified path. The path must begin with a
+     * "/" and is interpreted as relative to the current context root.
      */
 
-    URL getResource(String path);
+    public URL getResource(String path);
 
     /**
-     * Returns the MIME type of the specified file, or null if the MIME type is
-     * not known.
+     * Returns the MIME type of the specified file, or null if the MIME type is not known.
+     */
+    public String getMimeType(String resourcePath);
+    
+    /**
+     * Returns a directory-like listing of all the paths to resources within 
+     * the web application whose longest sub-path matches the supplied 
+     * path argument. Paths indicating subdirectory paths end with a slash (/). 
+     * The returned paths are all relative to the root of the web application 
+     * and have a leading '/'. 
+     * @param path  partial path used to match the resources, which must start with a '/'
+     * @return a Set containing the directory listing, or null if there are no resources 
+     * in the web application whose path begins with the supplied path.
+     */
+    public Set getResourcePaths(String path);
+    
+    /**
+     * Returns the resource located at the named path as an <code>InputStream</code>
+     * object.
+     * @param path a <code>String</code> specifying the path to the resource
+     * @return the <code>InputStream</code> returned to the servlet, 
+     * 	or <code>null</code> if no resource exists at the specified path
+     */
+    public InputStream getResourceAsStream(String path);
+    
+    /**
+     * Returns a <code>String</code> containing the real path for a given virtual path. 
+     * For example, the path "/index.html" returns the absolute file path 
+     * on the server's filesystem would be served by a request for 
+     * "http://host/contextPath/index.html", where contextPath is the 
+     * context path of this WebContext.
+     * 
+     * @param path a <code>String</code> specifying a virtual path
+     * @return a <code>String</code> specifying the real path, or <code>null</code> if the 
+     * 	translation cannot be performed
      */
-    String getMimeType(String resourcePath);
-}
+    public String getRealPath(String path);
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebContextResource.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebContextResource.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebContextResource.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebContextResource.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -22,8 +22,8 @@
 import org.apache.hivemind.util.LocalizedResource;
 
 /**
- * Implementation of {@link org.apache.hivemind.Resource}for resources found
- * within a {@link org.apache.tapestry.web.WebContext}.
+ * Implementation of {@link org.apache.hivemind.Resource}for resources found within a
+ * {@link org.apache.tapestry.web.WebContext}.
  * 
  * @author Howard Lewis Ship
  * @since 4.0
@@ -31,7 +31,6 @@
 
 public class WebContextResource extends AbstractResource
 {
-
     private WebContext _context;
 
     public WebContextResource(WebContext context, String path)
@@ -58,14 +57,17 @@
         String path = getPath();
         LocalizedResource localizedResource = finder.resolve(path, locale);
 
-        if (localizedResource == null) return null;
+        if (localizedResource == null)
+            return null;
 
         String localizedPath = localizedResource.getResourcePath();
         Locale pathLocale = localizedResource.getResourceLocale();
 
-        if (localizedPath == null) return null;
+        if (localizedPath == null)
+            return null;
 
-        if (path.equals(localizedPath)) return this;
+        if (path.equals(localizedPath))
+            return this;
 
         return new WebContextResource(_context, localizedPath, pathLocale);
     }
@@ -90,4 +92,4 @@
         return new WebContextResource(_context, path);
     }
 
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebMessages.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebMessages.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebMessages.java Sat Mar 11 12:54:27 2006
@@ -14,7 +14,6 @@
 
 package org.apache.tapestry.web;
 
-import org.apache.hivemind.Messages;
 import org.apache.hivemind.impl.MessageFormatter;
 import org.apache.tapestry.util.ContentType;
 
@@ -22,53 +21,47 @@
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
-final class WebMessages
+class WebMessages
 {
-
-    private static final Messages MESSAGES = new MessageFormatter(WebMessages.class);
-
-    /** @since 4.1 */
-    private WebMessages()
-    {
-    }
+    private final static MessageFormatter _formatter = new MessageFormatter(WebMessages.class);
 
     static String streamOpenError(ContentType contentType, Throwable cause)
     {
-        return MESSAGES.format("stream-open-error", contentType, cause);
+        return _formatter.format("stream-open-error", contentType, cause);
     }
 
     static String errorGettingResource(String path, Throwable ex)
     {
-        return MESSAGES.format("error-getting-resource", path, ex);
+        return _formatter.format("error-getting-resource", path, ex);
     }
 
     static String unableToFindDispatcher(String url)
     {
-        return MESSAGES.format("unable-to-find-dispatcher", url);
+        return _formatter.format("unable-to-find-dispatcher", url);
     }
 
     static String unableToForward(String url, Throwable cause)
     {
-        return MESSAGES.format("unable-to-forward", url, cause);
+        return _formatter.format("unable-to-forward", url, cause);
     }
 
     static String unableToRedirect(String url, Throwable cause)
     {
-        return MESSAGES.format("unable-to-redirect", url, cause);
+        return _formatter.format("unable-to-redirect", url, cause);
     }
 
     static String writerOpenError(ContentType contentType, Throwable cause)
     {
-        return MESSAGES.format("writer-open-error", contentType, cause);
+        return _formatter.format("writer-open-error", contentType, cause);
     }
 
     static String resetFailed(Throwable cause)
     {
-        return MESSAGES.format("reset-failed", cause);
+        return _formatter.format("reset-failed", cause);
     }
 
     static String contentTypeUnchanged(ContentType existing, ContentType requested)
     {
-        return MESSAGES.format("content-type-unchanged", existing, requested);
+        return _formatter.format("content-type-unchanged", existing, requested);
     }
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebRequest.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebRequest.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebRequest.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebRequest.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -21,186 +21,175 @@
 import org.apache.tapestry.describe.Describable;
 
 /**
- * Contains information about the current request, including URLs, schemes,
- * parameters, properties and attributes. This is essentially a generic version
- * of {@link javax.servlet.http.HttpServletRequest}. In some cases, certain
- * methods will be unsupported in some implementations (such as
- * {@link #getHeader(String)} for Portlet Tapestry).
+ * Contains information about the current request, including URLs, schemes, parameters, properties
+ * and attributes. This is essentially a generic version of
+ * {@link javax.servlet.http.HttpServletRequest}. In some cases, certain methods will be
+ * unsupported in some implementations (such as {@link #getHeader(String)} for Portlet Tapestry).
  * 
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
 public interface WebRequest extends AttributeHolder, Describable
 {
-
     /**
-     * Returns the names of all query parameters for this request. Note that
-     * this may return an empty list if an HTML form submission uploads files
-     * (with a request encoding of multipart/form-data). Accessing query
-     * parameters in such an event requires parsing of the request input stream.
+     * Returns the names of all query parameters for this request. Note that this may return an
+     * empty list if an HTML form submission uploads files (with a request encoding of
+     * multipart/form-data). Accessing query parameters in such an event requires parsing of the
+     * request input stream.
      * 
      * @returns List of Strings, in ascending alphabetical order
      */
 
-    List getParameterNames();
+    public List getParameterNames();
 
     /**
-     * Returns a parameter value. If the parameter was submitted with multiple
-     * values, then the first submitted value is returned. May return null if no
-     * parameter was submitted with the given name.
+     * Returns a parameter value. If the parameter was submitted with multiple values, then the
+     * first submitted value is returned. May return null if no parameter was submitted with the
+     * given name.
      * 
      * @param parameterName
      *            name of parameter to obtain
-     * @return the corresponding value, or null if a value for the parameter was
-     *         not submitted in the request
+     * @return the corresponding value, or null if a value for the parameter was not submitted in
+     *         the request
      * @see #getParameterValues(String)
      */
 
-    String getParameterValue(String parameterName);
+    public String getParameterValue(String parameterName);
 
     /**
-     * Returns all parameter values for a particular parameter name. May return
-     * null.
+     * Returns all parameter values for a particular parameter name. May return null.
      * <p>
      * The caller should <em>not modify</em> the returned value.
      * 
      * @param parameterName
      *            name of parameter to obtain
-     * @return the corresponding values, or null if no values for the parameter
-     *         were submitted in the request
+     * @return the corresponding values, or null if no values for the parameter were submitted in
+     *         the request
      * @see #getParameterValue(String)
      */
 
-    String[] getParameterValues(String parameterName);
+    public String[] getParameterValues(String parameterName);
 
     /**
-     * Returns the portion of the request URI that indicates the context of the
-     * request. The context path always comes first in a request URI. The path
-     * starts with a "/" character but does not end with a "/" character.
+     * Returns the portion of the request URI that indicates the context of the request. The context
+     * path always comes first in a request URI. The path starts with a "/" character but does not
+     * end with a "/" character.
      */
 
-    String getContextPath();
+    public String getContextPath();
 
     /**
-     * Returns the current {@link WebSession}associated with this request,
-     * possibly creating it if it does not already exist. If create is false and
-     * the request has no valid session, this method returns null. To make sure
-     * the session is properly maintained, you must call this method
-     * <em>before</em> the response is committed.
+     * Returns the current {@link WebSession}associated with this request, possibly creating it if
+     * it does not already exist. If create is false and the request has no valid session, this
+     * method returns null. To make sure the session is properly maintained, you must call this
+     * method <em>before</em> the response is committed.
      * 
      * @param create
-     *            if true, the session will be created and returned if it does
-     *            not already exist
+     *            if true, the session will be created and returned if it does not already exist
      * @returns The session, or null if it does not exist (and create is false)
      */
-    WebSession getSession(boolean create);
+    public WebSession getSession(boolean create);
 
     /**
-     * Returns the name of the scheme used to make this request. For example,
-     * http, https, or ftp. Different schemes have different rules for
-     * constructing URLs, as noted in RFC 1738.
+     * Returns the name of the scheme used to make this request. For example, http, https, or ftp.
+     * Different schemes have different rules for constructing URLs, as noted in RFC 1738.
      */
-    String getScheme();
+    public String getScheme();
 
     /**
-     * Returns the host name of the server that received the request. Note that
-     * behind a firewall, this may be obscured (i.e., it may be the name of the
-     * firewall server, which is not necessarily visible to clients outside the
-     * firewall).
+     * Returns the host name of the server that received the request. Note that behind a firewall,
+     * this may be obscured (i.e., it may be the name of the firewall server, which is not
+     * necessarily visible to clients outside the firewall).
      * 
      * @see org.apache.tapestry.request.IRequestDecoder
      */
 
-    String getServerName();
+    public String getServerName();
 
     /**
      * Returns the port number on which this request was received.
      */
 
-    int getServerPort();
+    public int getServerPort();
 
     /**
-     * Returns the path portion of the request which triggered this request.
-     * Query parameters, scheme, server and port are omitted.
+     * Returns the path portion of the request which triggered this request. Query parameters,
+     * scheme, server and port are omitted.
      * <p>
      * Note: portlets do not know their request URI.
      */
 
-    String getRequestURI();
+    public String getRequestURI();
 
     /**
-     * Redirects to the indicated URL. If the URL is local, then a forward
-     * occurs. Otherwise, a client side redirect is returned to the client
-     * browser.
+     * Redirects to the indicated URL. If the URL is local, then a forward occurs. Otherwise, a
+     * client side redirect is returned to the client browser.
      */
 
-    void forward(String URL);
+    public void forward(String URL);
 
     /**
-     * Returns the path of the resource which activated this request (this is
-     * the equivalent of the servlet path for a servlet request). The activation
-     * path will not end with a slash.
+     * Returns the path of the resource which activated this request (this is the equivalent of the
+     * servlet path for a servlet request). The activation path will not end with a slash.
      * 
-     * @returns the full servlet path (for servlet requests), or a blank string
-     *          (for portlet requests).
+     * @returns the full servlet path (for servlet requests), or a blank string (for portlet
+     *          requests).
      */
-    String getActivationPath();
+    public String getActivationPath();
 
     /**
-     * Return any additional path info beyond the servlet path itself. Path
-     * info, if non-null, begins with a path.
+     * Return any additional path info beyond the servlet path itself. Path info, if non-null,
+     * begins with a path.
      * 
      * @return path info, or null if no path info
      */
 
-    String getPathInfo();
+    public String getPathInfo();
 
     /**
-     * Returns the preferred locale to which content should be localized, as
-     * specified by the client or by the container. May return null.
+     * Returns the preferred locale to which content should be localized, as specified by the client
+     * or by the container. May return null.
      */
-    Locale getLocale();
+    public Locale getLocale();
 
     /**
      * Returns the value of the specified request header.
      * 
      * @param name
      *            the name of the header to retrieve
-     * @return the header value as a string, or null if the header is not in the
-     *         request.
+     * @return the header value as a string, or null if the header is not in the request.
      */
 
-    String getHeader(String name);
+    public String getHeader(String name);
 
     /**
-     * Returns the login of the user making this request, if the user has been
-     * authenticated, or null if the user has not been authenticated.
+     * Returns the login of the user making this request, if the user has been authenticated, or
+     * null if the user has not been authenticated.
      * 
-     * @return a String specifying the login of the user making this request, or
-     *         null if the user login is not known.
+     * @return a String specifying the login of the user making this request, or null if the user
+     *         login is not known.
      */
 
-    String getRemoteUser();
+    public String getRemoteUser();
 
     /**
-     * Returns a java.security.Principal object containing the name of the
-     * current authenticated user.
+     * Returns a java.security.Principal object containing the name of the current authenticated
+     * user.
      * 
-     * @return a java.security.Principal containing the name of the user making
-     *         this request, or null if the user has not been authenticated.
+     * @return a java.security.Principal containing the name of the user making this request, or
+     *         null if the user has not been authenticated.
      */
-    Principal getUserPrincipal();
+    public Principal getUserPrincipal();
 
     /**
-     * * Returns a boolean indicating whether the authenticated user is included
-     * in the specified logical "role". Roles and role membership can be defined
-     * using deployment descriptors. If the user has not been authenticated, the
-     * method returns false.
+     * * Returns a boolean indicating whether the authenticated user is included in the specified
+     * logical "role". Roles and role membership can be defined using deployment descriptors. If the
+     * user has not been authenticated, the method returns false.
      * 
      * @param role
      *            a String specifying the name of the role
-     * @return a boolean indicating whether the user making this request belongs
-     *         to a given role; false if the user has not been authenticated.
+     * @return a boolean indicating whether the user making this request belongs to a given role;
+     *         false if the user has not been authenticated.
      */
-    boolean isUserInRole(String role);
-}
+    public boolean isUserInRole(String role);
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebResponse.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebResponse.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebResponse.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebResponse.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -21,63 +21,58 @@
 import org.apache.tapestry.util.ContentType;
 
 /**
- * Controls the response to the client, and specifically allows for creating the
- * output stream (or print writer) to which content is sent. This is essentially
- * a generic version of {@link javax.servlet.http.HttpServletResponse}. Some
- * operations may be unsupported in some implementations (for example, the
- * portlet implementation can't handle any of the setHeader methods).
+ * Controls the response to the client, and specifically allows for creating the output stream (or
+ * print writer) to which content is sent. This is essentially a generic version of
+ * {@link javax.servlet.http.HttpServletResponse}. Some operations may be unsupported in some
+ * implementations (for example, the portlet implementation can't handle any of the setHeader
+ * methods).
  * 
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
 public interface WebResponse
 {
-
     /**
-     * Returns a output stream to which output should be sent. This method
-     * should only be invoked once on a response.
+     * Returns a output stream to which output should be sent. This method should only be invoked
+     * once on a response.
      * 
      * @return the output stream, configured for the given type.
      */
 
-    OutputStream getOutputStream(ContentType contentType)
-        throws IOException;
+    public OutputStream getOutputStream(ContentType contentType) throws IOException;
 
     /**
-     * Returns a {@link PrintWriter} to which output should be sent. This method
-     * should be invoked once on a response. A second call is expected to be so
-     * that an exception page can be rendered, and the underlying request data
-     * is reset.
+     * Returns a {@link PrintWriter} to which output should be sent. This method should be invoked
+     * once on a response. A second call is expected to be so that an exception page can be
+     * rendered, and the underlying request data is reset.
      */
 
-    PrintWriter getPrintWriter(ContentType contentType)
-        throws IOException;
+    public PrintWriter getPrintWriter(ContentType contentType) throws IOException;
 
     /**
-     * Encodes a URL, which adds information to the URL needed to ensure that
-     * the request triggered by the URL will be associated with the current
-     * session (if any). In most cases, the string is returned unchanged.
+     * Encodes a URL, which adds information to the URL needed to ensure that the request triggered
+     * by the URL will be associated with the current session (if any). In most cases, the string is
+     * returned unchanged.
      */
 
-    String encodeURL(String url);
+    public String encodeURL(String url);
 
     /**
-     * Resets any buffered content. This may be used after an error to radically
-     * change what the output will be.
+     * Resets any buffered content. This may be used after an error to radically change what the
+     * output will be.
      */
 
-    void reset();
+    public void reset();
 
-    void setContentLength(int contentLength);
+    public void setContentLength(int contentLength);
 
     /**
-     * Returns a value to be prefixed or suffixed with any client-side
-     * JavaScript elements (variables and function names) to ensure that they
-     * are unique with the context of the entire page. For servlets, this is the
-     * empty string.
+     * Returns a value to be prefixed or suffixed with any client-side JavaScript elements
+     * (variables and function names) to ensure that they are unique with the context of the entire
+     * page. For servlets, this is the empty string.
      */
 
-    String getNamespace();
+    public String getNamespace();
 
     /**
      * Sets a response header as a date.
@@ -87,7 +82,7 @@
      * @param date
      *            the date value to set, in milliseconds since the epoch
      */
-    void setDateHeader(String name, long date);
+    public void setDateHeader(String name, long date);
 
     /**
      * Sets a response header as a string.
@@ -98,7 +93,7 @@
      *            the value for the named header
      */
 
-    void setHeader(String name, String value);
+    public void setHeader(String name, String value);
 
     /**
      * Sets a response header with the given name and integer value.
@@ -108,17 +103,16 @@
      * @param value
      *            the value for the named header
      */
-    void setIntHeader(String name, int value);
+    public void setIntHeader(String name, int value);
 
     /**
      * Sets the status code for this response.
      */
-    void setStatus(int status);
+    public void setStatus(int status);
 
     /**
      * Sends an error response.
      */
 
-    void sendError(int statusCode, String message)
-        throws IOException;
-}
+    public void sendError(int statusCode, String message) throws IOException;
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebSession.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebSession.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebSession.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebSession.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -24,21 +24,19 @@
  */
 public interface WebSession extends AttributeHolder, Describable
 {
-
     /**
-     * Returns a unique string identifier used to identify the session. This
-     * value is provided by the container, and is typically incorporated into
-     * URLs, or stored as a HTTP cookie.
+     * Returns a unique string identifier used to identify the session. This value is provided by
+     * the container, and is typically incorporated into URLs, or stored as a HTTP cookie.
      * 
      * @see org.apache.tapestry.web.WebResponse#encodeURL(String).
      */
-    String getId();
+    public String getId();
 
     /**
-     * Returns true if the client does not yet know about the session or if the
-     * client chooses not to join the session.
+     * Returns true if the client does not yet know about the session or if the client chooses not
+     * to join the session.
      */
-    boolean isNew();
+    public boolean isNew();
 
     /**
      * Invalidates this session then unbinds any objects bound to it.
@@ -47,5 +45,5 @@
      *             if the session is already invalidated.
      */
 
-    void invalidate();
-}
+    public void invalidate();
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebUtils.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebUtils.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/web/WebUtils.java Sat Mar 11 12:54:27 2006
@@ -25,18 +25,11 @@
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
-public final class WebUtils
+public class WebUtils
 {
-
-    /** @since 4.1 */
-
-    private WebUtils()
-    {
-    }
-
     /**
-     * Converts an Enumeration of Strings into an unmodifiable List of Strings,
-     * sorted into ascending order.
+     * Converts an Enumeration of Strings into an unmodifiable List of Strings, sorted into
+     * ascending order.
      */
 
     public static List toSortedList(Enumeration e)
@@ -44,13 +37,15 @@
         Defense.notNull(e, "e");
 
         List list = new ArrayList();
-        while(e.hasMoreElements())
+        while (e.hasMoreElements())
             list.add(e.nextElement());
 
-        if (list.isEmpty()) return Collections.EMPTY_LIST;
+        if (list.isEmpty())
+            return Collections.EMPTY_LIST;
 
         Collections.sort(list);
 
         return Collections.unmodifiableList(list);
     }
-}
+
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/AbstractPostfield.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/AbstractPostfield.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/AbstractPostfield.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/AbstractPostfield.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -19,19 +19,17 @@
 import org.apache.tapestry.form.AbstractFormComponent;
 
 /**
- * A base class for building components that correspond to WML postfield
- * elements. All such components must be wrapped (directly or indirectly) by a
- * {@link Go}component.
+ * A base class for building components that correspond to WML postfield elements. All such
+ * components must be wrapped (directly or indirectly) by a {@link Go}component.
  * 
  * @author David Solis
  * @since 3.0
  */
 
-public abstract class AbstractPostfield extends AbstractFormComponent {
-
+public abstract class AbstractPostfield extends AbstractFormComponent
+{
     /**
-     * @see org.apache.tapestry.form.AbstractFormComponent#renderFormComponent(org.apache.tapestry.IMarkupWriter,
-     *      org.apache.tapestry.IRequestCycle)
+     * @see org.apache.tapestry.form.AbstractFormComponent#renderFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
      */
     protected void renderFormComponent(IMarkupWriter writer, IRequestCycle cycle)
     {
@@ -40,8 +38,7 @@
         writer.attribute("name", getName());
 
         String varName = getVarName();
-        writer.attributeRaw("value",
-                varName != null ? getEncodedVarName(varName) : "");
+        writer.attributeRaw("value", varName != null ? getEncodedVarName(varName) : "");
 
         renderInformalParameters(writer, cycle);
 
@@ -64,4 +61,4 @@
     {
         getBinding("value").setObject(value);
     }
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Go.jwc
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Go.jwc?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Go.jwc (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Go.jwc Sat Mar 11 12:54:27 2006
@@ -84,6 +84,13 @@
         </description>
     </parameter> 
     
+    <parameter name="port">
+        <description>
+        Forces the link to be generated as an absolute URL with the given port
+        (unless the port matches the port for the current request).
+        </description>
+    </parameter>
+  
 
     <reserved-parameter name="href"/>
     <reserved-parameter name="name"/>

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/GoLinkRenderer.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/GoLinkRenderer.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/GoLinkRenderer.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/GoLinkRenderer.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -18,20 +18,20 @@
 import org.apache.tapestry.link.ILinkRenderer;
 
 /**
- * A subclass of {@link org.apache.tapestry.link.DefaultLinkRenderer} for the
- * WML Go element.
- * 
- * @author David Solis
- * @since 3.0
- */
+ *  A subclass of {@link org.apache.tapestry.link.DefaultLinkRenderer} for
+ *  the WML Go element.
+ *
+ *  @author David Solis
+ *  @since 3.0
+ **/
 public class GoLinkRenderer extends DefaultLinkRenderer
 {
 
-    /**
-     * A singleton for the go link.
-     */
+	/**
+	 *  A singleton for the go link. 
+	 **/
 
-    public static final ILinkRenderer SHARED_INSTANCE = new GoLinkRenderer();
+	 public static final ILinkRenderer SHARED_INSTANCE = new GoLinkRenderer();
 
     public String getElement()
     {

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Image.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Image.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Image.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Image.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -20,20 +20,19 @@
 import org.apache.tapestry.IRequestCycle;
 
 /**
- * The Image component indicates that an image is to be included in the text
- * flow. Image layout is done within the context of normal text layout.
- * 
- * @author David Solis
- * @since 3.0
- */
+ *  The Image component indicates that an image is to be included in the text flow. Image layout is done within the
+ *  context of normal text layout.
+ *
+ *  @author David Solis
+ *  @since 3.0
+ *
+ **/
 
 public abstract class Image extends AbstractComponent
 {
-
     /**
-     * @see org.apache.tapestry.AbstractComponent#renderComponent(org.apache.tapestry.IMarkupWriter,
-     *      org.apache.tapestry.IRequestCycle)
-     */
+     *  @see org.apache.tapestry.AbstractComponent#renderComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
+     **/
 
     protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
     {
@@ -55,5 +54,5 @@
 
     public abstract IAsset getImage();
 
-    public abstract String getAlt();
+	public abstract String getAlt();
 }

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Input.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Input.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Input.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Input.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -46,18 +46,22 @@
             writer.attribute("name", getName());
 
             String title = getTitle();
-            if (HiveMind.isNonBlank(title)) writer.attribute("title", title);
+            if (HiveMind.isNonBlank(title))
+                writer.attribute("title", title);
 
             String format = getFormat();
-            if (HiveMind.isNonBlank(format)) writer.attribute("format", format);
+            if (HiveMind.isNonBlank(format))
+                writer.attribute("format", format);
 
             boolean emptyok = isEmptyok();
-            if (emptyok) writer.attribute("emptyok", emptyok);
+            if (emptyok != false)
+                writer.attribute("emptyok", emptyok);
 
             renderInformalParameters(writer, cycle);
 
             String value = getValue();
-            if (HiveMind.isNonBlank(value)) writer.attribute("value", value);
+            if (HiveMind.isNonBlank(value))
+                writer.attribute("value", value);
 
             writer.closeTag();
         }
@@ -75,4 +79,4 @@
 
     public abstract String getValue();
 
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/OptionRenderer.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/OptionRenderer.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/OptionRenderer.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/OptionRenderer.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -18,21 +18,23 @@
 import org.apache.tapestry.link.ILinkRenderer;
 
 /**
- * Implementation of {@link org.apache.tapestry.link.ILinkRenderer} for the WML
- * Option element. The value attribute is reserved.
- * 
- * @author David Solis
- * @since 3.0
- */
+ *  Implementation of {@link org.apache.tapestry.link.ILinkRenderer} for
+ *  the WML Option element.
+ *
+ *  The value attribute is reserved.
+ *
+ *  @author David Solis
+ *  @since 3.0
+ *
+ **/
 
 public class OptionRenderer extends DefaultLinkRenderer
 {
+	/**
+	 *  A singleton for the option link.
+	 **/
 
-    /**
-     * A singleton for the option link.
-     */
-
-    public static final ILinkRenderer SHARED_INSTANCE = new OptionRenderer();
+	 public static final ILinkRenderer SHARED_INSTANCE = new OptionRenderer();
 
     protected String getElement()
     {

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Timer.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Timer.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Timer.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/Timer.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -20,9 +20,8 @@
 import org.apache.tapestry.IRequestCycle;
 
 /**
- * The Timer element declares a card timer, which exposes a means of processing
- * inactivity or idle time. The timer is initialised and started at card entry
- * and is stopped when the card is exited.
+ * The Timer element declares a card timer, which exposes a means of processing inactivity or idle
+ * time. The timer is initialised and started at card entry and is stopped when the card is exited.
  * 
  * @author David Solis
  * @since 3.0
@@ -30,7 +29,6 @@
 
 public abstract class Timer extends AbstractComponent
 {
-
     /**
      * @see AbstractComponent#renderComponent(IMarkupWriter, IRequestCycle)
      */
@@ -48,7 +46,8 @@
             String value = getValue();
             if (HiveMind.isNonBlank(value))
                 writer.attribute("value", value);
-            else writer.attribute("value", "0");
+            else
+                writer.attribute("value", "0");
 
             renderInformalParameters(writer, cycle);
 
@@ -61,4 +60,4 @@
     /** @since 4.0 */
 
     public abstract String getValue();
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLCharacterTranslatorSource.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLCharacterTranslatorSource.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLCharacterTranslatorSource.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLCharacterTranslatorSource.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -22,41 +22,46 @@
 import org.apache.tapestry.util.text.MarkupCharacterTranslator;
 
 /**
- * The WML implementation of a character translator source. Returns a WML
- * translator that encodes everything that is non-safe. Some code borrowed from
- * WMLWriter (by David Solis)
+ * The WML implementation of a character translator source.
+ * Returns a WML translator that encodes everything that is non-safe.
+ * 
+ * Some code borrowed from WMLWriter (by David Solis)
  * 
  * @author mb
  * @since 4.0
  */
 public class WMLCharacterTranslatorSource implements ICharacterTranslatorSource
 {
-
-    private static final String SAFE_CHARACTERS = "01234567890" + "abcdefghijklmnopqrstuvwxyz"
-            + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "\t\n\r !\"#%'()*+,-./:;=?@[\\]^_`{|}~";
-
-    private static final String[][] ENTITIES = { { "\"", "&quot;" }, { "<", "&lt;" }, { ">", "&gt;" },
-            { "&", "&amp;" }, { "$", "$$" } };
+    private static final String SAFE_CHARACTERS =
+        "01234567890"
+            + "abcdefghijklmnopqrstuvwxyz"
+            + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+            + "\t\n\r !\"#%'()*+,-./:;=?@[\\]^_`{|}~";
+
+    private static final String[][] ENTITIES = {
+        	{ "\"", "&quot;" }, 
+    		{ "<", "&lt;" },
+    		{ ">", "&gt;" },
+    		{ "&", "&amp;" },
+    		{ "$", "$$" }
+        };
 
     private static final ICharacterMatcher SAFE_MATCHER = new AsciiCharacterMatcher(SAFE_CHARACTERS);
     private static final ICharacterTranslator ENTITY_TRANSLATOR = new AsciiCharacterTranslator(ENTITIES);
 
-    private static final ICharacterTranslator WML_TRANSLATOR = new MarkupCharacterTranslator(true, SAFE_MATCHER,
-            ENTITY_TRANSLATOR);
+    private static final ICharacterTranslator WML_TRANSLATOR = new MarkupCharacterTranslator(true, SAFE_MATCHER, ENTITY_TRANSLATOR);
 
-    /**
-     * @see org.apache.tapestry.util.text.ICharacterTranslatorSource#getDefaultTranslator()
-     */
-    public ICharacterTranslator getDefaultTranslator()
-    {
-        return WML_TRANSLATOR;
-    }
-
-    /**
-     * @see org.apache.tapestry.util.text.ICharacterTranslatorSource#getTranslator(java.lang.String)
-     */
-    public ICharacterTranslator getTranslator(String encoding)
-    {
-        return getDefaultTranslator();
-    }
+	/**
+	 * @see org.apache.tapestry.util.text.ICharacterTranslatorSource#getDefaultTranslator()
+	 */
+	public ICharacterTranslator getDefaultTranslator() {
+		return WML_TRANSLATOR;
+	}
+
+	/**
+	 * @see org.apache.tapestry.util.text.ICharacterTranslatorSource#getTranslator(java.lang.String)
+	 */
+	public ICharacterTranslator getTranslator(String encoding) {
+		return getDefaultTranslator();
+	}
 }

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLEngine.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLEngine.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLEngine.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLEngine.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -17,17 +17,16 @@
 import org.apache.tapestry.engine.BaseEngine;
 
 /**
- * Subclass of {@link BaseEngine} used for WML applications to change the
- * Exception, StaleLink and StaleSession pages.
+ * Subclass of {@link BaseEngine} used for WML applications to change the Exception, StaleLink and
+ * StaleSession pages.
  * 
  * @author David Solis
  * @since 3.0
- * @deprecated To be removed in 4.1. No longer necessary; the differences
- *             between WML applications and HTML applications are now handled
- *             via a startup mode. See
+ * @deprecated To be removed in 4.1. No longer necessary; the differences between WML applications
+ *             and HTML applications are now handled via a startup mode. See
  *             {@link org.apache.tapestry.services.impl.SetupServletApplicationGlobals}.
  */
 
 public class WMLEngine extends BaseEngine
 {
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLMarkupFilter.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLMarkupFilter.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLMarkupFilter.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/WMLMarkupFilter.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -22,9 +22,8 @@
  */
 public class WMLMarkupFilter extends AbstractMarkupFilter
 {
-
     public WMLMarkupFilter()
     {
         super(new WMLCharacterTranslatorSource().getDefaultTranslator());
     }
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/pages/WMLException.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/pages/WMLException.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/pages/WMLException.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/wml/pages/WMLException.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -26,7 +26,6 @@
  */
 public abstract class WMLException extends Deck
 {
-
     private ExceptionDescription[] _exceptions;
 
     public void initialize()
@@ -47,4 +46,4 @@
 
         _exceptions = analyzer.analyze(value);
     }
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/js/build.xml
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/js/build.xml?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/js/build.xml (original)
+++ jakarta/tapestry/trunk/framework/src/js/build.xml Sat Mar 11 12:54:27 2006
@@ -1,4 +1,3 @@
-<?xml version="1.0"?>
 <!-- 
    Copyright 2004, 2005 The Apache Software Foundation
 

Added: jakarta/tapestry/trunk/framework/src/js/tapestry/widget/templates/images/dateIcon.gif.merge-left.r0
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/js/tapestry/widget/templates/images/dateIcon.gif.merge-left.r0?rev=385164&view=auto
==============================================================================
    (empty)

Added: jakarta/tapestry/trunk/framework/src/js/tapestry/widget/templates/images/dateIcon.gif.merge-right.r384672
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/js/tapestry/widget/templates/images/dateIcon.gif.merge-right.r384672?rev=385164&view=auto
==============================================================================
Binary file - no diff available.

Propchange: jakarta/tapestry/trunk/framework/src/js/tapestry/widget/templates/images/dateIcon.gif.merge-right.r384672
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: jakarta/tapestry/trunk/framework/src/scripts/TestUpload.xml
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/scripts/TestUpload.xml?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/scripts/TestUpload.xml (original)
+++ jakarta/tapestry/trunk/framework/src/scripts/TestUpload.xml Sat Mar 11 12:54:27 2006
@@ -110,6 +110,11 @@
 		
 	</request>
 	
+	<!-- IMPORTANT NOTE: commons-fileupload-1.1 has a bug that converts file path and
+	     file name to lowercase. This is accounted for in the next test: the name
+	     of the file should be Tapestry-Banner.png.
+	     When this bug is fixed (fileupload 1.2), this test should be updated accordingly
+	  -->
 	<request 
 		content-type="multipart/form-data; boundary=---------------------------9d33212e1c03e3" 
 		content-path="context19/upload-image.request">
@@ -125,11 +130,11 @@
 		</assert-output>
 		
 		<assert-output name="Path">
-		Path: [context19/Tapestry-Banner.png]
+		Path: [context19/tapestry-banner.png]
 		</assert-output>
 		
 		<assert-output name="Name">
-		Name: [Tapestry-Banner.png]
+		Name: [tapestry-banner.png]
 		</assert-output>
 		
 		<assert-output name="Match Confirmation">

Modified: jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/BaseComponentTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/BaseComponentTestCase.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/BaseComponentTestCase.java (original)
+++ jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/BaseComponentTestCase.java Sat Mar 11 12:54:27 2006
@@ -47,10 +47,8 @@
  */
 public abstract class BaseComponentTestCase extends HiveMindTestCase
 {
-    protected CharArrayWriter _charArrayWriter;
-    
     private Creator _creator;
-    
+
     protected Creator getCreator()
     {
         if (_creator == null)
@@ -58,7 +56,9 @@
 
         return _creator;
     }
-    
+
+    protected CharArrayWriter _charArrayWriter;
+
     protected IMarkupWriter newBufferWriter()
     {
         _charArrayWriter = new CharArrayWriter();
@@ -437,10 +437,15 @@
         writer.getNestedWriter();
         setReturnValue(writer, nested);
     }
-
+    
     protected void trainGetURL(ILink link, String scheme, String anchor, String URL)
     {
-        link.getURL(scheme, null, 0, anchor, true);
+        trainGetURL(link, scheme, anchor, URL, 0);
+    }
+    
+    protected void trainGetURL(ILink link, String scheme, String anchor, String URL, int port)
+    {
+        link.getURL(scheme, null, port, anchor, true);
 
         setReturnValue(link, URL);
     }
@@ -497,4 +502,4 @@
         component.getId();
         setReturnValue(component, id);
     }
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/TestAbstractComponent.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/TestAbstractComponent.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/TestAbstractComponent.java (original)
+++ jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/TestAbstractComponent.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -19,16 +19,14 @@
 import org.apache.tapestry.test.Creator;
 
 /**
- * Tests a few new features of {@link org.apache.tapestry.AbstractComponent}&nbsp;added
- * in release 4.0.
+ * Tests a few new features of {@link org.apache.tapestry.AbstractComponent}&nbsp;added in release
+ * 4.0.
  * 
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
 public class TestAbstractComponent extends BaseComponentTestCase
 {
-
-    /** Test fixture. */
     private static class ConcreteComponent extends AbstractComponent
     {
 
@@ -61,7 +59,8 @@
         }
         catch (IllegalStateException ex)
         {
-            assertEquals(TapestryMessages.providedByEnhancement("getSpecification"), ex.getMessage());
+            assertEquals(TapestryMessages.providedByEnhancement("getSpecification"), ex
+                    .getMessage());
         }
     }
 
@@ -73,7 +72,7 @@
 
         replayControls();
 
-        IComponent component = (IComponent)creator.newInstance(BaseComponent.class);
+        IComponent component = (IComponent) creator.newInstance(BaseComponent.class);
 
         component.setContainedComponent(cc);
 
@@ -95,8 +94,8 @@
 
         replayControls();
 
-        IComponent component = (IComponent)creator.newInstance(BaseComponent.class, new Object[] { "page", page,
-                "container", page, "id", "barney" });
+        IComponent component = (IComponent) creator.newInstance(BaseComponent.class, new Object[]
+        { "page", page, "container", page, "id", "barney" });
 
         component.setContainedComponent(cc1);
 
@@ -108,8 +107,8 @@
         catch (ApplicationRuntimeException ex)
         {
             assertEquals(
-                    "Attempt to change containedComponent property of component Fred/barney, which is not allowed.", ex
-                            .getMessage());
+                    "Attempt to change containedComponent property of component Fred/barney, which is not allowed.",
+                    ex.getMessage());
         }
 
         verifyControls();
@@ -117,6 +116,6 @@
 
     private IContainedComponent newContainedComponent()
     {
-        return (IContainedComponent)newMock(IContainedComponent.class);
+        return (IContainedComponent) newMock(IContainedComponent.class);
     }
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/asset/ClasspathAssetFactoryTest.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/asset/ClasspathAssetFactoryTest.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/asset/ClasspathAssetFactoryTest.java (original)
+++ jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/asset/ClasspathAssetFactoryTest.java Sat Mar 11 12:54:27 2006
@@ -19,7 +19,6 @@
 import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.Location;
 import org.apache.hivemind.Resource;
-import org.apache.hivemind.impl.LocationImpl;
 import org.apache.hivemind.test.HiveMindTestCase;
 import org.apache.hivemind.util.ClasspathResource;
 import org.apache.tapestry.IAsset;
@@ -103,7 +102,7 @@
                 "/org/apache/tapestry/asset/relative-resource.txt",
                 Locale.FRENCH,
                 l);
-        
+
         assertTrue(asset instanceof PrivateAsset);
         assertEquals("/org/apache/tapestry/asset/relative-resource_fr.txt", asset
                 .getResourceLocation().getPath());
@@ -143,86 +142,6 @@
         verifyControls();
     }
 
-    public void testCreateDirectoryAsset()
-    {
-        IEngineService assetService = newService();
-        Location l = newLocation();
-        
-        replayControls();
-        
-        ClasspathAssetFactory factory = new ClasspathAssetFactory();
-        factory.setClassResolver(getClassResolver());
-        factory.setAssetService(assetService);
-        factory.setLocalizer(new DefaultResourceLocalizer());
-        
-        String path = "/org/apache/tapestry/html/dojo";
-        
-        Resource subResource = new ClasspathResource(getClassResolver(), path);
-        IAsset asset = factory.createAsset(subResource, l);
-        
-        assertTrue(asset instanceof PrivateAsset);
-        assertEquals(path, asset
-                .getResourceLocation().getPath());
-        assertSame(l, asset.getLocation());
-        
-        verifyControls();
-    }
-    
-    public void testCreateRelativeDirectoryAsset()
-    {
-        IEngineService assetService = newService();
-        Resource shell = new ClasspathResource(getClassResolver(),
-            "/org/apache/tapestry/html/Shell.jwc");
-        Location l = new LocationImpl(shell);
-        
-        replayControls();
-        
-        ClasspathAssetFactory factory = new ClasspathAssetFactory();
-        factory.setClassResolver(getClassResolver());
-        factory.setAssetService(assetService);
-        factory.setLocalizer(new DefaultResourceLocalizer());
-        
-        String path = "/org/apache/tapestry/html/dojo/dojo.js";
-        
-        IAsset asset = factory.createAsset(shell, path, 
-                Locale.getDefault(),
-                l);
-        
-        assertTrue(asset instanceof PrivateAsset);
-        assertEquals(path, asset
-                .getResourceLocation().getPath());
-        assertSame(l, asset.getLocation());
-        
-        verifyControls();
-    }
-    
-    /**
-     * Tests relative sub-directory paths.
-     */
-    public void testRelativeDirectoryPath()
-    {
-        IEngineService assetService = newService();
-        Location l = newLocation();
-        
-        replayControls();
-        
-        ClasspathAssetFactory factory = new ClasspathAssetFactory();
-        factory.setClassResolver(getClassResolver());
-        factory.setAssetService(assetService);
-        factory.setLocalizer(new DefaultResourceLocalizer());
-        
-        Resource subResource = new ClasspathResource(getClassResolver(),
-                "/org/apache/tapestry/asset/subresource/sub-resource.txt");
-        IAsset asset = factory.createAsset(subResource, l);
-        
-        assertTrue(asset instanceof PrivateAsset);
-        assertEquals("/org/apache/tapestry/asset/subresource/sub-resource.txt",
-                asset.getResourceLocation().getPath());
-        assertSame(l, asset.getLocation());
-        
-        verifyControls();
-    }
-    
     private ClasspathResource newBaseResource()
     {
         return new ClasspathResource(getClassResolver(),

Modified: jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/asset/ContextAssetFactoryTest.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/asset/ContextAssetFactoryTest.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/asset/ContextAssetFactoryTest.java (original)
+++ jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/asset/ContextAssetFactoryTest.java Sat Mar 11 12:54:27 2006
@@ -1,205 +1,233 @@
-// Copyright 2005 The Apache Software Foundation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package org.apache.tapestry.asset;
-
-import java.net.URL;
-import java.util.Locale;
-
-import org.apache.hivemind.ApplicationRuntimeException;
-import org.apache.hivemind.Location;
-import org.apache.hivemind.Resource;
-import org.apache.hivemind.test.HiveMindTestCase;
-import org.apache.tapestry.IAsset;
-import org.apache.tapestry.l10n.DefaultResourceLocalizer;
-import org.apache.tapestry.web.WebContext;
-
-/** Test for {@link org.apache.tapestry.asset.ContextAssetFactory}.
- *  
- * @author Howard M. Lewis Ship
- * @since 4.0
- */
-public class ContextAssetFactoryTest extends HiveMindTestCase
-{
-    protected Resource newResource()
-    {
-        return (Resource) newMock(Resource.class);
-    }
-
-    protected URL newURL()
-    {
-        return getClass().getResource("base-resource.txt");
-    }
-
-    public void testCreateAsset()
-    {
-        Resource base = newResource();
-        Resource relative = newResource();
-        Resource localized = newResource();
-        Location l = newLocation();
-        URL url = newURL();
-
-        trainGetRelativeResource(base, "asset.png", relative);
-        trainGetResourceURL(relative, url);
-        trainGetLocalization(relative, Locale.FRENCH, localized);
-
-        replayControls();
-
-        ContextAssetFactory factory = new ContextAssetFactory();
-        factory.setLocalizer(new DefaultResourceLocalizer());
-
-        factory.setContextPath("/context");
-
-        IAsset asset = factory.createAsset(base, "asset.png", Locale.FRENCH, l);
-
-        assertTrue(asset instanceof ContextAsset);
-        assertSame(localized, asset.getResourceLocation());
-        assertSame(l, asset.getLocation());
-
-        verifyControls();
-    }
-
-    public void testCreateAssetMissing()
-    {
-        Resource base = newResource();
-        Resource relative = newResource();
-        Location l = newLocation();
-        trainGetRelativeResource(base, "asset.png", relative);
-        trainGetResourceURL(relative, null);
-        trainGetLocalization(relative, Locale.FRENCH, null);
-
-        replayControls();
-
-        ContextAssetFactory factory = new ContextAssetFactory();
-        factory.setLocalizer(new DefaultResourceLocalizer());
-        factory.setContextPath("/context");
-
-        try
-        {
-            factory.createAsset(base, "asset.png", Locale.FRENCH, l);
-            unreachable();
-        }
-        catch (ApplicationRuntimeException ex)
-        {
-            assertEquals(
-                    "Unable to locate resource 'asset.png' relative to EasyMock for interface org.apache.hivemind.Resource.",
-                    ex.getMessage());
-            assertSame(l, ex.getLocation());
-        }
-
-        verifyControls();
-    }
-
-    public void testCreateAssetForClasspath()
-    {
-        Resource base = newResource();
-        Resource relative = newResource();
-        Location l = newLocation();
-        AssetFactory classpathFactory = (AssetFactory) newMock(AssetFactory.class);
-        IAsset asset = (IAsset) newMock(IAsset.class);
-
-        trainGetRelativeResource(base, "/asset.png", relative);
-        trainGetResourceURL(relative, null);
-
-        classpathFactory.createAbsoluteAsset("/asset.png", Locale.FRENCH, l);
-        setReturnValue(classpathFactory, asset);
-
-        replayControls();
-
-        ContextAssetFactory factory = new ContextAssetFactory();
-
-        factory.setContextPath("/context");
-        factory.setClasspathAssetFactory(classpathFactory);
-
-        assertSame(asset, factory.createAsset(base, "/asset.png", Locale.FRENCH, l));
-
-        verifyControls();
-    }
-
-    public void testCreateAbsoluteAsset()
-    {
-        Location l = newLocation();
-        URL url = newURL();
-        WebContext context = (WebContext) newMock(WebContext.class);
-
-        trainGetResource(context, "/asset_fr.png", url);
-
-        replayControls();
-
-        ContextAssetFactory factory = new ContextAssetFactory();
-        factory.setLocalizer(new DefaultResourceLocalizer());
-        factory.setContextPath("/context");
-        factory.setWebContext(context);
-
-        IAsset asset = factory.createAbsoluteAsset("/asset.png", Locale.FRENCH, l);
-
-        assertTrue(asset instanceof ContextAsset);
-        assertEquals("/asset_fr.png", asset.getResourceLocation().getPath());
-        assertSame(l, asset.getLocation());
-
-        verifyControls();
-    }
-
-    public void testCreateAbsoluteAssetMissing()
-    {
-        Location l = newLocation();
-        WebContext context = (WebContext) newMock(WebContext.class);
-
-        trainGetResource(context, "/asset_fr.png", null);
-        trainGetResource(context, "/asset.png", null);
-
-        replayControls();
-
-        ContextAssetFactory factory = new ContextAssetFactory();
-        factory.setLocalizer(new DefaultResourceLocalizer());
-        factory.setContextPath("/context");
-        factory.setWebContext(context);
-
-        try
-        {
-            factory.createAbsoluteAsset("/asset.png", Locale.FRENCH, l);
-            unreachable();
-        }
-        catch (ApplicationRuntimeException ex)
-        {
-            assertEquals("Missing context resource '/asset.png'.", ex.getMessage());
-            assertSame(l, ex.getLocation());
-        }
-        verifyControls();
-    }
-
-    private void trainGetLocalization(Resource resource, Locale locale, Resource localized)
-    {
-        resource.getLocalization(locale);
-        setReturnValue(resource, localized);
-    }
-
-    protected void trainGetResourceURL(Resource resource, URL url)
-    {
-        resource.getResourceURL();
-        setReturnValue(resource, url);
-    }
-
-    protected void trainGetResource(WebContext context, String path, URL url)
-    {
-        context.getResource(path);
-        setReturnValue(context, url);
-    }
-
-    protected void trainGetRelativeResource(Resource base, String path, Resource relative)
-    {
-        base.getRelativeResource(path);
-        setReturnValue(base, relative);
-    }
-}
+// Copyright 2005 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.asset;
+
+import java.net.URL;
+import java.util.Locale;
+
+import org.apache.hivemind.ApplicationRuntimeException;
+import org.apache.hivemind.Location;
+import org.apache.hivemind.Resource;
+import org.apache.hivemind.test.HiveMindTestCase;
+import org.apache.tapestry.IAsset;
+import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.l10n.DefaultResourceLocalizer;
+import org.apache.tapestry.web.WebContext;
+
+public class ContextAssetFactoryTest extends HiveMindTestCase
+{
+    protected Resource newResource()
+    {
+        return (Resource) newMock(Resource.class);
+    }
+
+    protected URL newURL()
+    {
+        return getClass().getResource("base-resource.txt");
+    }
+
+    public void testCreateAsset()
+    {
+        Resource base = newResource();
+        Resource relative = newResource();
+        Resource localized = newResource();
+        Location l = newLocation();
+        URL url = newURL();
+
+        trainGetRelativeResource(base, "asset.png", relative);
+        trainGetResourceURL(relative, url);
+        trainGetLocalization(relative, Locale.FRENCH, localized);
+
+        replayControls();
+
+        ContextAssetFactory factory = new ContextAssetFactory();
+        factory.setLocalizer(new DefaultResourceLocalizer());
+
+        factory.setContextPath("/context");
+
+        IAsset asset = factory.createAsset(base, "asset.png", Locale.FRENCH, l);
+
+        assertTrue(asset instanceof ContextAsset);
+        assertSame(localized, asset.getResourceLocation());
+        assertSame(l, asset.getLocation());
+
+        verifyControls();
+    }
+
+    public void testCreateAssetMissing()
+    {
+        Resource base = newResource();
+        Resource relative = newResource();
+        Location l = newLocation();
+        trainGetRelativeResource(base, "asset.png", relative);
+        trainGetResourceURL(relative, null);
+        trainGetLocalization(relative, Locale.FRENCH, null);
+
+        replayControls();
+
+        ContextAssetFactory factory = new ContextAssetFactory();
+        factory.setLocalizer(new DefaultResourceLocalizer());
+        factory.setContextPath("/context");
+
+        try
+        {
+            factory.createAsset(base, "asset.png", Locale.FRENCH, l);
+            unreachable();
+        }
+        catch (ApplicationRuntimeException ex)
+        {
+            assertEquals(
+                    "Unable to locate resource 'asset.png' relative to EasyMock for interface org.apache.hivemind.Resource.",
+                    ex.getMessage());
+            assertSame(l, ex.getLocation());
+        }
+
+        verifyControls();
+    }
+
+    public void testCreateAssetForClasspath()
+    {
+        Resource base = newResource();
+        Resource relative = newResource();
+        Location l = newLocation();
+        AssetFactory classpathFactory = (AssetFactory) newMock(AssetFactory.class);
+        IAsset asset = (IAsset) newMock(IAsset.class);
+
+        trainGetRelativeResource(base, "/asset.png", relative);
+        trainGetResourceURL(relative, null);
+
+        classpathFactory.createAbsoluteAsset("/asset.png", Locale.FRENCH, l);
+        setReturnValue(classpathFactory, asset);
+
+        replayControls();
+
+        ContextAssetFactory factory = new ContextAssetFactory();
+
+        factory.setContextPath("/context");
+        factory.setClasspathAssetFactory(classpathFactory);
+
+        assertSame(asset, factory.createAsset(base, "/asset.png", Locale.FRENCH, l));
+
+        verifyControls();
+    }
+
+    public void testCreateAbsoluteAsset()
+    {
+        Location l = newLocation();
+        URL url = newURL();
+        WebContext context = (WebContext) newMock(WebContext.class);
+
+        trainGetResource(context, "/asset_fr.png", url);
+
+        replayControls();
+
+        ContextAssetFactory factory = new ContextAssetFactory();
+        factory.setLocalizer(new DefaultResourceLocalizer());
+        factory.setContextPath("/context");
+        factory.setWebContext(context);
+
+        IAsset asset = factory.createAbsoluteAsset("/asset.png", Locale.FRENCH, l);
+
+        assertTrue(asset instanceof ContextAsset);
+        assertEquals("/asset_fr.png", asset.getResourceLocation().getPath());
+        assertSame(l, asset.getLocation());
+
+        verifyControls();
+    }
+
+    public void testCreateAbsoluteAssetMissing()
+    {
+        Location l = newLocation();
+        WebContext context = (WebContext) newMock(WebContext.class);
+
+        trainGetResource(context, "/asset_fr.png", null);
+        trainGetResource(context, "/asset.png", null);
+
+        replayControls();
+
+        ContextAssetFactory factory = new ContextAssetFactory();
+        factory.setLocalizer(new DefaultResourceLocalizer());
+        factory.setContextPath("/context");
+        factory.setWebContext(context);
+
+        try
+        {
+            factory.createAbsoluteAsset("/asset.png", Locale.FRENCH, l);
+            unreachable();
+        }
+        catch (ApplicationRuntimeException ex)
+        {
+            assertEquals("Missing context resource '/asset.png'.", ex.getMessage());
+            assertSame(l, ex.getLocation());
+        }
+        verifyControls();
+    }
+    
+    public void testCreateAssetEncodeURL()
+    {
+        Location l = newLocation();
+        URL url = newURL();
+        WebContext context = (WebContext) newMock(WebContext.class);
+        IRequestCycle rc = (IRequestCycle) newMock(IRequestCycle.class);
+
+        trainGetResource(context, "/asset_fr.png", url);
+
+        trainEncodeURL(rc, "/context/asset_fr.png", "/context/asset_fr.png?encoded");
+        
+        replayControls();
+
+        ContextAssetFactory factory = new ContextAssetFactory();
+        factory.setLocalizer(new DefaultResourceLocalizer());
+        factory.setContextPath("/context");
+        factory.setWebContext(context);
+        factory.setRequestCycle(rc);
+
+        String assetUrl = factory.createAbsoluteAsset("/asset.png", Locale.FRENCH, l).buildURL();
+
+        assertTrue(assetUrl.endsWith("?encoded"));
+
+        verifyControls();
+    }
+
+    private void trainGetLocalization(Resource resource, Locale locale, Resource localized)
+    {
+        resource.getLocalization(locale);
+        setReturnValue(resource, localized);
+    }
+
+    protected void trainGetResourceURL(Resource resource, URL url)
+    {
+        resource.getResourceURL();
+        setReturnValue(resource, url);
+    }
+
+    protected void trainGetResource(WebContext context, String path, URL url)
+    {
+        context.getResource(path);
+        setReturnValue(context, url);
+    }
+
+    protected void trainGetRelativeResource(Resource base, String path, Resource relative)
+    {
+        base.getRelativeResource(path);
+        setReturnValue(base, relative);
+    }
+
+    protected void trainEncodeURL(IRequestCycle rc, String URL, String encodedURL)
+    {
+        rc.encodeURL(URL);
+        setReturnValue(rc, encodedURL);
+    }
+}

Modified: jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/asset/TestResourceDigestSource.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/asset/TestResourceDigestSource.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/asset/TestResourceDigestSource.java (original)
+++ jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/asset/TestResourceDigestSource.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -30,7 +30,6 @@
  */
 public class TestResourceDigestSource extends HiveMindTestCase
 {
-
     public void testSuccess()
     {
         ResourceDigestSourceImpl s = new ResourceDigestSourceImpl();
@@ -59,7 +58,7 @@
     public void testCache()
     {
         MockControl control = newControl(ClassResolver.class);
-        ClassResolver resolver = (ClassResolver)control.getMock();
+        ClassResolver resolver = (ClassResolver) control.getMock();
 
         URL url = getClass().getResource("tapestry-in-action.png");
 
@@ -96,4 +95,4 @@
         verifyControls();
 
     }
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/bean/TestBeanProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/bean/TestBeanProvider.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/bean/TestBeanProvider.java (original)
+++ jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/bean/TestBeanProvider.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -30,19 +30,16 @@
 import org.apache.tapestry.spec.IBeanSpecification;
 
 /**
- * Tests for {@link org.apache.tapestry.bean.BeanProvider} (mostly new features
- * added in release 4.0).
+ * Tests for {@link org.apache.tapestry.bean.BeanProvider} (mostly new features added in release
+ * 4.0).
  * 
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
 public class TestBeanProvider extends BaseComponentTestCase
 {
-
-    /** Test fixture. */
     public static class BeanInitializerFixture extends AbstractBeanInitializer
     {
-
         private final RuntimeException _exception;
 
         public BeanInitializerFixture(String propertyName, RuntimeException exception)
@@ -60,7 +57,7 @@
 
     protected IBeanSpecification newBeanSpec()
     {
-        return (IBeanSpecification)newMock(IBeanSpecification.class);
+        return (IBeanSpecification) newMock(IBeanSpecification.class);
     }
 
     protected void trainGetClassName(IBeanSpecification spec, String className)
@@ -161,11 +158,12 @@
         verifyControls();
     }
 
-    private void trainForConstructor(IPage page, IComponent component, ClassResolver resolver, ClassFinder classFinder)
+    private void trainForConstructor(IPage page, IComponent component, ClassResolver resolver,
+            ClassFinder classFinder)
     {
         IRequestCycle cycle = newCycle();
-        Infrastructure infrastructure = (Infrastructure)newMock(Infrastructure.class);
-        INamespace namespace = (INamespace)newMock(INamespace.class);
+        Infrastructure infrastructure = (Infrastructure) newMock(Infrastructure.class);
+        INamespace namespace = (INamespace) newMock(INamespace.class);
 
         trainGetPage(component, page);
 
@@ -190,12 +188,12 @@
 
     protected ClassFinder newClassFinder()
     {
-        return (ClassFinder)newMock(ClassFinder.class);
+        return (ClassFinder) newMock(ClassFinder.class);
     }
 
     private ClassResolver newResolver()
     {
-        return (ClassResolver)newMock(ClassResolver.class);
+        return (ClassResolver) newMock(ClassResolver.class);
     }
 
     public void testInitializeFailure()
@@ -240,8 +238,9 @@
         }
         catch (ApplicationRuntimeException ex)
         {
-            assertEquals("Error initializing property foo of bean 'wilma' (of component Fred/barney): Blat!", ex
-                    .getMessage());
+            assertEquals(
+                    "Error initializing property foo of bean 'wilma' (of component Fred/barney): Blat!",
+                    ex.getMessage());
             assertSame(TargetBean.class, ex.getComponent().getClass());
             assertSame(l, ex.getLocation());
             assertSame(t, ex.getRootCause());



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