You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by aj...@apache.org on 2008/11/24 05:57:20 UTC

svn commit: r720116 [2/3] - in /incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH: doc/ etc/i18n/plugin/ src/com/ecyrd/jspwiki/ src/com/ecyrd/jspwiki/action/ src/com/ecyrd/jspwiki/auth/acl/ src/com/ecyrd/jspwiki/dav/items/ src/com/ecyrd/jspwiki/dif...

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/RSSActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/RSSActionBean.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/RSSActionBean.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/RSSActionBean.java Sun Nov 23 20:57:18 2008
@@ -4,34 +4,11 @@
 import net.sourceforge.stripes.action.Resolution;
 import net.sourceforge.stripes.action.UrlBinding;
 
-import com.ecyrd.jspwiki.WikiContext;
-import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.WikiException;
-import com.ecyrd.jspwiki.WikiPage;
 import com.ecyrd.jspwiki.auth.permissions.PagePermission;
 
 @UrlBinding( "/rss.jsp" )
-public class RSSActionBean extends WikiContext
+public class RSSActionBean extends AbstractActionBean
 {
-    /**
-     * Retrieves a new RSSActionBean for the given WikiPage.
-     * 
-     * @param engine The WikiEngine that is handling the request.
-     * @param page The WikiPage. If you want to create an RSSActionBean for an
-     *            older version of a page, you must use this constructor.
-     * @throws WikiException 
-     */
-    public static RSSActionBean getRSSActionBean( WikiEngine engine, WikiPage page ) throws WikiException
-    {
-        if( engine == null )
-        {
-            throw new IllegalArgumentException( "Parameter engine must not be null." );
-        }
-        RSSActionBean rssBean = (RSSActionBean)engine.getWikiActionBeanFactory().newActionBean( null, null, RSSActionBean.class );
-        rssBean.setPage( page );
-        return rssBean;
-    }
-
     @HandlesEvent( "rss" )
     @HandlerPermission( permissionClass = PagePermission.class, target = "${page.name}", actions = PagePermission.VIEW_ACTION )
     @WikiRequestContext( "rss" )

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/RenameActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/RenameActionBean.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/RenameActionBean.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/RenameActionBean.java Sun Nov 23 20:57:18 2008
@@ -13,9 +13,9 @@
 
 import org.apache.log4j.Logger;
 
-import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
 import com.ecyrd.jspwiki.WikiException;
+import com.ecyrd.jspwiki.WikiPage;
 import com.ecyrd.jspwiki.auth.permissions.PagePermission;
 
 /**
@@ -48,16 +48,27 @@
  * 
  * @author Andrew Jaquith
  */
-@UrlBinding( "/Rename.jsp" )
-public class RenameActionBean extends WikiContext
+@UrlBinding( "/Rename.action" )
+public class RenameActionBean extends AbstractActionBean
 {
     private static final Logger log = Logger.getLogger( RenameActionBean.class );
 
     private boolean m_changeReferences = false;
+    
+    private WikiPage m_page = null;
 
     private String m_renameTo = null;
 
     /**
+     * Returns the WikiPage; defaults to <code>null</code>.
+     * @return the page
+     */
+    public WikiPage getPage()
+    {
+        return m_page;
+    }
+    
+    /**
      * Returns the proposed new name for the page; defaults to <code>null</code>
      * if not set.
      * 
@@ -92,12 +103,12 @@
     @WikiRequestContext( "rename" )
     public Resolution rename() throws WikiException
     {
-        WikiEngine engine = this.getEngine();
-        String renameFrom = getPage().getName();
+        WikiEngine engine = getContext().getEngine();
+        String renameFrom = getContext().getPage().getName();
         HttpServletRequest request = getContext().getRequest();
         log.info( "Page rename request for page '" + renameFrom + "' to new name '" + m_renameTo + "' from "
                   + request.getRemoteAddr() + " by " + request.getRemoteUser() );
-        String renamedTo = engine.renamePage( this, renameFrom, m_renameTo, m_changeReferences );
+        String renamedTo = engine.renamePage( getContext(), renameFrom, m_renameTo, m_changeReferences );
         log.info( "Page successfully renamed to '" + renamedTo + "'" );
         RedirectResolution r = new RedirectResolution( ViewActionBean.class );
         r.addParameter( "page", renamedTo );
@@ -118,6 +129,17 @@
     }
 
     /**
+     * Sets the page.
+     * @param page the wiki page.
+     */
+    @Validate( required = true )
+    public void setPage( WikiPage page )
+    {
+        m_page = page;
+        getContext().setPage( page );
+    }
+    
+    /**
      * Sets the new name for the page, which will be set when the
      * {@link #rename()} handler is executed.
      * 
@@ -139,7 +161,7 @@
     @ValidationMethod( on = "rename" )
     public void validateBeforeRename( ValidationErrors errors )
     {
-        if( getContext().getWikiEngine().pageExists( m_renameTo ) )
+        if( getContext().getEngine().pageExists( m_renameTo ) )
         {
             errors.add( "renameTo", new SimpleError( "The page name '" + m_renameTo + "' already exists. Choose another." ) );
         }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UploadActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UploadActionBean.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UploadActionBean.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UploadActionBean.java Sun Nov 23 20:57:18 2008
@@ -4,11 +4,10 @@
 import net.sourceforge.stripes.action.Resolution;
 import net.sourceforge.stripes.action.UrlBinding;
 
-import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.auth.permissions.PagePermission;
 
 @UrlBinding( "/Upload.jsp" )
-public class UploadActionBean extends WikiContext
+public class UploadActionBean extends AbstractActionBean
 {
     @HandlesEvent( "upload" )
     @HandlerPermission( permissionClass = PagePermission.class, target = "${page.name}", actions = PagePermission.UPLOAD_ACTION )

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UserPreferencesActionBean.java Sun Nov 23 20:57:18 2008
@@ -16,7 +16,7 @@
 /**
  * @author Andrew Jaquith
  */
-@UrlBinding( "/UserPreferences.jsp" )
+@UrlBinding( "/UserPreferences.action" )
 public class UserPreferencesActionBean extends AbstractActionBean
 {
     private String m_assertedName = null;
@@ -32,7 +32,7 @@
      * @return a redirection to the logout page
      */
     @HandlesEvent( "clearAssertedName" )
-    @HandlerPermission( permissionClass = WikiPermission.class, target = "${engine.applicationName}", actions = WikiPermission.EDIT_PREFERENCES_ACTION )
+    @HandlerPermission( permissionClass = WikiPermission.class, target = "${context.engine.applicationName}", actions = WikiPermission.EDIT_PREFERENCES_ACTION )
     public Resolution clearAssertedName()
     {
         HttpServletResponse response = getContext().getResponse();
@@ -49,7 +49,7 @@
     @WikiRequestContext( "favorites" )
     public Resolution editFavorites()
     {
-        Principal principal = this.getCurrentUser();
+        Principal principal = getContext().getCurrentUser();
         return new RedirectResolution( "/Edit.jsp?" + principal.getName() + "Favorites" );
     }
 
@@ -62,11 +62,11 @@
      */
     @DefaultHandler
     @HandlesEvent( "createAssertedName" )
-    @HandlerPermission( permissionClass = WikiPermission.class, target = "${engine.applicationName}", actions = WikiPermission.EDIT_PREFERENCES_ACTION )
+    @HandlerPermission( permissionClass = WikiPermission.class, target = "${context.engine.applicationName}", actions = WikiPermission.EDIT_PREFERENCES_ACTION )
     @WikiRequestContext( "prefs" )
     public Resolution createAssertedName()
     {
-        if( !getWikiSession().isAuthenticated() )
+        if( !getContext().getWikiSession().isAuthenticated() )
         {
             HttpServletRequest request = getContext().getRequest();
             HttpServletResponse response = getContext().getResponse();

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UserProfileActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UserProfileActionBean.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UserProfileActionBean.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UserProfileActionBean.java Sun Nov 23 20:57:18 2008
@@ -59,8 +59,8 @@
     public Resolution initUserProfile()
     {
         // Retrieve the user profile
-        WikiEngine engine = getEngine();
-        WikiSession session = getWikiSession();
+        WikiEngine engine = getContext().getEngine();
+        WikiSession session = getContext().getWikiSession();
         UserManager manager = engine.getUserManager();
         m_profile = manager.getUserProfile( session );
 
@@ -82,17 +82,16 @@
      *         of errors, or <code>null</code> otherwise
      */
     @HandlesEvent( "save" )
-    @HandlerPermission( permissionClass = WikiPermission.class, target = "${engine.applicationName}", actions = WikiPermission.EDIT_PROFILE_ACTION )
+    @HandlerPermission( permissionClass = WikiPermission.class, target = "${context.engine.applicationName}", actions = WikiPermission.EDIT_PROFILE_ACTION )
     public Resolution save()
     {
         WikiActionBeanContext context = getContext();
         ValidationErrors errors = context.getValidationErrors();
-        Resolution r = null;
         try
         {
             // Save the profile
-            WikiEngine engine = getEngine();
-            engine.getUserManager().setUserProfile( getWikiSession(), m_profile );
+            WikiEngine engine = getContext().getEngine();
+            engine.getUserManager().setUserProfile( getContext().getWikiSession(), m_profile );
             CookieAssertionLoginModule.setUserCookie( context.getResponse(), m_profile.getFullname() );
         }
 
@@ -101,7 +100,7 @@
         {
             UrlBuilder builder = new UrlBuilder( this.getContext().getLocale(), ViewActionBean.class, false );
             builder.addParameter( "page", "ApprovalRequiredForUserProfiles" );
-            r = new RedirectResolution( builder.toString() );
+            return new RedirectResolution( builder.toString() );
         }
 
         // Any other errors are either UI or config problems, so let the user
@@ -115,7 +114,7 @@
         if( errors.size() == 0 )
         {
             // Set user cookie
-            Principal principal = getWikiSession().getUserPrincipal();
+            Principal principal = getContext().getWikiSession().getUserPrincipal();
             CookieAssertionLoginModule.setUserCookie( getContext().getResponse(), principal.getName() );
             UrlBuilder builder = new UrlBuilder( getContext().getLocale(), ViewActionBean.class, false );
             if( m_redirect != null )
@@ -148,7 +147,7 @@
     public void setRedirect( String redirect )
     {
         m_redirect = redirect;
-        setVariable( "redirect", redirect );
+        getContext().setVariable( "redirect", redirect );
     }
 
     /**
@@ -162,9 +161,9 @@
     @ValidationMethod( on = "save", when = ValidationState.NO_ERRORS )
     public void validateNoCollision( ValidationErrors errors )
     {
-        WikiEngine engine = getEngine();
-        WikiSession session = getWikiSession();
-        UserManager manager = getEngine().getUserManager();
+        WikiEngine engine = getContext().getEngine();
+        WikiSession session = getContext().getWikiSession();
+        UserManager manager = engine.getUserManager();
         UserDatabase database = manager.getUserDatabase();
 
         // Locate the old user profile

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/ViewActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/ViewActionBean.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/ViewActionBean.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/ViewActionBean.java Sun Nov 23 20:57:18 2008
@@ -8,7 +8,6 @@
 
 import org.apache.log4j.Logger;
 
-import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
 import com.ecyrd.jspwiki.WikiException;
 import com.ecyrd.jspwiki.WikiPage;
@@ -20,10 +19,12 @@
  * @author Andrew Jaquith
  *
  */
-@UrlBinding("/Wiki.jsp")
-public class ViewActionBean extends WikiContext
+@UrlBinding("/Wiki.action")
+public class ViewActionBean extends AbstractActionBean
 {
     private Logger log = Logger.getLogger(ViewActionBean.class);
+    
+    private WikiPage m_page = null;
 
     public ViewActionBean()
     {
@@ -31,6 +32,15 @@
     }
 
     /**
+     * Returns the WikiPage; defaults to <code>null</code>.
+     * @return the page
+     */
+    public WikiPage getPage()
+    {
+        return m_page;
+    }
+
+    /**
      * <p>After the binding and validation  {@link LifecycleStage#BindingAndValidation}
      * lifecycle stage executes, this method determines whether the
      * page name specified in the request is actually a special page and
@@ -50,7 +60,7 @@
     {
         WikiPage page = getPage();
         ValidationErrors errors = this.getContext().getValidationErrors();
-        WikiEngine engine = getContext().getWikiEngine();
+        WikiEngine engine = getContext().getEngine();
         
         // If user supplied a page that doesn't exist, redirect to the "create pages" ActionBean
         if ( errors.get("page" )!= null )
@@ -92,24 +102,24 @@
         
         // Ok, the user supplied a page. That's nice. But is it a special page?
         String pageName = page.getName();
-        String specialUrl = getEngine().getWikiActionBeanFactory().getSpecialPageReference( pageName );
+        String specialUrl = getContext().getEngine().getWikiActionBeanFactory().getSpecialPageReference( pageName );
         if ( specialUrl != null )
         {
-            return new RedirectResolution( getViewURL( specialUrl ) );
+            return new RedirectResolution( getContext().getViewURL( specialUrl ) );
         }
 
         // Is there an ALIAS attribute in the wiki pge?
         specialUrl = (String)page.getAttribute( WikiPage.ALIAS );
         if( specialUrl != null )
         {
-            return new RedirectResolution( getViewURL( specialUrl ) );
+            return new RedirectResolution( getContext().getViewURL( specialUrl ) );
         }
         
         // Is there a REDIRECT attribute in the wiki page?
         specialUrl = (String)page.getAttribute( WikiPage.REDIRECT );
         if( specialUrl != null )
         {
-            return new RedirectResolution( getViewURL( specialUrl ) );
+            return new RedirectResolution( getContext().getViewURL( specialUrl ) );
         }
         
         // If we got this far, it means the user supplied a page parameter, AND it exists
@@ -117,13 +127,14 @@
     }
 
     /**
-     * Calls the superclass {@link WikiContext#setPage(WikiPage)} method, but disables validation.
+     * Sets the page.
+     * @param page the wiki page.
      */
-    @Override
     @Validate( required = false)
     public void setPage( WikiPage page )
     {
-        super.setPage( page );
+        m_page = page;
+        getContext().setPage( page );
     }
     
     /**

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBean.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBean.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBean.java Sun Nov 23 20:57:18 2008
@@ -1,26 +1,15 @@
 package com.ecyrd.jspwiki.action;
 
-import java.security.Principal;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import javax.servlet.http.HttpServletRequest;
-
 import net.sourceforge.stripes.action.ActionBean;
 import net.sourceforge.stripes.action.ActionBeanContext;
 
-import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.WikiSession;
-
 /**
- * ActionBean sub-interface that includes getter/setter methods used by JSPWiki, including the
- * request context, skin, template, URL pattern, wiki session and wiki engine.
+ * ActionBean sub-interface.
  * @author Andrew Jaquith
  *
  */
 public interface WikiActionBean extends ActionBean
 {
-    
     /**
      * Returns the ActionBeanContext for the WikiActionBean, using a co-variant
      * return type of WikiActionBeanContext. 
@@ -28,135 +17,8 @@
     public WikiActionBeanContext getContext();
 
     /**
-     * Convenience method that gets the current user. Delegates the lookup to
-     * the WikiSession associated with this WikiActionBean. May return null, in
-     * case the current user has not yet been determined; or this is an internal
-     * system. If the WikiSession has not been set, <em>always</em> returns
-     * null.
-     */
-    public Principal getCurrentUser();
-    
-    /**
      * Sets the WikiActionBeanContext for the ActionBean. This method <em>should</em>
      * be called immediately after bean creation.
      */
     public void setContext(ActionBeanContext context);
-
-    /**
-     * Sets the request context. See above for the different request contexts
-     * (VIEW, EDIT, etc.) This argument must correspond exactly to the value of
-     * a Stripes event handler method's
-     * {@link com.ecyrd.jspwiki.action.WikiRequestContext} annotation for the
-     * bean class. For event handlers that do not have an
-     * {@linkplain com.ecyrd.jspwiki.action.WikiRequestContext} annotation,
-     * callers can supply a request context value based on the bean class and
-     * the event name; see the
-     * {@link com.ecyrd.jspwiki.action.HandlerInfo#getRequestContext()}
-     * documentation for more details.
-     * 
-     * @param arg The request context (one of the predefined contexts.)
-     * @throws IllegalArgumentException if the supplied request context does not correspond
-     * to a {@linkplain com.ecyrd.jspwiki.action.WikiRequestContext}
-     * annotation, or the automatically request context name
-     */
-    public void setRequestContext( String arg );
-    
-    /**
-     * Returns the WikiEngine, which may be <code>null</code> if this instance
-     * was created without invoking the WikiActionBeanContext method
-     * {@link WikiActionBeanContext#setServletContext(javax.servlet.ServletContext)}.
-     */
-    public WikiEngine getEngine();
-
-    /**
-     * Returns the request context for the WikiActionBean. By convention,
-     * this method will return the string value of the annotation 
-     * {@link WikiRequestContext}, which is required for all concrete WikiActionBean 
-     * classes.
-     * @deprecated perform <code>instanceof</code> comparisons instead
-     */
-    public String getRequestContext();
-
-    /**
-     * Returns the "skin" to be used for this ActionBean.
-     * 
-     * @return the skin
-     */
-    public String getSkin();
-
-    /**
-     * <p>
-     * Gets the template that is to be used throughout this request. The value
-     * returned depends on the whether the current HTTP request has supplied a
-     * custom skin or template name. In order of preference:
-     * </p>
-     * <ul>
-     * <li>The "skin", if set by {@link #setSkin(String)} or if the HTTP
-     * parameter <code>skin</code> was bound by Stripes</li>
-     * <li>The template, if set by {@link #setTemplate(String)} or if the HTTP
-     * parameter <code>template</code> was bound by Stripes</li>
-     * <li>The WikiEngine's default template, as returned by
-     * {@link WikiEngine#getTemplateDir()}</li>
-     * <li>The value <code>default</code></li>
-     * </ul>
-     * 
-     * @since 2.1.15.
-     */
-    public String getTemplate();
-
-    /**
-     * Returns the WikiSession associated with the context. This method is
-     * guaranteed to always return a valid WikiSession. If this context was
-     * constructed without an associated HttpServletRequest, it will return
-     * {@link WikiSession#guestSession(WikiEngine)}.
-     */
-    public WikiSession getWikiSession();
-
-    /**
-     * Sets the skin to be used with this ActionBean. This value will override
-     * the template returned by {@link #getTemplate()}. Normally, this method
-     * is invoked by Stripes when binding request parameters to the ActionBean.
-     * 
-     * @param skin
-     *            the skin to use
-     */
-    public void setSkin(String skin);
-
-    /**
-     * Sets the template to be used for this request.
-     * 
-     * @since 2.1.15.
-     */
-    public void setTemplate(String dir);
-
-    /**
-     *  Gets a previously set variable.
-     *
-     *  @param key The variable name.
-     *  @return The variable contents.
-     */
-    public Object getVariable(String key);
-
-    /**
-     *  Sets a variable.  The variable is valid while the WikiContext is valid,
-     *  i.e. while page processing continues.  The variable data is discarded
-     *  once the page processing is finished.
-     *
-     *  @param key The variable name.
-     *  @param data The variable value.
-     */
-    public void setVariable(String key, Object data);
-
-    
-    // FIXME: This method should really cache the ResourceBundles or something...
-    public ResourceBundle getBundle( String bundle ) throws MissingResourceException;
-
-    // ------------------------------------ Deprecated methods we are reluctantly pulling up from WikiContext
-    
-    /**
-     * @deprecated use Stripes bindings to populate ActionBean properties instead
-     */
-    public String getHttpParameter( String varName );
-
-    public HttpServletRequest getHttpRequest();
 }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBeanContext.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBeanContext.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBeanContext.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBeanContext.java Sun Nov 23 20:57:18 2008
@@ -1,11 +1,16 @@
 package com.ecyrd.jspwiki.action;
 
+import java.security.Principal;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 
 import net.sourceforge.stripes.action.ActionBeanContext;
 import net.sourceforge.stripes.controller.FlashScope;
 
+import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
 import com.ecyrd.jspwiki.WikiPage;
 import com.ecyrd.jspwiki.WikiSession;
@@ -14,8 +19,9 @@
 /**
  * <p>
  * {@link net.sourceforge.stripes.action.ActionBeanContext} subclass that
- * contains a convenient reference to the current JSPWiki WikiEngine and the
- * user's HttpServletRequest and WikiSession.
+ * implements the {@link com.ecyrd.jspwiki.WikiContext} interface by wrapping
+ * a {@link DefaultWikiContext} delegate. WikiActionBeanContext  maintains references to the current 
+ * JSPWiki WikiEngine and the user's HttpServletRequest and WikiSession.
  * </p>
  * <p>
  * When the WikiActionBeanContext is created, callers <em>must</em> set the
@@ -28,11 +34,9 @@
  * 
  * @author Andrew Jaquith
  */
-public class WikiActionBeanContext extends ActionBeanContext
+public class WikiActionBeanContext extends ActionBeanContext implements WikiContext
 {
-    private volatile WikiEngine m_engine = null;
-
-    private volatile WikiSession m_wikiSession = null;
+    private DefaultWikiContext m_delegate;
 
     /**
      * Constructs a new WikiActionBeanContext.
@@ -40,24 +44,99 @@
     public WikiActionBeanContext()
     {
         super();
+        m_delegate = new DefaultWikiContext();      // Initialize the delegate
     }
 
     /**
-     * Returns the WikiEngine associated with this WikiActionBeanContext.
+     * Adds a supplied ActionBean to "flash scope" so that it can be used by the
+     * next HttpRequest. When this method is called, the ActionBean is stashed
+     * in the request and the flash scope as attributes. For both, the bean is
+     * stored under names {@link WikiActionBeanFactory#ATTR_ACTIONBEAN} and
+     * {@link WikiTagBase#ATTR_CONTEXT}. This method assumes that the method
+     * {@link #setRequest(HttpServletRequest)} has been previously called.
      * 
-     * @return the wiki engine
+     * @param actionBean the action bean to add
+     * @throws IllegalStateException if the request object has not been
+     *             previously set for this ActionBeanContext
      */
-    public WikiEngine getWikiEngine()
+    public void flash( WikiActionBean actionBean )
     {
-        return m_engine;
+        if( getRequest() == null )
+        {
+            throw new IllegalStateException( "Request not set! Cannot flash action bean." );
+        }
+        FlashScope flash = FlashScope.getCurrent( getRequest(), true );
+        flash.put( actionBean );
+        flash.put( WikiActionBeanFactory.ATTR_ACTIONBEAN, actionBean );
+
+        // If not a WikiContext, synthesize a fake one
+        WikiEngine engine = m_delegate.getEngine();
+        WikiPage page = engine.getPage( engine.getFrontPage() );
+        WikiContext context = engine.getWikiActionBeanFactory().newViewWikiContext( getRequest(), getResponse(), page );
+
+        // Stash the WikiContext
+        flash.put( WikiTagBase.ATTR_CONTEXT, context );
     }
 
     /**
-     * Returns the WikiSession associated with this WikiActionBeanContext.
+     * Returns the request context for this ActionBean by looking up the value
+     * of the annotation {@link WikiRequestContext} associated with the current
+     * event handler method for this ActionBean. The current event handler is
+     * obtained from {@link WikiActionBeanContext#getEventName()}. Note that if
+     * this ActionBean does not have a a current event handler assigned, or if
+     * the event handler method does not contain the WikiRequestContext
+     * annotation, this method will return
+     * {@link com.ecyrd.jspwiki.WikiContext#NONE}.
      */
-    public WikiSession getWikiSession()
+    public String getRequestContext()
     {
-        return m_wikiSession;
+        return m_delegate.getRequestContext();
+    }
+
+    /**
+     * Sets the request context. See above for the different request contexts
+     * (VIEW, EDIT, etc.) This argument must correspond exactly to the value of
+     * a Stripes event handler method's
+     * {@link com.ecyrd.jspwiki.action.WikiRequestContext} annotation for the
+     * bean class. For event handlers that do not have an
+     * {@linkplain com.ecyrd.jspwiki.action.WikiRequestContext} annotation,
+     * callers can supply a request context value based on the bean class and
+     * the event name; see the
+     * {@link com.ecyrd.jspwiki.action.HandlerInfo#getRequestContext()}
+     * documentation for more details.
+     * 
+     * @param arg The request context (one of the predefined contexts.)
+     * @throws IllegalArgumentException if the supplied request context does not
+     *             correspond to a
+     *             {@linkplain com.ecyrd.jspwiki.action.WikiRequestContext}
+     *             annotation, or the automatically request context name
+     */
+    public void setRequestContext( String arg )
+    {
+        HandlerInfo handler = getEngine().getWikiActionBeanFactory().findEventHandler( arg );
+        setEventName( handler.getEventName() );
+        m_delegate.setRequestContext( arg );
+    }
+
+    /**
+     *  {@inheritDoc}. Also calls {@link DefaultWikiContext#setHttpRequest(HttpServletRequest)} on
+     *  the DefaultWikiContext delegate.
+     */
+    @Override
+    public void setEventName( String eventName )
+    {
+        super.setEventName( eventName );
+    }
+
+    /**
+     *  {@inheritDoc}. Also calls {@link DefaultWikiContext#setHttpRequest(HttpServletRequest)} on
+     *  the DefaultWikiContext delegate.
+     */
+    @Override
+    public void setRequest( HttpServletRequest request )
+    {
+        super.setRequest( request );
+        m_delegate.setHttpRequest( request );
     }
 
     /**
@@ -71,60 +150,211 @@
     public void setServletContext( ServletContext servletContext )
     {
         super.setServletContext( servletContext );
-        if( m_engine == null )
+        if( m_delegate.getEngine() == null )
         {
             WikiEngine engine = WikiEngine.getInstance( servletContext, null );
-            setWikiEngine( engine );
+            m_delegate.setEngine( engine );
         }
     }
 
     /**
-     * Sets the WikiEngine associated with this WikiActionBeanContext.
-     * 
-     * @param engine the wiki engine
+     *  Sets the WikiEngine by calling {@link DefaultWikiContext#setEngine(WikiEngine)} on
+     *  the DefaultWikiContext delegate.
      */
-    public void setWikiEngine( WikiEngine engine )
+    public void setEngine( WikiEngine engine )
     {
-        m_engine = engine;
+        m_delegate.setEngine( engine );
     }
 
     /**
-     * Sets the WikiSession associated with this WikiActionBeanContext.
-     * 
-     * @param session the wiki session
+     *  Sets the WikiSession by calling {@link DefaultWikiContext#setEngine(WikiEngine)} on
+     *  the DefaultWikiContext delegate.
      */
-    public void setWikiSession( WikiSession session )
+    public void setWikiSession( WikiSession wikiSession )
     {
-        m_wikiSession = session;
+        m_delegate.setWikiSession( wikiSession );
     }
-
+    
     /**
-     * Adds a supplied ActionBean to "flash scope" so that it can be used by the next
-     * HttpRequest. When this method is called, the ActionBean is stashed in the
-     * request and the flash scope as attributes. For both, the bean is stored
-     * under names {@link WikiActionBeanFactory#ATTR_ACTIONBEAN}
-     * and {@link WikiTagBase#ATTR_CONTEXT}. This method assumes that the
-     * method {@link #setRequest(HttpServletRequest)} has been previously called.
-     * @param actionBean the action bean to add
-     * @throws IllegalStateException if the request object has not been previously set
-     * for this ActionBeanContext
+     *  {@inheritDoc}
      */
-    public void flash( WikiActionBean actionBean )
+    public Object clone()
     {
-        if ( getRequest() == null )
+        try
         {
-            throw new IllegalStateException( "Request not set! Cannot flash action bean." );
+            // super.clone() must always be called to make sure that inherited
+            // objects
+            // get the right type
+            WikiActionBeanContext copy = (WikiActionBeanContext) super.clone();
+            copy.m_delegate = m_delegate;
+            return copy;
         }
-        FlashScope flash = FlashScope.getCurrent( getRequest(), true);
-        flash.put( actionBean );
-        flash.put( WikiActionBeanFactory.ATTR_ACTIONBEAN, actionBean );
-        
-        // If not a WikiContext, synthesize a fake one
-        WikiPage page = m_engine.getPage( m_engine.getFrontPage() );
-        actionBean = m_engine.getWikiActionBeanFactory().newViewActionBean( getRequest(), getResponse(), page );
-        
-        // Stash the WikiContext
-        flash.put( WikiTagBase.ATTR_CONTEXT, actionBean );
+        catch( CloneNotSupportedException e )
+        {
+        } // Never happens
+
+        return null;
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public WikiContext deepClone()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public ResourceBundle getBundle( String bundle ) throws MissingResourceException
+    {
+        return m_delegate.getBundle( bundle );
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public Principal getCurrentUser()
+    {
+        return m_delegate.getCurrentUser();
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public WikiEngine getEngine()
+    {
+        return m_delegate.getEngine();
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public String getHttpParameter( String paramName )
+    {
+        return m_delegate.getHttpParameter( paramName );
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public HttpServletRequest getHttpRequest()
+    {
+        return m_delegate.getHttpRequest();
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public String getName()
+    {
+        return m_delegate.getName();
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public WikiPage getPage()
+    {
+        return m_delegate.getPage();
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public WikiPage getRealPage()
+    {
+        return m_delegate.getRealPage();
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public String getTemplate()
+    {
+        return m_delegate.getTemplate();
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public String getURL( String context, String page )
+    {
+        return m_delegate.getURL( context, page );
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public String getURL( String context, String page, String params )
+    {
+        return m_delegate.getURL( context, page, params );
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public Object getVariable( String key )
+    {
+        return m_delegate.getVariable( key );
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public String getViewURL( String page )
+    {
+        return m_delegate.getViewURL( page );
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public WikiSession getWikiSession()
+    {
+        return m_delegate.getWikiSession();
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public boolean hasAdminPermissions()
+    {
+        return m_delegate.hasAdminPermissions();
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public void setPage( WikiPage page )
+    {
+        m_delegate.setPage( page );
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public WikiPage setRealPage( WikiPage page )
+    {
+        return m_delegate.setRealPage( page );
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public void setTemplate( String dir )
+    {
+        m_delegate.setTemplate( dir );
+    }
+
+    /**
+     *  {@inheritDoc}
+     */
+    public void setVariable( String key, Object data )
+    {
+        m_delegate.setVariable( key, data );
     }
     
 }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBeanFactory.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBeanFactory.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBeanFactory.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBeanFactory.java Sun Nov 23 20:57:18 2008
@@ -1,14 +1,12 @@
 package com.ecyrd.jspwiki.action;
 
 import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
+import java.util.*;
 
 import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.servlet.jsp.PageContext;
 
 import net.sourceforge.stripes.action.RedirectResolution;
 import net.sourceforge.stripes.controller.StripesConstants;
@@ -22,6 +20,7 @@
 import com.ecyrd.jspwiki.*;
 import com.ecyrd.jspwiki.auth.SessionMonitor;
 import com.ecyrd.jspwiki.parser.MarkupParser;
+import com.ecyrd.jspwiki.preferences.Preferences;
 import com.ecyrd.jspwiki.providers.ProviderException;
 import com.ecyrd.jspwiki.tags.WikiTagBase;
 import com.ecyrd.jspwiki.url.StripesURLConstructor;
@@ -308,56 +307,51 @@
 
     /**
      * <p>
-     * Creates a WikiActionBean instance, associates an HTTP request and
-     * response with it, and incorporates the correct WikiPage into the bean if
+     * Creates a WikiActionBeanContext instance, associates an HTTP request and
+     * response with it, and sets the correct WikiPage into the context if
      * required. This method will determine what page the user requested by
-     * delegating to
-     * {@link #extractPageFromParameter(HttpServletRequest)}.
+     * delegating to {@link #extractPageFromParameter(HttpServletRequest)}.
      * </p>
      * <p>
-     * This method will <em>always</em>return a WikiActionBean that is
-     * properly instantiated. It will also create a new {@link WikiActionBeanContext}
-     * and associate it with the action bean. The supplied request and response
-     * objects will be associated with the WikiActionBeanContext. The
-     * <code>beanClass</code>is required. If either the <code>request</code>
-     * or <code>response</code> parameters are <code>null</code>,
-     * appropriate mock objects will be substituted instead.
-     * </p>
-     * <p>
-     * This method performs a similar role to the &lt;stripes:useActionBean&gt;
-     * tag, in the sense that it will instantiate an arbitrary WikiActionBean
-     * class and, in the case of WikiContext subclasses, bind a WikiPage to it.
-     * However, it lacks some of the capabilities the JSP tag possesses. For
-     * example, although this method will correctly identity the page requested
-     * by the user (by inspecting request parameters), it will not do anything
-     * special if the page is a "special page." If special page resolution and
-     * redirection is required, use the &lt;stripes:useActionBean&gt; JSP tag
+     * This method will <em>always</em>return a {@link WikiActionBeanContext}
+     * that is properly instantiated. The supplied request and response objects
+     * will be associated with the WikiActionBeanContext. The
+     * <code>requestContext</code>is required. If either the
+     * <code>request</code> or <code>response</code> parameters are
+     * <code>null</code>, appropriate mock objects will be substituted
      * instead.
      * </p>
+     * <p>
+     * This method performs a similar role to the Stripes
+     * {@link net.sourceforge.stripes.controller.ActionBeanContextFactory#getContextInstance(HttpServletRequest, HttpServletResponse)}
+     * method, in the sense that it will instantiate an arbitrary
+     * ActionBeanContext class. However, although this method will correctly
+     * identity the page requested by the user (by inspecting request
+     * parameters), it will not do anything special if the page is a "special
+     * page."
+     * </p>
      * 
      * @param request the HTTP request
      * @param response the HTTP request
-     * @param beanClass the request context to use by default</code>
-     * @return the resolved wiki action bean
-     * @see net.sourceforge.stripes.tag.UseActionBeanTag
-     */
-    public WikiActionBean newActionBean( HttpServletRequest request, HttpServletResponse response,
-                                         Class<? extends WikiActionBean> beanClass ) throws WikiException
-    {
-        return newInstance( beanClass, request, response, null );
+     * @param requestContext the request context to use by default
+     * @return the new WikiActionBeanContext
+     */
+    public WikiActionBeanContext newWikiContext( HttpServletRequest request, HttpServletResponse response, String requestContext )
+                                                                                                                           throws WikiException
+    {
+        return newContext( requestContext, request, response, null );
     }
 
     /**
-     * Creates a new ViewActionBean for the given WikiEngine, WikiPage and
-     * HttpServletRequest. This method performs a similar role to the
-     * &lt;stripes:useActionBean&gt; tag, in the sense that it will instantiate
-     * an arbitrary WikiActionBean class and, in the case of WikiContext
-     * subclasses, bind a WikiPage to it. However, it lacks some of the
-     * capabilities the JSP tag possesses. For example, although this method
-     * will correctly identity the page requested by the user (by inspecting
-     * request parameters), it will not do anything special if the page is a
-     * "special page." If special page resolution and redirection is required,
-     * use the &lt;stripes:useActionBean&gt; JSP tag instead.
+     * <p>Creates a new WikiActionBeanContext for the given HttpServletRequest, HttpServletResponse and WikiPage,
+     * using the {@link WikiContext#VIEW} request context. Similar to method {@link #newWikiContext(HttpServletRequest, HttpServletResponse, String)},
+     * this method will <em>always</em>return a {@link WikiActionBeanContext}
+     * that is properly instantiated. The supplied request and response objects
+     * will be associated with the WikiActionBeanContext. If either the
+     * <code>request</code> or <code>response</code> parameters are
+     * <code>null</code>, appropriate mock objects will be substituted
+     * instead.
+     * </p>
      * 
      * @param request The HttpServletRequest that should be associated with this
      *            context. This parameter may be <code>null</code>.
@@ -365,18 +359,18 @@
      *            this context. This parameter may be <code>null</code>.
      * @param page The WikiPage. If you want to create a WikiContext for an
      *            older version of a page, you must supply this parameter
-     * @see net.sourceforge.stripes.tag.UseActionBeanTag
+     * @return the new WikiActionBeanContext
      */
-    public ViewActionBean newViewActionBean( HttpServletRequest request, HttpServletResponse response, WikiPage page )
+    public WikiActionBeanContext newViewWikiContext( HttpServletRequest request, HttpServletResponse response, WikiPage page )
     {
-        // Create a new "view" ActionBean, and swallow any exceptions
-        ViewActionBean bean = null;
+        // Create a new "view" WikiActionBeanContext, and swallow any exceptions
+        WikiActionBeanContext ctx = null;
         try
         {
-            bean = (ViewActionBean) newInstance( ViewActionBean.class, request, response, page );
-            if( bean == null )
+            ctx = newContext( WikiContext.VIEW, request, response, page );
+            if( ctx == null )
             {
-                throw new IllegalStateException( "Could not create new ViewActionBean! This indicates a bug..." );
+                throw new IllegalStateException( "Could not create new WikiContext of type VIEW! This indicates a bug..." );
             }
         }
         catch( WikiException e )
@@ -384,7 +378,7 @@
             e.printStackTrace();
             log.error( e.getMessage() );
         }
-        return bean;
+        return ctx;
     }
 
     /**
@@ -447,31 +441,14 @@
      * those supplied by the caller; if not supplied, synthetic instances will
      * be substituted.
      * 
-     * @param beanClass the bean class that should be newly instantiated
+     * @param requestContext the request context to use by default
      * @param request
      * @param response
      * @return the newly instantiated bean
      */
-    protected WikiActionBean newInstance( Class<? extends WikiActionBean> beanClass, HttpServletRequest request,
+    protected WikiActionBeanContext newContext( String requestContext, HttpServletRequest request,
                                           HttpServletResponse response, WikiPage page ) throws WikiException
     {
-        // Instantiate the ActionBean first
-        WikiActionBean bean = null;
-        if( beanClass == null )
-        {
-            throw new IllegalArgumentException( "Bean class cannot be null!" );
-        }
-        {
-            try
-            {
-                bean = beanClass.newInstance();
-            }
-            catch( Exception e )
-            {
-                throw new WikiException( "Could not create ActionBean: " + e.getMessage() );
-            }
-        }
-
         // Create synthetic request if not supplied
         if( request == null )
         {
@@ -485,49 +462,44 @@
         {
             response = new MockHttpServletResponse();
         }
-
         // Create the WikiActionBeanContext and set all of its relevant
         // properties
         WikiActionBeanContext actionBeanContext = new WikiActionBeanContext();
-        bean.setContext( actionBeanContext );
         actionBeanContext.setRequest( request );
         actionBeanContext.setResponse( response );
-        actionBeanContext.setWikiEngine( m_engine );
+        actionBeanContext.setEngine( m_engine );
         actionBeanContext.setServletContext( m_engine.getServletContext() );
         WikiSession wikiSession = SessionMonitor.getInstance( m_engine ).find( request.getSession() );
         actionBeanContext.setWikiSession( wikiSession );
 
-        // Set the event name for this action bean to the default handler
-        actionBeanContext.setEventName( HandlerInfo.getDefaultHandlerInfo( beanClass ).getEventName() );
+        // Set the request context (and related event name)
+        actionBeanContext.setRequestContext( requestContext );
 
-        // If ActionBean is a WikiContext, extract and set the WikiPage
-        if( bean instanceof WikiContext )
+        // Extract and set the WikiPage
+        if( page == null )
         {
-            if( page == null )
-            {
-                String pageName = extractPageFromParameter( request );
-
-                // For view action, default to front page
-                if( pageName == null && bean instanceof ViewActionBean )
-                {
-                    pageName = m_engine.getFrontPage();
-                }
+            String pageName = extractPageFromParameter( request );
 
-                // Make sure the page is resolved properly (taking into account
-                // funny plurals)
-                if( pageName != null )
-                {
-                    page = resolvePage( request, pageName );
-                }
+            // For view action, default to front page
+            if( pageName == null && WikiContext.VIEW.equals( requestContext ) )
+            {
+                pageName = m_engine.getFrontPage();
             }
 
-            if( page != null )
+            // Make sure the page is resolved properly (taking into account
+            // funny plurals)
+            if( pageName != null )
             {
-                ((WikiContext) bean).setPage( page );
+                page = resolvePage( request, pageName );
             }
         }
 
-        return bean;
+        if( page != null )
+        {
+            actionBeanContext.setPage( page );
+        }
+
+        return actionBeanContext;
     }
 
     /**
@@ -581,10 +553,46 @@
     }
 
     /**
+         *  Returns the locale of the HTTP request if available,
+         *  otherwise returns the default Locale of the server.
+         *
+         *  @return A valid locale object
+         *  @param context The WikiContext
+         */
+        public static Locale getLocale( WikiContext context )
+        {
+            return Preferences.getLocale( context );
+    /*
+            HttpServletRequest request = context.getHttpRequest();
+            return ( request != null )
+                    ? request.getLocale() : Locale.getDefault();
+    */
+        }
+
+    /**
+     *  This method can be used to find the WikiContext programmatically
+     *  from a JSP PageContext. We check the request context. 
+     *  The wiki context, if it exists,
+     *  is looked up using the key
+     *  {@link com.ecyrd.jspwiki.tags.WikiTagBase#ATTR_CONTEXT}.
+     *
+     *  @since 2.4
+     *  @param pageContext the JSP page context
+     *  @return Current WikiContext, or null, of no context exists.
+     */
+    public static WikiContext findContext( PageContext pageContext )
+    {
+        HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
+        WikiContext context = (WikiContext)request.getAttribute( WikiTagBase.ATTR_CONTEXT );
+        return context;
+    }
+
+    /**
      * Returns the WikiActionBean associated with the current
      * {@link javax.servlet.http.HttpServletRequest}. The ActionBean will be
-     * retrieved from attribute {@link WikiActionBeanFactory#ATTR_ACTIONBEAN}. If an
-     * ActionBean is not found under this name, the standard Stripes attribute
+     * retrieved from attribute {@link WikiActionBeanFactory#ATTR_ACTIONBEAN}.
+     * If an ActionBean is not found under this name, the standard Stripes
+     * attribute
      * {@link net.sourceforge.stripes.controller.StripesConstants#REQ_ATTR_ACTION_BEAN}
      * will be attempted.
      * 
@@ -612,76 +620,71 @@
 
     /**
      * <p>
-     * Saves the supplied WikiActionBean and its associated WikiPage as in
+     * Saves the supplied WikiActionBean and its associated WikiContext,
+     * WikiEngine and WikiSession in
      * request scope. The action bean is saved as an attribute named
-     * {@link #ATTR_ACTIONBEAN}. If the action bean was also a
-     * WikiContext instance, it is saved as an attribute named
-     * {@link com.ecyrd.jspwiki.tags.WikiTagBase#ATTR_CONTEXT}. Among other
-     * things, by saving these items as attributes, they can be accessed via JSP
-     * Expression Language variables, in this case
-     * <code>${wikiActionBean}</code> and <code>${wikiContext}</code>
-     * respectively.
+     * {@link #ATTR_ACTIONBEAN}. The other attributes are saved
+     * as described in {@link #saveContext(HttpServletRequest, WikiContext)}.
+     * </p>
+     * 
+     * @param request the HTTP request
+     * @param actionBean the WikiActionBean to save
+     */
+    public static void saveActionBean( HttpServletRequest request, WikiActionBean actionBean )
+    {
+        // Stash the WikiActionBean
+        request.setAttribute( ATTR_ACTIONBEAN, actionBean );
+
+        // Stash the other attributes
+        saveContext( request, actionBean.getContext() );
+    }
+
+    /**
+     * <p>
+     * Saves the supplied WikiContext, and the related WikiEngine and
+     * WikiSession, in request scope. The WikiContext is saved as an attribute
+     * named {@link com.ecyrd.jspwiki.tags.WikiTagBase#ATTR_CONTEXT}. The
+     * WikiEngine is also saved as {@link #ATTR_WIKIENGINE}, and the
+     * WikiSession as {@link #ATTR_WIKISESSION}. Among other things, by saving
+     * these items as attributes, they can be accessed via JSP Expression
+     * Language variables, in this case <code>${wikiContext}</code>,
+     * <code>${wikiEngine}</code> and <code>${wikiSession}</code>.
      * </p>
      * <p>
-     * Note: the WikiPage set by this method is guaranteed to be non-null. If
-     * the WikiActionBean is not a WikiContext, or it is a WikiContext but its
-     * WikiPage is <code>null</code>, the
+     * Note: when the WikiContext is saved, it will be guaranteed to have a
+     * non-null WikiPage. If the context as supplied has a WikiPage that is
+     * <code>null</code>, the
      * {@link com.ecyrd.jspwiki.WikiEngine#getFrontPage()} will be consulted,
      * and that page will be used.
      * </p>
      * 
      * @param request the HTTP request
-     * @param actionBean the WikiActionBean to save
+     * @param context the WikiContext to save
      */
-    public static void saveActionBean( HttpServletRequest request, WikiActionBean actionBean )
+    public static void saveContext( HttpServletRequest request, WikiContext context )
     {
         // Stash WikiEngine as a request attribute (can be
         // used later as ${wikiEngine} in EL markup)
-        WikiEngine engine = actionBean.getEngine();
+        WikiEngine engine = context.getEngine();
         request.setAttribute( ATTR_WIKIENGINE, engine );
 
         // Stash the WikiSession as a request attribute
         WikiSession wikiSession = SessionMonitor.getInstance( engine ).find( request.getSession() );
         request.setAttribute( ATTR_WIKISESSION, wikiSession );
 
-        // Stash the WikiActionBean
-        request.setAttribute( ATTR_ACTIONBEAN, actionBean );
-
-        // Stash it again as a WikiContext (or synthesize a fake one)
-        WikiContext wikiContext;
-        WikiPage page;
-        if( actionBean instanceof WikiContext )
+        WikiPage page = context.getPage();
+        if( page == null )
         {
-            wikiContext = (WikiContext) actionBean;
-            page = wikiContext.getPage();
+            // If the page supplied was blank, default to the front page to
+            // avoid NPEs
+            page = engine.getPage( engine.getFrontPage() );
+            // Front page does not exist?
             if( page == null )
             {
-                // If the page supplied was blank, default to the front page to
-                // avoid NPEs
-                page = engine.getPage( engine.getFrontPage() );
-                // Front page does not exist?
-                if( page == null )
-                {
-                    page = new WikiPage( engine, engine.getFrontPage() );
-                }
-                wikiContext.setPage( page );
+                page = new WikiPage( engine, engine.getFrontPage() );
             }
+            context.setPage( page );
         }
-        else
-        {
-            HttpServletResponse response = actionBean.getContext().getResponse();
-            page = engine.getPage( engine.getFrontPage() );
-            wikiContext = engine.getWikiActionBeanFactory().newViewActionBean( request, response, page );
-        }
-        request.setAttribute( WikiTagBase.ATTR_CONTEXT, wikiContext );
-
-        // Debug messages
-        if( log.isDebugEnabled() )
-        {
-            log.debug( "Stashed WikiActionBean '" + actionBean + "' in page scope." );
-            log.debug( "Stashed WikiPage '" + page.getName() + "' in page scope." );
-        }
-
+        request.setAttribute( WikiTagBase.ATTR_CONTEXT, context );
     }
-
 }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiInterceptor.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiInterceptor.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiInterceptor.java Sun Nov 23 20:57:18 2008
@@ -132,7 +132,7 @@
         // Set the WikiSession, if not set yet
         if ( actionBeanContext.getWikiSession() == null )
         {
-            WikiEngine engine = actionBeanContext.getWikiEngine();
+            WikiEngine engine = actionBeanContext.getEngine();
             WikiSession wikiSession = SessionMonitor.getInstance( engine ).find( request.getSession() );
             actionBeanContext.setWikiSession( wikiSession );
         }
@@ -199,9 +199,9 @@
             Permission requiredPermission = eventInfo.getPermission( actionBean );
             if( requiredPermission != null )
             {
-                WikiEngine engine = actionBean.getEngine();
+                WikiEngine engine = actionBean.getContext().getEngine();
                 AuthorizationManager mgr = engine.getAuthorizationManager();
-                WikiSession wikiSession = actionBean.getWikiSession();
+                WikiSession wikiSession = actionBean.getContext().getWikiSession();
                 allowed = mgr.checkPermission( wikiSession, requiredPermission );
             }
         }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/acl/DefaultAclManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/acl/DefaultAclManager.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/acl/DefaultAclManager.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/acl/DefaultAclManager.java Sun Nov 23 20:57:18 2008
@@ -180,7 +180,7 @@
                 //
                 //  Or, try parsing the page
                 //
-                WikiContext ctx = m_engine.getWikiActionBeanFactory().newViewActionBean( null, null, page );
+                WikiContext ctx = m_engine.getWikiActionBeanFactory().newViewWikiContext( null, null, page );
 
                 ctx.setVariable( RenderingManager.VAR_EXECUTE_PLUGINS, Boolean.FALSE );
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/dav/items/HTMLPageDavItem.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/dav/items/HTMLPageDavItem.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/dav/items/HTMLPageDavItem.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/dav/items/HTMLPageDavItem.java Sun Nov 23 20:57:18 2008
@@ -76,7 +76,7 @@
     {
         WikiEngine engine = ((WikiDavProvider)m_provider).getEngine();
 
-        WikiContext context = engine.getWikiActionBeanFactory().newViewActionBean( null, null, m_page );
+        WikiContext context = engine.getWikiActionBeanFactory().newViewWikiContext( null, null, m_page );
 
         context.setVariable( MarkupParser.PROP_RUNPLUGINS, "false" );
         context.setVariable( WikiEngine.PROP_RUNFILTERS, "false" );

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/diff/TraditionalDiffProvider.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/diff/TraditionalDiffProvider.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/diff/TraditionalDiffProvider.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/diff/TraditionalDiffProvider.java Sun Nov 23 20:57:18 2008
@@ -37,6 +37,7 @@
 import com.ecyrd.jspwiki.TextUtil;
 import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
+import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
 import com.ecyrd.jspwiki.i18n.InternationalizationManager;
 
 
@@ -181,7 +182,7 @@
             double[] choiceLimits = { 1, 2 };
             
             MessageFormat fmt = new MessageFormat("");
-            fmt.setLocale( WikiContext.getLocale(m_context) );
+            fmt.setLocale( WikiActionBeanFactory.getLocale(m_context) );
             ChoiceFormat cfmt = new ChoiceFormat( choiceLimits, choiceString );
             fmt.applyPattern( type );
             Format[] formats = { NumberFormat.getInstance(), cfmt, NumberFormat.getInstance() };

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/filters/SpamFilter.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/filters/SpamFilter.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/filters/SpamFilter.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/filters/SpamFilter.java Sun Nov 23 20:57:18 2008
@@ -37,6 +37,7 @@
 import org.apache.oro.text.regex.*;
 
 import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
 import com.ecyrd.jspwiki.attachment.Attachment;
 import com.ecyrd.jspwiki.auth.user.UserProfile;
 import com.ecyrd.jspwiki.providers.ProviderException;
@@ -1126,7 +1127,7 @@
      */
     public static final String insertInputFields( PageContext pageContext )
     {
-        WikiContext ctx = WikiContext.findContext(pageContext);
+        WikiContext ctx = WikiActionBeanFactory.findContext(pageContext);
         WikiEngine engine = ctx.getEngine();
 
         StringBuffer sb = new StringBuffer();

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/parser/JSPWikiMarkupParser.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/parser/JSPWikiMarkupParser.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/parser/JSPWikiMarkupParser.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/parser/JSPWikiMarkupParser.java Sun Nov 23 20:57:18 2008
@@ -26,6 +26,7 @@
 import java.text.MessageFormat;
 import java.util.*;
 
+import javax.servlet.http.HttpServletResponse;
 import javax.xml.transform.Result;
 
 import org.apache.commons.lang.StringEscapeUtils;
@@ -36,7 +37,6 @@
 import org.jdom.*;
 
 import com.ecyrd.jspwiki.*;
-import com.ecyrd.jspwiki.action.*;
 import com.ecyrd.jspwiki.attachment.Attachment;
 import com.ecyrd.jspwiki.attachment.AttachmentManager;
 import com.ecyrd.jspwiki.auth.WikiSecurityException;
@@ -1111,9 +1111,9 @@
     {
         if( m_cleanTranslator == null )
         {
-            WikiContext dummyContext = m_engine.getWikiActionBeanFactory().newViewActionBean(
-                                                           m_context.getContext().getRequest(),
-                                                           m_context.getContext().getResponse(),
+            WikiContext dummyContext = m_engine.getWikiActionBeanFactory().newViewWikiContext(
+                                                           m_context.getHttpRequest(),
+                                                           (HttpServletResponse)null,
                                                            m_context.getPage() );            
             m_cleanTranslator = new JSPWikiMarkupParser( dummyContext, null );
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/preferences/Preferences.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/preferences/Preferences.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/preferences/Preferences.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/preferences/Preferences.java Sun Nov 23 20:57:18 2008
@@ -37,8 +37,7 @@
 import com.ecyrd.jspwiki.PropertyReader;
 import com.ecyrd.jspwiki.TextUtil;
 import com.ecyrd.jspwiki.WikiContext;
-import com.ecyrd.jspwiki.action.WikiActionBean;
-import com.ecyrd.jspwiki.action.WikiActionBeanContext;
+import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
 import com.ecyrd.jspwiki.i18n.InternationalizationManager;
 import com.ecyrd.jspwiki.util.HttpUtil;
 
@@ -97,7 +96,7 @@
     {
         Preferences prefs = new Preferences();
         Properties props = PropertyReader.loadWebAppProps( pageContext.getServletContext() );
-        WikiContext ctx = WikiContext.findContext( pageContext );
+        WikiContext ctx = WikiActionBeanFactory.findContext( pageContext );
         
         prefs.put("SkinName", TextUtil.getStringProperty( props, "jspwiki.defaultprefs.template.skinname", "PlainVanilla" ) );
         prefs.put("DateFormat", 
@@ -165,7 +164,7 @@
      *  @param name
      *  @return the preference value
      */
-    public static String getPreference( WikiActionBean wikiContext, String name )
+    public static String getPreference( WikiContext wikiContext, String name )
     {
         HttpServletRequest request = wikiContext.getHttpRequest();
         if ( request == null ) return null;
@@ -203,7 +202,7 @@
      * @return a Locale object.
      * @since 2.8
      */
-    public static Locale getLocale(WikiActionBean context)
+    public static Locale getLocale(WikiContext context)
     {
         Locale loc = null;
         
@@ -234,12 +233,11 @@
         // otherwise try to find out the browser's preferred language setting, or use the JVM's default
         if( loc == null)
         {    
-	        WikiActionBeanContext beanContext = context.getContext();
-    	    if( beanContext == null || beanContext.getRequest() == null )
+    	    if( context.getHttpRequest() == null )
         	{
             	throw new IllegalStateException( "WikiActionBean did not have a valid ActionBeanContext or associated request." );
 	        }
-            loc = ( beanContext.getRequest() != null ) ? beanContext.getRequest().getLocale() : Locale.getDefault();
+            loc = ( context.getHttpRequest() != null ) ? context.getHttpRequest().getLocale() : Locale.getDefault();
         }
 
         //log.info( "using locale "+loc.toString() );

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/providers/CachingProvider.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/providers/CachingProvider.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/providers/CachingProvider.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/providers/CachingProvider.java Sun Nov 23 20:57:18 2008
@@ -685,7 +685,7 @@
             {
                 String data = m_provider.getPageText(page.getName(), page.getVersion());
 
-                WikiContext ctx = m_engine.getWikiActionBeanFactory().newViewActionBean( null, null, page );
+                WikiContext ctx = m_engine.getWikiActionBeanFactory().newViewWikiContext( null, null, page );
                 MarkupParser parser = mgr.getParser( ctx, data );
 
                 parser.parse();

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/rpc/atom/AtomAPIServlet.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/rpc/atom/AtomAPIServlet.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/rpc/atom/AtomAPIServlet.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/rpc/atom/AtomAPIServlet.java Sun Nov 23 20:57:18 2008
@@ -142,7 +142,7 @@
             WikiPage entryPage = new WikiPage( m_engine, pageName );
             entryPage.setAuthor( username );
 
-            WikiContext context = m_engine.getWikiActionBeanFactory().newViewActionBean( request, response, entryPage );
+            WikiContext context = m_engine.getWikiActionBeanFactory().newViewWikiContext( request, response, entryPage );
 
             StringBuffer text = new StringBuffer();
             text.append( "!"+title.getBody() );
@@ -280,7 +280,7 @@
 
             String encodedName = TextUtil.urlEncodeUTF8( p.getName() );
 
-            WikiContext context = m_engine.getWikiActionBeanFactory().newViewActionBean( null, null, p );
+            WikiContext context = m_engine.getWikiActionBeanFactory().newViewWikiContext( null, null, p );
 
             String title = TextUtil.replaceEntities(BlogUtil.getSiteName(context));
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/rss/RSSGenerator.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/rss/RSSGenerator.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/rss/RSSGenerator.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/rss/RSSGenerator.java Sun Nov 23 20:57:18 2008
@@ -25,7 +25,6 @@
 import org.apache.log4j.Logger;
 
 import com.ecyrd.jspwiki.*;
-import com.ecyrd.jspwiki.action.RSSActionBean;
 import com.ecyrd.jspwiki.attachment.Attachment;
 import com.ecyrd.jspwiki.auth.permissions.PagePermission;
 import com.ecyrd.jspwiki.providers.ProviderException;
@@ -228,7 +227,7 @@
         StringBuffer buf = new StringBuffer();
         String author = getAuthor(page);
 
-        WikiContext ctx = m_engine.getWikiActionBeanFactory().newViewActionBean( null, null, page );
+        WikiContext ctx = m_engine.getWikiActionBeanFactory().newViewWikiContext( null, null, page );
         if( page.getVersion() > 1 )
         {
             String diff = m_engine.getDiff( ctx,
@@ -277,7 +276,7 @@
      */
     public String generate() throws WikiException
     {
-        WikiContext context = (WikiContext)m_engine.getWikiActionBeanFactory().newActionBean(null,null,RSSActionBean.class);
+        WikiContext context = m_engine.getWikiActionBeanFactory().newWikiContext(null,null,WikiContext.RSS);
         context.setPage( new WikiPage( m_engine, "__DUMMY" ) );
         Feed feed = new RSS10Feed( context );
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/EditorIteratorTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/EditorIteratorTag.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/EditorIteratorTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/EditorIteratorTag.java Sun Nov 23 20:57:18 2008
@@ -27,6 +27,7 @@
 
 import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
+import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
 import com.ecyrd.jspwiki.ui.Editor;
 import com.ecyrd.jspwiki.ui.EditorManager;
 
@@ -46,7 +47,7 @@
 
     public final int doStartTag()
     {
-        m_wikiContext = WikiContext.findContext(pageContext);
+        m_wikiContext = WikiActionBeanFactory.findContext(pageContext);
 
         WikiEngine engine = m_wikiContext.getEngine();
         EditorManager mgr    = engine.getEditorManager();

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IteratorTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IteratorTag.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IteratorTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IteratorTag.java Sun Nov 23 20:57:18 2008
@@ -33,6 +33,7 @@
 
 import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiPage;
+import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
 
 /**
  *  Iterates through tags.
@@ -110,7 +111,7 @@
      */
     public int doStartTag()
     {
-        m_wikiContext = WikiContext.findContext(pageContext);
+        m_wikiContext = WikiActionBeanFactory.findContext(pageContext);
         
         resetIterator();
         

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/SearchResultIteratorTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/SearchResultIteratorTag.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/SearchResultIteratorTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/SearchResultIteratorTag.java Sun Nov 23 20:57:18 2008
@@ -23,7 +23,6 @@
 import java.io.IOException;
 import java.util.Collection;
 
-import javax.servlet.http.HttpServletRequest;
 import javax.servlet.jsp.JspWriter;
 import javax.servlet.jsp.PageContext;
 
@@ -32,7 +31,6 @@
 import com.ecyrd.jspwiki.SearchResult;
 import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
 
 /**
  *  Iterates through Search result results.
@@ -106,7 +104,7 @@
             
             // Create a wiki context for the result
             WikiEngine engine = m_wikiContext.getEngine();
-            WikiContext context = engine.getWikiActionBeanFactory().newViewActionBean( null, null, r.getPage() );
+            WikiContext context = engine.getWikiActionBeanFactory().newViewWikiContext( null, null, r.getPage() );
             
             // Stash it in the page context
             pageContext.setAttribute( WikiTagBase.ATTR_CONTEXT,

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/TemplateManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/TemplateManager.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/TemplateManager.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/TemplateManager.java Sun Nov 23 20:57:18 2008
@@ -38,7 +38,7 @@
 import com.ecyrd.jspwiki.InternalWikiException;
 import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.action.WikiActionBean;
+import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
 import com.ecyrd.jspwiki.modules.ModuleManager;
 import com.ecyrd.jspwiki.preferences.Preferences;
 import com.ecyrd.jspwiki.preferences.Preferences.TimeFormat;
@@ -490,7 +490,7 @@
      */
     public Map listTimeFormats(PageContext pageContext)
     {
-        WikiContext context = WikiContext.findContext( pageContext ); 
+        WikiContext context = WikiActionBeanFactory.findContext( pageContext ); 
         Properties props = m_engine.getWikiProperties();
         ArrayList<String> tfArr = new ArrayList<String>(40);
         LinkedHashMap<String,String> resultMap = new LinkedHashMap<String,String>();
@@ -663,7 +663,7 @@
      *  @param type the marker
      *  @return the generated marker comment
      */
-    public static String getMarker( WikiActionBean context, String type )
+    public static String getMarker( WikiContext context, String type )
     {
         if( type.equals(RESOURCE_JSLOCALIZEDSTRINGS) )
         {
@@ -685,7 +685,7 @@
      *  @author Dirk Frederickx
      *  @since 2.5.108
      */
-    private static String getJSLocalizedStrings( WikiActionBean context )
+    private static String getJSLocalizedStrings( WikiContext context )
     {
         StringBuffer sb = new StringBuffer();
 
@@ -743,7 +743,7 @@
      *  @param resource The resource to add.
      */
     @SuppressWarnings("unchecked")
-    public static void addResourceRequest( WikiActionBean ctx, String type, String resource )
+    public static void addResourceRequest( WikiContext ctx, String type, String resource )
     {
         HashMap<String,Vector<String>> resourcemap = (HashMap<String,Vector<String>>) ctx.getVariable( RESOURCE_INCLUDES );
 
@@ -803,7 +803,7 @@
      */
 
     @SuppressWarnings("unchecked")
-    public static String[] getResourceRequests( WikiActionBean ctx, String type )
+    public static String[] getResourceRequests( WikiContext ctx, String type )
     {
         HashMap<String,Vector<String>> hm = (HashMap<String,Vector<String>>) ctx.getVariable( RESOURCE_INCLUDES );
 
@@ -825,7 +825,7 @@
      * @return the array of types requested
      */
     @SuppressWarnings("unchecked")
-    public static String[] getResourceTypes( WikiActionBean ctx )
+    public static String[] getResourceTypes( WikiContext ctx )
     {
         String[] res = new String[0];
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/WikiJSPFilter.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/WikiJSPFilter.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/WikiJSPFilter.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/WikiJSPFilter.java Sun Nov 23 20:57:18 2008
@@ -104,11 +104,12 @@
             }
         
             // fire PAGE_REQUESTED event
-            WikiActionBean wikiContext = WikiActionBeanFactory.findActionBean( request );
-            boolean isWikiContext = ( wikiContext instanceof WikiContext );
-            if ( isWikiContext )
+            WikiActionBean wikiActionBean = WikiActionBeanFactory.findActionBean( request );
+            WikiContext wikiContext = wikiActionBean.getContext();
+            boolean isViewContext = WikiContext.VIEW .equals( wikiContext.getRequestContext() );
+            if ( isViewContext )
             {
-                String pageName = ((WikiContext)wikiContext).getPage().getName();
+                String pageName = wikiContext.getPage().getName();
                 fireEvent( WikiPageEvent.PAGE_REQUESTED, pageName );
             }
 
@@ -134,15 +135,12 @@
                 response.getWriter().write(r);
             
                 // Clean up the UI messages and loggers
-                if( wikiContext != null )
+                // fire PAGE_DELIVERED event
+                wikiContext.getWikiSession().clearMessages();
+                if ( isViewContext )
                 {
-                    // fire PAGE_DELIVERED event
-                    wikiContext.getWikiSession().clearMessages();
-                    if ( isWikiContext )
-                    {
-                        String pageName = ((WikiContext)wikiContext).getPage().getName();
-                        fireEvent( WikiPageEvent.PAGE_DELIVERED, pageName );
-                    }
+                    String pageName = wikiContext.getPage().getName();
+                    fireEvent( WikiPageEvent.PAGE_DELIVERED, pageName );
                 }
             }
             finally
@@ -165,7 +163,7 @@
      * @param string The source string
      * @return The modified string with all the insertions in place.
      */
-    private String filter(WikiActionBean wikiContext, HttpServletResponse response )
+    private String filter(WikiContext wikiContext, HttpServletResponse response )
     {
         String string = response.toString();
 
@@ -212,7 +210,7 @@
      *  @param type Type identifier for insertion
      *  @return The filtered string.
      */
-    private String insertResources(WikiActionBean wikiContext, String string, String type )
+    private String insertResources(WikiContext wikiContext, String string, String type )
     {
         if( wikiContext == null )
         {

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/BlogUtil.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/BlogUtil.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/BlogUtil.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/BlogUtil.java Sun Nov 23 20:57:18 2008
@@ -21,7 +21,6 @@
 package com.ecyrd.jspwiki.util;
 
 import com.ecyrd.jspwiki.*;
-import com.ecyrd.jspwiki.action.WikiActionBean;
 
 
 /**
@@ -46,7 +45,7 @@
      * @param context the wiki context
      * @return the site name
      */
-    public static String getSiteName( WikiActionBean context )
+    public static String getSiteName( WikiContext context )
     {
         WikiEngine engine = context.getEngine();
 
@@ -60,14 +59,7 @@
 
         if( blogname == null )
         {
-            if ( context instanceof WikiContext )
-            {
-                blogname = engine.getApplicationName()+": "+((WikiContext)context).getPage().getName();
-            }
-            else
-            {
-                blogname = engine.getApplicationName();
-            }
+            blogname = engine.getApplicationName()+": "+ context.getPage().getName();
         }
 
         return blogname;

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/MetaWeblogHandler.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/MetaWeblogHandler.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/MetaWeblogHandler.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/MetaWeblogHandler.java Sun Nov 23 20:57:18 2008
@@ -268,7 +268,7 @@
             WikiPage entryPage = new WikiPage( engine, pageName );
             entryPage.setAuthor( username );
 
-            WikiContext context = engine.getWikiActionBeanFactory().newViewActionBean( null, null, entryPage );
+            WikiContext context = engine.getWikiActionBeanFactory().newViewWikiContext( null, null, entryPage );
 
             StringBuffer text = new StringBuffer();
             text.append( "!"+content.get("title") );
@@ -365,7 +365,7 @@
             WikiPage entryPage = (WikiPage)page.clone();
             entryPage.setAuthor( username );
 
-            WikiContext context = engine.getWikiActionBeanFactory().newViewActionBean( null, null, entryPage );
+            WikiContext context = engine.getWikiActionBeanFactory().newViewWikiContext( null, null, entryPage );
 
             StringBuffer text = new StringBuffer();
             text.append( "!"+content.get("title") );

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandler.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandler.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandler.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandler.java Sun Nov 23 20:57:18 2008
@@ -264,7 +264,7 @@
         LinkCollector extCollector   = new LinkCollector();
         LinkCollector attCollector   = new LinkCollector();
 
-        WikiContext context = m_engine.getWikiActionBeanFactory().newViewActionBean( null, null, page );
+        WikiContext context = m_engine.getWikiActionBeanFactory().newViewWikiContext( null, null, page );
         context.setVariable( WikiEngine.PROP_REFSTYLE, "absolute" );
 
         m_engine.textToHTML( context,

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandlerUTF8.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandlerUTF8.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandlerUTF8.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandlerUTF8.java Sun Nov 23 20:57:18 2008
@@ -219,7 +219,7 @@
         LinkCollector extCollector   = new LinkCollector();
         LinkCollector attCollector   = new LinkCollector();
 
-        WikiContext context = m_engine.getWikiActionBeanFactory().newViewActionBean( null, null, page );
+        WikiContext context = m_engine.getWikiActionBeanFactory().newViewWikiContext( null, null, page );
         context.setVariable( WikiEngine.PROP_REFSTYLE, "absolute" );
 
         m_engine.textToHTML( context,

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/TestEngine.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/TestEngine.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/TestEngine.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/TestEngine.java Sun Nov 23 20:57:18 2008
@@ -324,7 +324,7 @@
 
         // Create page and wiki context
         WikiPage page = new WikiPage( this, pageName );
-        WikiContext context = this.getWikiActionBeanFactory().newViewActionBean( request, null, page );
+        WikiContext context = this.getWikiActionBeanFactory().newViewWikiContext( request, null, page );
         saveText( context, content );
     }
 
@@ -340,7 +340,7 @@
 
         // Create page and wiki context
         WikiPage page = new WikiPage( this, pageName );
-        WikiContext context = this.getWikiActionBeanFactory().newViewActionBean( request, null, page );
+        WikiContext context = this.getWikiActionBeanFactory().newViewWikiContext( request, null, page );
         saveText( context, content );
     }
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/VariableManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/VariableManagerTest.java?rev=720116&r1=720115&r2=720116&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/VariableManagerTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/VariableManagerTest.java Sun Nov 23 20:57:18 2008
@@ -29,7 +29,7 @@
 
             m_variableManager = new VariableManager( props );
             TestEngine testEngine = new TestEngine( props );
-            m_context = testEngine.getWikiActionBeanFactory().newViewActionBean( null, null, new WikiPage( testEngine, PAGE_NAME ) );
+            m_context = testEngine.getWikiActionBeanFactory().newViewWikiContext( null, null, new WikiPage( testEngine, PAGE_NAME ) );
 
         }
         catch( IOException e ) {}