You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@apache.org on 2005/01/01 00:41:09 UTC

svn commit: r123833 - in struts/sandbox/trunk/struts-shale: . src/conf src/java/org/apache/shale src/java/org/apache/shale/application src/java/org/apache/shale/component src/java/org/apache/shale/faces src/java/org/apache/shale/renderer src/java/org/apache/shale/taglib src/java/org/apache/shale/util src/java/org/apache/shale/view

Author: craigmcc
Date: Fri Dec 31 15:41:08 2004
New Revision: 123833

URL: http://svn.apache.org/viewcvs?view=rev&rev=123833
Log:
A bunch of updates to the core framework classes.

ALL:  Update copyright notices for 2004-2005.

README.html:  Clarify requirements for DialogController to support one or more
entry methods and one or more exit methods, with specific responsibilities.

org.apache.shale:
----------------

Bundle.properties (new) - Base resource bundle for localized messages.

DialogController - Clarify responsibilities and requirements around entry and
exit methods.  Define standard entry method (enter()) and exit methods
(exit() and cancel()).  Comment out (for now at least) the generic navigation
methods (first/last/next/previous).

org.apache.shale.component:
--------------------------

Token (new) - JSF component to render a transaction token and validate the
token value on a subsequent form submit.

org.apache.shale.faces:
----------------------

ShaleApplicationFilter - Localize logged messages and exceptions.  Support
pluggable implementation of ViewControllerMapper.

ShalePhaseListener - Correct Javadoc parameter.

ShaleViewHandler - Localize logged messages.

ShaleWebContext - Localize logged messages.

org.apache.shale.renderer:
-------------------------

TokenRenderer - Renderer for Token component.

org.apache.shale.taglib:
-----------------------

TokenTag (new) - JSP tag for Token component.

org.apache.shale.util:
---------------------

Messages (new) - Wrapper class for returning locale-sensitive messages from
resource bundles, as well as parameter substitution.

TokenProcessor (new) - Utility methods to generate and cache transaction token
values, then verify the result on subsequent form submit.  Multiple transaction
tokens per session are supported.

org.apache.shale.view:
---------------------

DefaultViewControllerMapper - Refine mapping rules to replace embedded "/"
characters with "$" instead of "." for easier use in value binding expressions.



Added:
   struts/sandbox/trunk/struts-shale/src/conf/taglib.tld
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/Bundle.properties
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/component/
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/component/Token.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/component/package.html
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/renderer/
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/renderer/TokenRenderer.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/renderer/package.html
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/taglib/
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/taglib/TokenTag.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/taglib/package.html
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/util/
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/util/Messages.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/util/TokenProcessor.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/util/package.html
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/package.html
Modified:
   struts/sandbox/trunk/struts-shale/README.html
   struts/sandbox/trunk/struts-shale/build.xml
   struts/sandbox/trunk/struts-shale/src/conf/faces-config.xml
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/Constants.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/DialogController.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/ViewController.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/ViewControllerMapper.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/AbstractRegExpFilter.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/ContextRelativePathFilter.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/RemoteAddrFilter.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/RemoteHostFilter.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/package.html
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/InvokeCommand.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleApplicationFilter.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleConstants.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShalePhaseListener.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleViewHandler.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleWebContext.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/package.html
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/shale-config.xml
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/package.html
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/AbstractViewController.java
   struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/DefaultViewControllerMapper.java

Modified: struts/sandbox/trunk/struts-shale/README.html
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/README.html?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/README.html&r1=123832&p2=struts/sandbox/trunk/struts-shale/README.html&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/README.html	(original)
+++ struts/sandbox/trunk/struts-shale/README.html	Fri Dec 31 15:41:08 2004
@@ -287,24 +287,17 @@
     in such a manner that navigation can be performed by an event handler
     for one view, without having to be aware of the details of the overall
     structure of the entire dialog.</li>
-<li>Description of a dialog should include not only support for navigation
-    (first, previous, next, last, and so on) but also some mechanism for
-    scripting the entire dialog's flow.  Examples of descriptions might be
-    some scripting language that supports "continuations" (i.e. the ability
-    to suspend execution and restart it later), or Java APIs that make state
-    saving and restoring easy to perform in view-specific event handlers.</li>
+<li>Dialogs must be able to support one or more entry methods, which initialize
+    the dialog's data structures as needed, store the dialog instance in
+    session scope, and return a logical outcome for navigating to the
+    first view within the dialog.</li>
+<li>Dialogs must be able to support one or more exit methods (typically one
+    for succesful completion and one for cancellation) which clean up any
+    allocated resources, remove the dialog instance from session scope, and
+    return a logical outcome for navigating to the next view that is not
+    within the dialog.</li>
 <li>Dialog descriptions must be self documenting enough for tools to be
     able to produce high quality user experiences at design time.</li>
-<li>In addition to generic navigation, the dialog controller
-    must support one or more mechanisms to exit from the dialog (typically
-    via "finish" and "cancel" controls, but not limited to these).</li>
-<li>To the maximum degree feasible, the dialog controller must manage the
-    browser's "back" and "forwards" buttons, treating them as if the
-    corresponding navigation controls had been utilized (in terms of
-    undoing and redoing changes to the state information being maintained).
-    Clearly, this will require restrictions on persistent changes to model
-    tier data performed as each step of the dialog is executed, but those
-    restrictions should be explicitly documented and easy to obey.</li>
 </ul>
 
 <h3>2.4 View Controller</h3>

Modified: struts/sandbox/trunk/struts-shale/build.xml
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/build.xml?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/build.xml&r1=123832&p2=struts/sandbox/trunk/struts-shale/build.xml&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/build.xml	(original)
+++ struts/sandbox/trunk/struts-shale/build.xml	Fri Dec 31 15:41:08 2004
@@ -1,6 +1,6 @@
 <!--
 
- Copyright 2004 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.
@@ -188,7 +188,7 @@
     </copy>
     <copy    todir="${build.home}/classes/META-INF">
       <fileset dir="src/conf"
-          includes="*faces-config.xml"/>
+          includes="*faces-config.xml taglib.tld"/>
     </copy>
   </target>
 
@@ -249,7 +249,7 @@
           packagenames="org.apache.shale.*"
            windowtitle="${project.name} (Version ${project.version})"
               doctitle="${project.name} (Version ${project.version})"
-                bottom="Copyright &#169; 2004 - The Apache Software Foundation">
+                bottom="Copyright &#169; 2004-2005 - The Apache Software Foundation">
       <classpath refid="compile.classpath"/>
     </javadoc>
 

Modified: struts/sandbox/trunk/struts-shale/src/conf/faces-config.xml
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/conf/faces-config.xml?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/conf/faces-config.xml&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/conf/faces-config.xml&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/conf/faces-config.xml	(original)
+++ struts/sandbox/trunk/struts-shale/src/conf/faces-config.xml	Fri Dec 31 15:41:08 2004
@@ -8,7 +8,7 @@
 
 <!--
 
- Copyright 2004 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.
@@ -38,5 +38,26 @@
       org.apache.shale.faces.ShaleViewHandler
     </view-handler>
   </application>
+
+  <!-- Custom Components -->
+  <component>
+    <description>
+      The "Token" component emits a transactional token that is then
+      validated (on a subsequent form submit) to catch cases where the
+      same form was submitted more than once.
+    </description>
+    <display-name>Token</display-name>
+    <component-type>org.apache.shale.Token</component-type>
+    <component-class>org.apache.shale.component.Token</component-class>
+  </component>
+
+  <!-- Custom Renderers -->
+  <render-kit>
+    <renderer>
+      <component-family>org.apache.shale.Token</component-family>
+      <renderer-type>org.apache.shale.Token</renderer-type>
+      <renderer-class>org.apache.shale.renderer.TokenRenderer</renderer-class>
+    </renderer>
+  </render-kit>
 
 </faces-config>

Added: struts/sandbox/trunk/struts-shale/src/conf/taglib.tld
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/conf/taglib.tld?view=auto&rev=123833
==============================================================================
--- (empty file)
+++ struts/sandbox/trunk/struts-shale/src/conf/taglib.tld	Fri Dec 31 15:41:08 2004
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+  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.
+-->
+
+<!DOCTYPE taglib PUBLIC
+ "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
+ "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
+
+<taglib>
+
+
+  <tlib-version>0.1</tlib-version>
+  <jsp-version>1.2</jsp-version>
+  <short-name>s</short-name>
+  <uri>http://struts.apache.org/shale/core</uri>
+  <display-name>Shale Framework Core JSF Components and Tags</display-name>
+  <description>
+    This tag library contains tags for the core JSF components supported by
+    the Shale Framework, plus additional custom tag handlers as required.
+  </description>
+
+
+  <!-- ================= JSF Component Tags ================================ -->
+
+
+  <tag>
+
+    <name>token</name>
+    <tag-class>org.apache.shale.taglib.TokenTag</tag-class>
+    <body-content>empty</body-content>
+    <display-name>Token</display-name>
+    <description>
+      Render a hidden input field whose value is the transaction token
+      for the containing form.
+    </description>
+
+    <!-- Custom -->
+
+    <!-- JSF -->
+
+    <attribute>
+      <name>binding</name>
+      <required>false</required>
+      <exprvalue>false</exprvalue>
+      <description>
+        Value binding expression used to bind this component instance
+        to a backing bean property.
+      </description>
+    </attribute>
+
+    <attribute>
+      <name>id</name>
+      <required>false</required>
+      <exprvalue>false</exprvalue>
+      <description>
+        Component identifier of this component.  If specified, this identifier
+        must be unique within the context of the closest parent UIComponent
+        that is a NamingContainer.
+      </description>
+    </attribute>
+
+    <attribute>
+      <name>rendered</name>
+      <required>false</required>
+      <exprvalue>false</exprvalue>
+      <description>
+        Flag indicating whether this component should be rendered.
+        Default value is true.
+      </description>
+    </attribute>
+
+  </tag>
+
+
+</taglib>

Added: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/Bundle.properties
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/Bundle.properties?view=auto&rev=123833
==============================================================================
--- (empty file)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/Bundle.properties	Fri Dec 31 15:41:08 2004
@@ -0,0 +1,40 @@
+# Resource Strings for Shale Framework
+#
+# 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.
+# 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.
+#
+# $Id$
+
+# org.apache.shale.application.ShaleApplicationFilter
+filter.creatingCatalog=Creating catalog {0}
+filter.finalizing=Finalizing Shale Application Filter
+filter.initializing=Initializing Shale Application Filter
+filter.parsingResource=Parsing default resource {0}
+filter.vcmAccess=ViewControllerMapper class {0} does not have a public no-args constructor
+filter.vcmCast=Class {0} does not implement ViewControllerMapper
+filter.vcmClass=Cannot find ViewControllerMapper class {0}
+filter.vcmInstantiate=ViewControllerMapper class {0} instance cannot be instantiated
+
+# org.apache.shale.application.ShaleViewHandler
+view.notViewController=Bean for viewId {0} under name {1} is not a ViewController
+view.noViewController=No ViewController for viewId {0} found under name {1}
+view.noViewControllerMapper=No ViewControllerMapper has been configured for this application
+
+# org.apache.shale.application.ShaleWebContext
+context.requestWrapper=Must be an HttpServletRequestWrapper
+context.responseWrapper=Must be an HttpServletResponseWrapper
+
+# org.apache.shale.component.Token
+token.invalid=Invalid resubmit of the same form
+

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/Constants.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/Constants.java?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/Constants.java&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/Constants.java&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/Constants.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/Constants.java	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 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.

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/DialogController.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/DialogController.java?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/DialogController.java&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/DialogController.java&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/DialogController.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/DialogController.java	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 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,46 +17,43 @@
 package org.apache.shale;
 
 import java.io.Serializable;
-import java.util.Map;
 
 /**
  * <p>{@link DialogController} is an interface describing a JavaBean that
  * manages the current state of a dialog (that is, a conversation that
- * requires multiple HTTP requests to interact with the user).  In addition,
- * processing methods are provided so that event handlers in the
- * {@link ViewController} for an individual view can navigate to various
- * portions of the dialog, without having to be aware of the identifers of
- * the other views that comprise the overall dialog.</p>
- *
- * <p>The basic {@link DialogController} interface provides a generic
- * set of attributes in which an application may store arbitrary information
- * representing the state of the overall computation.  To operate robustly
- * in servlet containers that support session migration and/or saving and
- * restoring on application restart, all such attributes (and, indeed, any
- * implementation of the {@link DialogController} interface) must be
- * Serializable.</p>
- *
- * <p>Best practices for creating {@link DialogController} implementations
- * include the following:</p>
- * <ul>
- * <li>Because {@link DialogController} instances will typically be saved
- *     across HTTP requests (in an <code>HttpSession</code>, cached in a
- *     database or filesystem, etc.) you should minimize the amount of state
- *     information that is maintained.</li>
- * <li>Do not maintain state information that can be easily recalculated.
- *     For example, keep primary keys of relevant database rows rather than
- *     the complete rows themselves -- that data can be re-acquired as
- *     needed in some later step of the dialog.</li>
- * <li>In general, no changes to the underlying persistent data in your
- *     application's model tier should be made until the user selects a
- *     "finish" or "apply" command.  This allows easy implementation of
- *     a "cancel" operation, which normally involves just throwing away
- *     the {@link DialogController} instance.</li>
- * <li>Although such access will be uncommon, {@link DialogController}
- *     instances will typically be visible to multiple processing threads,
- *     so appropriate synchronizations should be performed when saving
- *     and restoring the state information stored in an instance.</li>
- * </ul>
+ * requires multiple HTTP requests to interact with the user).  Note that,
+ * because {@link DialogController} instances are stored in session scope,
+ * all state information that is maintained should be serializable so that
+ * your application may operate in a distributed container.</p>
+ *
+ * <p>A {@link DialogController} instance comes into being when an
+ * initiaization method (normally <code>enter()</code>) is called.  This method
+ * should cause the dialog instance to be stored in session scope
+ * (this is typically automatic if the dialog instance is a managed bean),
+ * allocate any needed resources, and return a logical outcome that may be
+ * used by the <code>NavigationHandler</code> to select the first view
+ * that is part of this dialog.</p>
+ *
+ * <p>If a particular {@link DialogController} wishes to provide additonal
+ * initialization methods for alternate starting conditions, these additional
+ * methods should be implemented with the same method signature, and fulfill
+ * the same responsibilities.</p>
+ *
+ * <p>A {@link DialogController} instance completes its work when one of
+ * its termination methods is called.  The interface defines two termination
+ * methods (<code>exit()</code> and <code>cancel()</code>), indicating
+ * "successful" and "cancelled" completion of the dialog, respectively.
+ * Such a termination method should persist any transaction represented
+ * by the state of this dialog (if termination was successful), release
+ * any acquired resources, cause the dialog instance to be removed from
+ * session scope, and return a logical outcome that may be used by the
+ * <code>NavigationHandler</code> to select the first view that is
+ * <strong>not</strong> part of this dialog.</p>
+ *
+ * <p>If a particular {@link DialogController} wishes to provide additonal
+ * termination methods for variations on completion status, these additional
+ * methods should be implemented with the same method signature, and fulfill
+ * the same responsibilities.</p>
  *
  * <p><strong>WARNING</strong> - this is a very early prototype of what a
  * {@link DialogController} might look like.  The final design might assign
@@ -73,57 +70,43 @@
     // -------------------------------------------------------------- Properties
 
     
-    /**
-     * <p>Return a <code>Map</code> in which event handlers executing on behalf
-     * of a dialog may store general purpose information, which will be
-     * maintained by Struts across HTTP requests.  To operate robustly in
-     * containers that support session migration or saving/restoring on
-     * server (or application) restart, all keys and values stored in this
-     * <code>Map</code> must be Serializable.</p>
-     */
-    public Map getAttributes();
-    
-
     // ------------------------------------------------------ Navigation Methods
 
 
     /**
-     * <p>Return a logical outcome that will navigate to a view informing
-     * the user that this dialog has been terminated abnormally.  The caller
-     * should ensure that no persistent state change be performed as a
-     * result of the partial completion of this dialog.</p>
+     * <p>Termination method indicating that this dialog has been completed
+     * abnormally.  Any saved state information should be released without
+     * impact on the persistent data for the application, any alocated
+     * resources should be released, and this {@link DialogController}
+     * instance should be removed from session scope.</p>
      *
-     * @exception UnsupportedOperationException if not supported for
-     *  this dialog
+     * @return Logical outcome used for navigation outside this dialog
      */
     public String cancel();
     
     
     /**
-     * <p>Return a logical outcome that will navigate to some view external
-     * to the current dialog, or <code>null</code> if there is no need to
-     * perform such navigation (perhaps because a pop-up window containing
-     * the dialog will be closing itself.</p>
+     * <p>Initialization method indicating that this dialog has been entered.
+     * Any desired resources should be allocated, and this
+     * {@link DialogController} instance should be added to session scope
+     * (if this was not already done by virtue of being a managed bean).</p>
      *
-     * @exception UnsupportedOperationException if not supported for
-     *  this dialog
+     * @return Logical outcome used for navigation to the first
+     *  view within this dialog
      */
-    public String exit();
-    
-    
+    public String enter();
+
+
     /**
-     * <p>Return a logical outcome that will navigate to a view confirming
-     * to the user that any persistent state changes required to reflect
-     * the execution of this dialog have been completed.  The caller should
-     * ensure that all such changes have been performed before navigation
-     * to this confirmation view is actually performed, because the user is
-     * likely to cancel this view (if it appears in a popup window) using
-     * browser based controls instead of any application provided controls.</p>
+     * <p>Termination method indicating that this dialog has been completed
+     * successfully.  Any transaction represented by the saved state
+     * information should be persisted, any allocated resources should be
+     * released, and this {@link DialogController} instance should be
+     * removed from session scope.
      *
-     * @exception UnsupportedOperationException if not supported for
-     *  this dialog
+     * @return Logical outcome used for navigation outside this dialog
      */
-    public String finish();
+    public String exit();
     
     
     /**
@@ -134,7 +117,7 @@
      * @exception UnsupportedOperationException if not supported for
      *  this dialog
      */
-    public String first();
+    // public String first();
 
 
     /**
@@ -145,7 +128,7 @@
      * @exception UnsupportedOperationException if not supported for
      *  this dialog
      */
-    public String last();
+    // public String last();
 
 
     /**
@@ -156,7 +139,7 @@
      * @exception UnsupportedOperationException if not supported for
      *  this dialog
      */
-    public String next();
+    // public String next();
 
 
     /**
@@ -167,7 +150,7 @@
      * @exception UnsupportedOperationException if not supported for
      *  this dialog
      */
-    public String previous();
+    // public String previous();
 
 
 }

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/ViewController.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/ViewController.java?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/ViewController.java&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/ViewController.java&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/ViewController.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/ViewController.java	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 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.

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/ViewControllerMapper.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/ViewControllerMapper.java?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/ViewControllerMapper.java&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/ViewControllerMapper.java&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/ViewControllerMapper.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/ViewControllerMapper.java	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 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.

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/AbstractRegExpFilter.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/AbstractRegExpFilter.java?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/AbstractRegExpFilter.java&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/AbstractRegExpFilter.java&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/AbstractRegExpFilter.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/AbstractRegExpFilter.java	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 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.

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/ContextRelativePathFilter.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/ContextRelativePathFilter.java?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/ContextRelativePathFilter.java&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/ContextRelativePathFilter.java&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/ContextRelativePathFilter.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/ContextRelativePathFilter.java	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 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.

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/RemoteAddrFilter.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/RemoteAddrFilter.java?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/RemoteAddrFilter.java&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/RemoteAddrFilter.java&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/RemoteAddrFilter.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/RemoteAddrFilter.java	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 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.

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/RemoteHostFilter.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/RemoteHostFilter.java?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/RemoteHostFilter.java&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/RemoteHostFilter.java&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/RemoteHostFilter.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/RemoteHostFilter.java	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 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.

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/package.html
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/package.html?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/package.html&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/package.html&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/package.html	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/application/package.html	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 <!--
- * Copyright 2004 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.

Added: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/component/Token.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/component/Token.java?view=auto&rev=123833
==============================================================================
--- (empty file)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/component/Token.java	Fri Dec 31 15:41:08 2004
@@ -0,0 +1,130 @@
+/*
+ * 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.
+ * 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.shale.component;
+
+import java.util.Locale;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+import org.apache.shale.faces.ShaleConstants;
+import org.apache.shale.util.Messages;
+import org.apache.shale.util.TokenProcessor;
+
+/**
+ * <p>Component that renders a transaction token input field, and then
+ * validates it on a subsequent form submit.</p>
+ *
+ * $Id$
+ */
+public class Token extends UIInput {
+    
+
+    // -------------------------------------------------------- Static Variables
+
+
+    /**
+     * <p>Message resources for this class
+     */
+    private static Messages messages =
+      new Messages("org.apache.shale.Bundle",
+                   Token.class.getClassLoader());
+
+
+    // ------------------------------------------------------------ Constructors
+
+
+    /**
+     * <p>Create a default instance of this component.</p>
+     */
+    public Token() {
+        setRendererType("org.apache.shale.Token");
+    }
+
+
+    // -------------------------------------------------------------- Properties
+
+
+    /**
+     * <p>Return the component family for this component.</p>
+     */
+    public String getFamiy() {
+        return "org.apache.shale.Token";
+    }
+
+
+    // --------------------------------------------------------- UIInput Methods
+
+
+    /**
+     * <p>Perform superclass validations, then ensure that the specified input
+     * value is acceptable at this point in time.</p>
+     *
+     * @param context <code>FacesContext</code> for the current request
+     */
+    public void validate(FacesContext context) {
+
+        super.validate(context);
+        String token = (String) getSubmittedValue();
+        TokenProcessor tp = getTokenProcessor(context);
+        if (!tp.verify(context, token)) {
+            setValid(false);
+            String summary = messages.getMessage("token.invalid");
+            FacesMessage message = new FacesMessage(summary);
+            message.setSeverity(FacesMessage.SEVERITY_ERROR);
+        }
+
+    }
+
+
+    /**
+     * <p>Return the transaction token value to be rendered for this occcurrence
+     * of this component.  As a side effect, the transaction token value will
+     * be saved for verification on a subsequent submit.</p>
+     */
+    public Object getValue() {
+
+        FacesContext context = FacesContext.getCurrentInstance();
+        TokenProcessor tp = getTokenProcessor(context);
+        return tp.generate(context);
+
+    }
+
+
+    // --------------------------------------------------------- Private Methods
+
+
+    /**
+     * <p>Retrieve the {@link TokenProcessor} instance for this application,
+     * creating and caching a new one if necessary.</p>
+     *
+     * @param context <code>FacesContext</code> for the current request
+     */
+     private TokenProcessor getTokenProcessor(FacesContext context) {
+
+         TokenProcessor tp = (TokenProcessor) context.getExternalContext().
+           getApplicationMap().get(ShaleConstants.TOKEN_PROCESSOR);
+         if (tp == null) {
+             tp = new TokenProcessor();
+             context.getExternalContext().
+               getApplicationMap().put(ShaleConstants.TOKEN_PROCESSOR, tp);
+         }
+         return tp;
+
+     }
+
+
+}

Added: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/component/package.html
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/component/package.html?view=auto&rev=123833
==============================================================================
--- (empty file)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/component/package.html	Fri Dec 31 15:41:08 2004
@@ -0,0 +1,24 @@
+<!--
+ * 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.
+ * 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.
+-->
+
+<!-- $Id$ -->
+
+<body>
+
+<p>This package defines JavaServer Faces components that are integral to the
+Shale architecture.</p>
+
+</body>

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/InvokeCommand.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/InvokeCommand.java?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/InvokeCommand.java&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/InvokeCommand.java&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/InvokeCommand.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/InvokeCommand.java	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 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.

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleApplicationFilter.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleApplicationFilter.java?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleApplicationFilter.java&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleApplicationFilter.java&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleApplicationFilter.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleApplicationFilter.java	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 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.
@@ -38,6 +38,8 @@
 import org.apache.commons.chain.impl.CatalogBase;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.shale.ViewControllerMapper;
+import org.apache.shale.util.Messages;
 import org.apache.shale.view.DefaultViewControllerMapper;
 
 /**
@@ -127,6 +129,16 @@
       "org/apache/shale/faces/shale-config.xml";
 
 
+      /**
+       * <p>The name of the context initialization parameter that defines the
+       * fully qualified class name of the {@link ViewControllerMapper} to be
+       * used is stored.  If not present, the default value is
+       * <code>org.apache.shale.view.DefaultViewControllerMapper</code>.</p>
+       */
+    public static final String VIEW_CONTROLLER_MAPPER =
+      "org.apache.shale.VIEW_CONTROLLER_MAPPER";
+
+
     /**
      * <p>The <code>Log</code> instance for this class.</p>
      */
@@ -156,6 +168,14 @@
 
 
     /**
+     * <p>Message resources for this class.</p>
+     */
+    private static Messages messages =
+      new Messages("org.apache.shale.Bundle",
+                   ShaleApplicationFilter.class.getClassLoader());
+
+
+    /**
      * <p>The JSF <code>PhaseListener</code> that we have registered.</p>
      */
     private PhaseListener phaseListener = null;
@@ -169,7 +189,7 @@
      */
     public void destroy() {
 
-        log.info("Finalizing Shale application filter");
+        log.info(messages.getMessage("filter.finalizing"));
 
         if (phaseListener != null) {
             getLifecycle().removePhaseListener(phaseListener);
@@ -224,15 +244,14 @@
      */
     public void init(FilterConfig config) throws ServletException {
 
-        log.info("Initializing Shale application filter");
+        log.info(messages.getMessage("filter.initializing"));
 
         this.config = config;
         context = config.getServletContext();
         phaseListener = new ShalePhaseListener();
         getLifecycle().addPhaseListener(phaseListener);
-        // FIXME - make the mapper pluggable
         context.setAttribute(ShaleConstants.VIEW_MAPPER,
-          new DefaultViewControllerMapper());
+                             getViewControllerMapper());
 
         // Look up the "shale" catalog and ensure "standard" is defined
         try {
@@ -261,7 +280,8 @@
         Catalog catalog = CatalogFactory.getInstance().getCatalog(CATALOG_NAME);
         if (catalog == null) {
             if (log.isDebugEnabled()) {
-                log.debug("Creating catalog '" + CATALOG_NAME + "'");
+                log.debug(messages.getMessage("filter.creatingCatalog",
+                                              new Object[] { CATALOG_NAME }));
             }
             catalog = new CatalogBase();
             CatalogFactory.getInstance().addCatalog(CATALOG_NAME, catalog);
@@ -274,7 +294,8 @@
 
         // Configure based on our default resource
         if (log.isDebugEnabled()) {
-            log.debug("Parsing default resource '" + RESOURCE_NAME + "'");
+            log.debug(messages.getMessage("filter.parsingResource",
+                                          new Object[] { RESOURCE_NAME }));
         }
         ConfigParser parser = new ConfigParser();
         URL url = this.getClass().getClassLoader().getResource(RESOURCE_NAME);
@@ -306,6 +327,46 @@
         LifecycleFactory factory = (LifecycleFactory)
           FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
         return factory.getLifecycle(lifecycleId);
+
+    }
+
+
+    /**
+     * <p>Create and return the {@link ViewControllerMapper} instance
+     * we will use for this application
+     *
+     * @exception ServletException if no instance can be created
+     */
+    private ViewControllerMapper getViewControllerMapper() throws ServletException {
+
+        String className = context.getInitParameter(VIEW_CONTROLLER_MAPPER);
+        if (className == null) {
+            className = "org.apache.shale.view.DefaultViewControllerMapper";
+        }
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        if (cl == null) {
+            cl = this.getClass().getClassLoader();
+        }
+        try {
+            Class clazz = cl.loadClass(className);
+            return (ViewControllerMapper) clazz.newInstance();
+        } catch (ClassCastException e) {
+            throw new ServletException
+              (messages.getMessage("filter.vcmCast",
+                                   new Object[] { className }), e);
+        } catch (ClassNotFoundException e) {
+            throw new ServletException
+              (messages.getMessage("filter.vcmClass",
+                                   new Object[] { className }), e);
+        } catch (IllegalAccessException e) {
+            throw new ServletException
+              (messages.getMessage("filter.vcmAccess",
+                                   new Object[] { className }), e);
+        } catch (InstantiationException e) {
+            throw new ServletException
+              (messages.getMessage("filter.vcmInstantiate",
+                                   new Object[] { className }), e);
+        }
 
     }
 

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleConstants.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleConstants.java?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleConstants.java&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleConstants.java&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleConstants.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleConstants.java	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 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,6 +18,7 @@
 
 import org.apache.shale.ViewController;
 import org.apache.shale.ViewControllerMapper;
+import org.apache.shale.util.TokenProcessor;
 
 /**
  * <p>{@link ShaleConstants} are manifest constants defining global identifiers shared across
@@ -29,6 +30,21 @@
 public interface ShaleConstants {
     
     
+    /**
+     * <p>Appication scope attribute key under which the
+     * {@link TokenProcessor} instance for this application is stored.</p>
+     */
+    public static final String TOKEN_PROCESSOR =
+      "org.apache.shale.TOKEN_PROCESSOR";
+
+
+    /**
+     * <p>Session scope attribute key under which we keep a <code>Set</code>
+     * containing the valid transaction tokens for this session.</p>
+     */
+    public static final String TOKENS = "org.apache.shale.TOKENS";
+
+
     /**
      * <p>Application scope attribute under which the
      * {@link ViewControllerMapper} for translating view identifiers

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShalePhaseListener.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShalePhaseListener.java?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShalePhaseListener.java&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShalePhaseListener.java&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShalePhaseListener.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShalePhaseListener.java	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 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.
@@ -132,7 +132,7 @@
      * <p>Call the <code>preprocess()</code> method of the {@link ViewController}
      * that has been restored, if this is a postback.</p>
      *
-     * @event <code>PhaseEvent</code> for the current event
+     * @param event <code>PhaseEvent</code> for the current event
      */
     private void afterRestoreView(PhaseEvent event) {
 

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleViewHandler.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleViewHandler.java?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleViewHandler.java&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleViewHandler.java&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleViewHandler.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleViewHandler.java	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 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.
@@ -31,6 +31,7 @@
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import org.apache.shale.util.Messages;
 
 /**
  * <p>{@link ShaleViewHandler} is a custom implementation of <code>ViewHandler</code> that adds support
@@ -67,6 +68,14 @@
     private static final Log log = LogFactory.getLog(ShaleViewHandler.class);
 
 
+    /**
+     * <p>Message resources for this class.</p>
+     */
+    private static Messages messages =
+      new Messages("org.apache.shale.Bundle",
+                   ShaleViewHandler.class.getClassLoader());
+
+
     // ------------------------------------------------------ Instance Variables
 
     
@@ -201,7 +210,7 @@
         // Map our view identifier to a corresponding managed bean name
         ViewControllerMapper mapper = getViewControllerMapper(context);
         if (mapper == null) {
-            log.warn("No ViewControllerMapper configured for this application");
+            log.warn(messages.getMessage("view.noViewControllerMapper"));
             return;
         }
         String viewName = mapper.mapViewId(viewId);
@@ -214,13 +223,13 @@
         try {
             vc = (ViewController) vb.getValue(context);
         } catch (ClassCastException e) {
-            log.warn("Bean for viewId '" + viewId + "' under name '" +
-              viewName + "' is not a ViewController");
+            log.warn(messages.getMessage("view.notViewController", 
+                                         new Object[] { viewId, viewName }));
             return;
         }
         if (vc == null) {
-            log.warn("No ViewController for viewId '" + viewId +
-              "' found under name '" + viewName + "'");
+            log.warn(messages.getMessage("view.noViewController",
+                                         new Object[] { viewId, viewName }));
             return;
         }
 

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleWebContext.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleWebContext.java?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleWebContext.java&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleWebContext.java&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleWebContext.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/ShaleWebContext.java	Fri Dec 31 15:41:08 2004
@@ -26,6 +26,7 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponseWrapper;
 import org.apache.commons.chain.web.servlet.ServletWebContext;
+import org.apache.shale.util.Messages;
 
 /**
  * <p>Commons Chain <code>Context</code> implementation for Shale.</p>
@@ -70,6 +71,17 @@
     private FacesContext facesContext = null;
 
 
+    // -------------------------------------------------------- Static Variables
+
+
+    /**
+     * <p>Message resources for this class.</p>
+     */
+    private static Messages messages =
+      new Messages("org.apache.shale.Bundle",
+                   ShaleWebContext.class.getClassLoader());
+
+
     // -------------------------------------------------------------- Properties
 
 
@@ -116,8 +128,8 @@
      */
     public void setRequest(HttpServletRequest request) {
         if (!(request instanceof HttpServletRequestWrapper)) {
-            // FIXME - i18n
-            throw new IllegalArgumentException("Must be an HttpServletRequestWrapper");
+            throw new IllegalArgumentException
+              (messages.getMessage("context.requestWrapper"));
         }
         initialize(getContext(), request, getResponse());
     }
@@ -137,8 +149,8 @@
      */
     public void setResponse(HttpServletResponse response) {
         if (!(response instanceof HttpServletResponseWrapper)) {
-            // FIXME - i18n
-            throw new IllegalArgumentException("Must be an HttpServletResponseWrapper");
+            throw new IllegalArgumentException
+              (messages.getMessage("context.responseWrapper"));
         }
         initialize(getContext(), getRequest(), response);
     }

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/package.html
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/package.html?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/package.html&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/package.html&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/package.html	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/package.html	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 <!--
- * Copyright 2004 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.

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/shale-config.xml
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/shale-config.xml?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/shale-config.xml&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/shale-config.xml&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/shale-config.xml	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/faces/shale-config.xml	Fri Dec 31 15:41:08 2004
@@ -2,7 +2,7 @@
 
 <!--
 
-  Copyright 2004 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.
@@ -16,7 +16,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 
-  $Id: build.xml 54942 2004-10-16 22:39:25Z craigmcc $
+  $Id$
 
 -->
 

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/package.html
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/package.html?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/package.html&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/package.html&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/package.html	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/package.html	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 <!--
- * Copyright 2004 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.

Added: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/renderer/TokenRenderer.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/renderer/TokenRenderer.java?view=auto&rev=123833
==============================================================================
--- (empty file)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/renderer/TokenRenderer.java	Fri Dec 31 15:41:08 2004
@@ -0,0 +1,115 @@
+/*
+ * 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.
+ * 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.shale.renderer;
+
+import java.io.IOException;
+import java.util.Map;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
+import org.apache.shale.component.Token;
+
+/**
+ * <p>Renderer for a {@link Token} component, dealing with a transaction
+ * token used to catch duplicate form submits.</p>
+ *
+ * $Id$
+ */
+public class TokenRenderer extends Renderer {
+    
+    
+    // -------------------------------------------------------- Renderer Methods
+
+
+    /**
+     * <p>Save the submitted value if this component was actually rendered.</p>
+     *
+     * @param context <code>FacesContext</code> for the current request
+     * @param component <code>UIComponent</code> to be decoded
+     */
+    public void decode(FacesContext context, UIComponent component) {
+
+        if ((context == null) || (component == null)) {
+            throw new NullPointerException();
+        }
+
+        Token token = (Token) component;
+        if (token.isRendered()) {
+            String clientId = token.getClientId(context);
+            Map map = context.getExternalContext().getRequestParameterMap();
+            token.setSubmittedValue(map.get(clientId));
+        }
+
+    }
+
+
+    /**
+     * <p>Render the start of a hidden input element containing the transaction
+     * token value for this component.</p>
+     *
+     * @param context <code>FacesContext</code> for the current request
+     * @param component <code>UIComponent</code> to be decoded
+     *
+     * @exception IOException if an input/output error occurs
+     */
+    public void encodeBegin(FacesContext context, UIComponent component)
+      throws IOException {
+
+        if ((context == null) || (component == null)) {
+            throw new NullPointerException();
+        }
+
+        Token token = (Token) component;
+        if (token.isRendered()) {
+            ResponseWriter writer = context.getResponseWriter();
+            writer.startElement("input", token);
+            String clientId = token.getClientId(context);
+            writer.writeAttribute("id", clientId, "id");
+            writer.writeAttribute("name", clientId, "id");
+            writer.writeAttribute("value", token.getValue(), "value");
+        }
+
+    }
+
+
+    /**
+     * <p>Render the end of a hidden input element containing the transaction
+     * token value for this component.</p>
+     *
+     * @param context <code>FacesContext</code> for the current request
+     * @param component <code>UIComponent</code> to be decoded
+     *
+     * @exception IOException if an input/output error occurs
+     */
+    public void encodeEnd(FacesContext context, UIComponent component)
+      throws IOException {
+
+        if ((context == null) || (component == null)) {
+            throw new NullPointerException();
+        }
+
+        Token token = (Token) component;
+        if (token.isRendered()) {
+            ResponseWriter writer = context.getResponseWriter();
+            writer.endElement("input");
+        }
+
+    }
+
+
+}

Added: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/renderer/package.html
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/renderer/package.html?view=auto&rev=123833
==============================================================================
--- (empty file)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/renderer/package.html	Fri Dec 31 15:41:08 2004
@@ -0,0 +1,24 @@
+<!--
+ * 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.
+ * 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.
+-->
+
+<!-- $Id$ -->
+
+<body>
+
+<p>This package defines JavaServer Faces renderers that are integral to the
+Shale architecture.</p>
+
+</body>

Added: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/taglib/TokenTag.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/taglib/TokenTag.java?view=auto&rev=123833
==============================================================================
--- (empty file)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/taglib/TokenTag.java	Fri Dec 31 15:41:08 2004
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ * 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.shale.taglib;
+
+import javax.faces.webapp.UIComponentTag;
+import org.apache.shale.component.Token;
+
+/**
+ * <p>JSP custom tag for the {@link Token} component.</p>
+ *
+ * $Id$
+ */
+public class TokenTag extends UIComponentTag {
+    
+
+    /**
+     * <p>Return the required component type.</p>
+     */
+    public String getComponentType() {
+        return "org.apache.shale.Token";
+    }
+
+
+    /**
+     * <p>Return the required renderer type.</p>
+     */
+    public String getRendererType() {
+        return "org.apache.shale.Token";
+    }
+
+
+}

Added: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/taglib/package.html
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/taglib/package.html?view=auto&rev=123833
==============================================================================
--- (empty file)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/taglib/package.html	Fri Dec 31 15:41:08 2004
@@ -0,0 +1,24 @@
+<!--
+ * 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.
+ * 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.
+-->
+
+<!-- $Id$ -->
+
+<body>
+
+<p>This package defines JavaServer Faces component tags that are integral to the
+Shale architecture.</p>
+
+</body>

Added: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/util/Messages.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/util/Messages.java?view=auto&rev=123833
==============================================================================
--- (empty file)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/util/Messages.java	Fri Dec 31 15:41:08 2004
@@ -0,0 +1,199 @@
+/*
+ * 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.
+ * 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.shale.util;
+
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+/**
+ * <p>Utility wrapper around resource bundles that provides locale-specific
+ * message string lookups, as well as parameter replacement services.</p>
+ *
+ * $Id$
+ */
+public class Messages {
+    
+
+    // ------------------------------------------------------------ Constructors
+
+
+    /**
+     * <p>Construct a new {@link Messages} wrapper around the specified
+     * resource bundle name, loaded by the default class loader.</p>
+     *
+     * @param name Name of the requested <code>ResourceBundle</code>
+     */
+    public Messages(String name) {
+
+        this(name, null);
+
+    }
+
+    
+    /**
+     * <P>Construct a new {@link Messages} wrapper around the specified
+     * resource bundle name, loaded by the specified class loader.</p>
+     *
+     * @param name Name of the requested <code>ResourceBundle</code>
+     * @param cl <code>ClassLoader</code> to use for loading this
+     *  resource bundle, or <code>null</code> for the default
+     */
+    public Messages(String name, ClassLoader cl) {
+
+        this.name = name;
+        this.cl = cl;
+
+    }
+
+
+    // ------------------------------------------------------ Instance Variables
+
+
+    /**
+     * <p>Set of localized <code>ResourceBundle</code> instances we have ever
+     * retrieved, keyed by <code>Locale</code>.</p>
+     */
+    private Map bundles = new HashMap();
+
+
+    /**
+     * <p><code>ClassLoader</code> from which to load the specfied
+     * resource bundle.</p>
+     */
+    private ClassLoader cl = null;
+
+
+    /**
+     * <p>The default <code>Locale</code> for this server.</p>
+     */
+    private Locale defaultLocale = Locale.getDefault();
+
+
+    /**
+     * <p><code>MessageFormat</code> used to perform parameter substitution.</p>
+     */
+    private MessageFormat format = new MessageFormat("");
+
+
+    /**
+     * <p>Name of the resource bundle to be retrieved.</p>
+     */
+    private String name = null;
+
+
+    // ---------------------------------------------------------- Public Methods
+
+
+    /**
+     * <p>Retrieve the specified message string for the default locale.  If no
+     * message can be found, return <code>null</code>.</p>
+     *
+     * @param key Key to the message string to look up
+     */
+    public String getMessage(String key) {
+
+        return getMessage(key, defaultLocale);
+
+    }
+
+
+    /**
+     * <p>Retrieve the specified message string for the default locale, and
+     * perform parameter substitution with the specified parameters.  If no
+     * message can be found, return <code>null</code>.</p>
+     *
+     * @param key Key to the message string to look up
+     * @param params Parameter replacement values
+     */
+    public String getMessage(String key, Object params[]) {
+
+        return getMessage(key, defaultLocale, params);
+
+    }
+
+
+    /**
+     * <p>Retrieve the specified message string for the specified locale.  If no
+     * message can be found, return <code>null</code>.</p>
+     *
+     * @param key Key to the message string to look up
+     * @param locale Locale used to localize this message
+     */
+    public String getMessage(String key, Locale locale) {
+
+        ResourceBundle rb = getBundle(locale);
+        return rb.getString(key);
+
+    }
+
+
+    /**
+     * <p>Retrieve the specified message string for the specified locale, and
+     * perform parameter substitution with the specified parameters.  If no
+     * message can be found, return <code>null</code>.</p>
+     *
+     * @param key Key to the message string to look up
+     * @param locale Locale used to localize this message
+     * @param params Parameter replacement values
+     */
+    public String getMessage(String key, Locale locale, Object params[]) {
+
+        String message = getMessage(key, locale);
+        if ((message == null) || (params == null) || (params.length < 1)) {
+            return message;
+        }
+        synchronized(format) {
+            format.applyPattern(message);
+            message = format.format(params);
+        }
+        return message;
+
+    }
+
+
+    // --------------------------------------------------------- Private Methods
+
+
+    /**
+     * <p>Return the localized <code>ResourceBundle</code> for the specified
+     * <code>Locale</code>.</p>
+     *
+     * @param locale Locale used to select the appropriate resource bundle
+     */
+    private ResourceBundle getBundle(Locale locale) {
+
+        ResourceBundle rb = null;
+        synchronized (bundles) {
+            rb = (ResourceBundle) bundles.get(locale);
+            if (rb == null) {
+                if (cl == null) {
+                    rb = ResourceBundle.getBundle(name, locale);
+                } else {
+                    rb = ResourceBundle.getBundle(name, locale, cl);
+                }
+                bundles.put(locale, rb);
+            }
+            return rb;
+        }
+
+    }
+
+
+}

Added: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/util/TokenProcessor.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/util/TokenProcessor.java?view=auto&rev=123833
==============================================================================
--- (empty file)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/util/TokenProcessor.java	Fri Dec 31 15:41:08 2004
@@ -0,0 +1,146 @@
+/*
+ * 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.
+ * 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.shale.util;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.HashSet;
+import java.util.Set;
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import org.apache.shale.faces.ShaleConstants;
+
+/**
+ * <p>Utility methods supporting the generation and validation of transaction
+ * tokens, used to avoid duplicate form submits.</p>
+ *
+ * $Id$
+ */
+public class TokenProcessor {
+    
+    
+    // ------------------------------------------------------ Instance Variables
+
+
+    /**
+     * <p>Timestamp most recently used to generate a transaction token value.</p>
+     */
+    private long previous;
+
+
+    // ----------------------------------------------------------- Pubic Methods
+
+
+    /**
+     * <p>Generate and return the next transaction token value, and store it
+     * so that it may be verified on a subsequent form submit.</p>
+     *
+     * @param context <code>FacesContext</code> for the current request
+     */
+    public synchronized String generate(FacesContext context) {
+
+        // Acquire the session identifier for this request
+        ValueBinding vb =
+          context.getApplication().createValueBinding("#{facesContext.session.id}");
+        byte id[] = ((String) vb.getValue(context)).getBytes();
+
+        // Acquire the timestamp we will use for this request
+        long current = System.currentTimeMillis();
+        if (current == previous) {
+            current++;
+        }
+        byte now[] = new Long(current).toString().getBytes();
+
+        // Calculate the new transaction token value
+        String token = null;
+        try {
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            md.update(id);
+            md.update(now);
+            token = toHex(md.digest());
+        } catch (NoSuchAlgorithmException e) {
+            throw new FacesException(e);
+        }
+
+        // Store the generated value for later verification
+        Set set = (Set)
+          context.getExternalContext().getSessionMap().get(ShaleConstants.TOKENS);
+        if (set == null) {
+            set = new HashSet();
+            context.getExternalContext().getSessionMap().put(ShaleConstants.TOKENS, set);
+        }
+        set.add(token);
+
+        // Return the generated and cached value
+        return token;
+
+    }
+
+
+    /**
+     * <p>Verify that the specified transaction token value (retrieved from an
+     * incoming request) is a valid transaaction token.  In addition, remove it
+     * from any stored cache of tokens, so that it may not be reused.</p>
+     *
+     * @param context <code>FacesContext</code> for the current request
+     * @param token Transaction token to be verified
+     *
+     * @return <code>True</code> if this token has been verified,
+     *  else <code>false</code>
+     */
+    public synchronized boolean verify(FacesContext context, String token) {
+
+        Set set = (Set)
+          context.getExternalContext().getSessionMap().get(ShaleConstants.TOKENS);
+        if (set == null) {
+            return false;
+        }
+        if (set.contains(token)) {
+            set.remove(token);
+            if (set.size() < 1) {
+                context.getExternalContext().getSessionMap().remove(ShaleConstants.TOKENS);
+            }
+            return true;
+        }
+        return false;
+
+    }
+
+
+    // --------------------------------------------------------- Private Methods
+
+
+    /**
+     * <p>Convert the specified byte array into a String of hexadecimal
+     * digit characters.</p>
+     *
+     * @param buffer Byte array to be converted
+     */
+    private String toHex(byte buffer[]) {
+
+        StringBuffer sb = new StringBuffer(buffer.length * 2);
+        for (int i = 0; i < buffer.length; i++) {
+            sb.append(Character.forDigit((buffer[i] & 0xf0) >> 4, 16));
+            sb.append(Character.forDigit((buffer[i] & 0x0f), 16));
+        }
+        return sb.toString();
+
+    }
+
+
+}

Added: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/util/package.html
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/util/package.html?view=auto&rev=123833
==============================================================================
--- (empty file)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/util/package.html	Fri Dec 31 15:41:08 2004
@@ -0,0 +1,24 @@
+<!--
+ * 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.
+ * 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.
+-->
+
+<!-- $Id$ -->
+
+<body>
+
+<p>This package defines utility classes that are useful throughout the
+Shale architecture.</p>
+
+</body>

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/AbstractViewController.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/AbstractViewController.java?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/AbstractViewController.java&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/AbstractViewController.java&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/AbstractViewController.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/AbstractViewController.java	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 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.

Modified: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/DefaultViewControllerMapper.java
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/DefaultViewControllerMapper.java?view=diff&rev=123833&p1=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/DefaultViewControllerMapper.java&r1=123832&p2=struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/DefaultViewControllerMapper.java&r2=123833
==============================================================================
--- struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/DefaultViewControllerMapper.java	(original)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/DefaultViewControllerMapper.java	Fri Dec 31 15:41:08 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 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.
@@ -16,6 +16,8 @@
 
 package org.apache.shale.view;
 
+import java.util.HashSet;
+import java.util.Set;
 import org.apache.shale.ViewControllerMapper;
 
 /**
@@ -25,8 +27,11 @@
  * <li>Strip any leading slash ("/") character.</li>
  * <li>Strip any traling extension (".xxx"), as long as it occurs
  *     after any remaining slash ("/") character.</li>
- * <li>Convert each instance of a slash ("/") or period (".")
- *     character into an underscore ("_") character.</li>
+ * <li>Convert each instance of a slash ("/")
+ *     character into a dollar sign ("$") character.</li>
+ * <li>If the resulting name matches one of the reserved names recognized
+ *     by the default <code>VariableResolver</code>, prefix it with an
+ *     underscore character ("_"), to avoid problems loading managed beans.</li>
  * </ul>
  *
  * $Id$
@@ -35,6 +40,29 @@
 public class DefaultViewControllerMapper implements ViewControllerMapper {
     
 
+    // -------------------------------------------------------- Static Variables
+
+
+    /**
+     * <p>Reserved variable names.</p>
+     */
+    private static Set reserved = new HashSet();
+
+    static {
+        reserved.add("applicationScope");
+        reserved.add("cookies");
+        reserved.add("facesContext");
+        reserved.add("header");
+        reserved.add("headerValues");
+        reserved.add("initParam");
+        reserved.add("param");
+        reserved.add("paramValues");
+        reserved.add("requestScope");
+        reserved.add("sessionScope");
+        reserved.add("view");
+    }
+
+
     // ---------------------------------------------------------- Public Methods
 
 
@@ -52,7 +80,12 @@
         if ((period >= 0) && (period > slash)) {
             viewId = viewId.substring(0, period);
         }
-        return viewId.replace('/', '_').replace('.', '_');
+        viewId = viewId.replace('/', '$');
+        if (reserved.contains(viewId)) {
+            return "_" + viewId;
+        } else {
+            return viewId;
+        }
 
     }
 

Added: struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/package.html
Url: http://svn.apache.org/viewcvs/struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/package.html?view=auto&rev=123833
==============================================================================
--- (empty file)
+++ struts/sandbox/trunk/struts-shale/src/java/org/apache/shale/view/package.html	Fri Dec 31 15:41:08 2004
@@ -0,0 +1,24 @@
+<!--
+ * 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.
+ * 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.
+-->
+
+<!-- $Id$ -->
+
+<body>
+
+<p>This package defines base classes and implementations related to the
+ViewController functionality provided by Shale.</p>
+
+</body>

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