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/12/03 05:27:59 UTC

svn commit: r722757 - in /incubator/jspwiki/trunk/src/com/ecyrd/jspwiki: auth/acl/ dav/items/ diff/ filters/ parser/ preferences/ providers/ rpc/atom/ rss/ tags/

Author: ajaquith
Date: Tue Dec  2 20:27:59 2008
New Revision: 722757

URL: http://svn.apache.org/viewvc?rev=722757&view=rev
Log:
Checked in the Stripes code (about 220 classes, tests, JSPs and other files. All code compiles clean, but the JSPs do NOT work at the moment. Unit tests run clean except for some stray failing Stripes-related unit tests. See the file doc/README - Stripes Migration for some (repeat, SOME) details of what it all means. I'll sort out the JSP issues later this week.

Modified:
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/auth/acl/DefaultAclManager.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/dav/items/HTMLPageDavItem.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/diff/TraditionalDiffProvider.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/filters/RedirectException.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/filters/SpamFilter.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/JSPWikiMarkupParser.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/preferences/Preferences.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/CachingProvider.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/rpc/atom/AtomAPIServlet.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/rss/RSSGenerator.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/ContentTag.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/EditorIteratorTag.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/IteratorTag.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/MessagesTag.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/PageNameTag.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/PermissionTag.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/SearchResultIteratorTag.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/TabTag.java   (contents, props changed)
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/WikiTagBase.java   (contents, props changed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/auth/acl/DefaultAclManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/auth/acl/DefaultAclManager.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/auth/acl/DefaultAclManager.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/auth/acl/DefaultAclManager.java Tue Dec  2 20:27:59 2008
@@ -181,7 +181,7 @@
                 //
                 //  Or, try parsing the page
                 //
-                WikiContext ctx = new WikiContext( m_engine, page );
+                WikiContext ctx = m_engine.getWikiContextFactory().newViewContext( null, null, page );
 
                 ctx.setVariable( RenderingManager.VAR_EXECUTE_PLUGINS, Boolean.FALSE );
 

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/auth/acl/DefaultAclManager.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/dav/items/HTMLPageDavItem.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/dav/items/HTMLPageDavItem.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/dav/items/HTMLPageDavItem.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/dav/items/HTMLPageDavItem.java Tue Dec  2 20:27:59 2008
@@ -76,8 +76,7 @@
     {
         WikiEngine engine = ((WikiDavProvider)m_provider).getEngine();
 
-        WikiContext context = new WikiContext( engine, m_page );
-        context.setRequestContext( WikiContext.VIEW );
+        WikiContext context = engine.getWikiContextFactory().newViewContext( null, null, m_page );
 
         context.setVariable( MarkupParser.PROP_RUNPLUGINS, "false" );
         context.setVariable( WikiEngine.PROP_RUNFILTERS, "false" );

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/diff/TraditionalDiffProvider.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/diff/TraditionalDiffProvider.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/diff/TraditionalDiffProvider.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/diff/TraditionalDiffProvider.java Tue Dec  2 20:27:59 2008
@@ -38,6 +38,7 @@
 import com.ecyrd.jspwiki.TextUtil;
 import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
+import com.ecyrd.jspwiki.action.WikiContextFactory;
 import com.ecyrd.jspwiki.i18n.InternationalizationManager;
 
 
@@ -182,7 +183,7 @@
             double[] choiceLimits = { 1, 2 };
             
             MessageFormat fmt = new MessageFormat("");
-            fmt.setLocale( WikiContext.getLocale(m_context) );
+            fmt.setLocale( WikiContextFactory.getLocale(m_context) );
             ChoiceFormat cfmt = new ChoiceFormat( choiceLimits, choiceString );
             fmt.applyPattern( type );
             Format[] formats = { NumberFormat.getInstance(), cfmt, NumberFormat.getInstance() };

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/diff/TraditionalDiffProvider.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/filters/RedirectException.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/filters/RedirectException.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/filters/RedirectException.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/filters/RedirectException.java Tue Dec  2 20:27:59 2008
@@ -20,19 +20,29 @@
  */
 package com.ecyrd.jspwiki.filters;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import net.sourceforge.stripes.action.RedirectResolution;
+import net.sourceforge.stripes.action.Resolution;
+
 /**
  *  This exception may be thrown if a filter wants to reject something and
- *  redirect the user elsewhere.
+ *  redirect the user elsewhere. In addition to being a subclass of FilterException,
+ *  this class also implements the Stripes {@link net.sourceforge.stripes.action.Resolution}
+ *  interface, which means it can be caught and used by Stripes for redirection.
  *
  *  @since 2.1.112
  */
 public class RedirectException
-    extends FilterException
+    extends FilterException implements Resolution
 {
-    private static final long serialVersionUID = 0L;
+    private static final long serialVersionUID = 1L;
 
     private final String m_where;
 
+    private Resolution m_resolution = null;
+
     /**
      *  Constructs a new RedirectException.
      *  
@@ -44,6 +54,8 @@
         super( msg );
 
         m_where = redirect;
+
+        m_resolution = new RedirectResolution( redirect );
     }
 
     /**
@@ -55,4 +67,36 @@
     {
         return m_where;
     }
+
+    /**
+     * Sets the Resolution executed by {@link #execute(HttpServletRequest, HttpServletResponse)}. Calling
+     * this method overrides the default RedirectResolution created during construction.
+     * @param resolution the Resolution to set
+     */
+    public void setResolution( Resolution resolution )
+    {
+        m_resolution = resolution;
+    }
+    
+    /**
+     * Returns the Resolution that will be executed by {@link #execute(HttpServletRequest, HttpServletResponse)}.
+     * If not set explicitly by {@link #setResolution(Resolution)}, this method returns a
+     * {@link net.sourceforge.stripes.action.RedirectResolution} that redirects to the URL supplied during
+     * construction.
+     * @return the Resolution
+     */
+    public Resolution getResolution()
+    {
+        return m_resolution;
+    }
+    
+    /**
+     * Executes the Stripes redirect activity by calling
+     * {@link net.sourceforge.stripes.action.Resolution#execute(HttpServletRequest, HttpServletResponse)}
+     * for the Resolution returned by {@link #getResolution()}.
+     */
+    public void execute( HttpServletRequest request, HttpServletResponse response ) throws Exception
+    {
+        m_resolution.execute( request, response );
+    }
 }

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/filters/RedirectException.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/filters/SpamFilter.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/filters/SpamFilter.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/filters/SpamFilter.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/filters/SpamFilter.java Tue Dec  2 20:27:59 2008
@@ -38,6 +38,7 @@
 import org.apache.oro.text.regex.*;
 
 import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.WikiContextFactory;
 import com.ecyrd.jspwiki.attachment.Attachment;
 import com.ecyrd.jspwiki.auth.user.UserProfile;
 import com.ecyrd.jspwiki.providers.ProviderException;
@@ -1127,7 +1128,7 @@
      */
     public static final String insertInputFields( PageContext pageContext )
     {
-        WikiContext ctx = WikiContext.findContext(pageContext);
+        WikiContext ctx = WikiContextFactory.findContext(pageContext);
         WikiEngine engine = ctx.getEngine();
 
         StringBuffer sb = new StringBuffer();

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/filters/SpamFilter.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/JSPWikiMarkupParser.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/JSPWikiMarkupParser.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/JSPWikiMarkupParser.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/JSPWikiMarkupParser.java Tue Dec  2 20:27:59 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;
@@ -546,12 +547,12 @@
                 //  to make sure the links are unique across Wiki.
                 //
             case LOCALREF:
-                el = createAnchor( LOCALREF, "#ref-"+m_context.getName()+"-"+link, "["+text+"]", "" );
+                el = createAnchor( LOCALREF, "#ref-"+m_context.getPage().getName()+"-"+link, "["+text+"]", "" );
                 break;
 
             case LOCAL:
                 el = new Element("a").setAttribute("class","footnote");
-                el.setAttribute("name", "ref-"+m_context.getName()+"-"+link.substring(1));
+                el.setAttribute("name", "ref-"+m_context.getPage().getName()+"-"+link.substring(1));
                 el.addContent("["+text+"]");
                 break;
 
@@ -1111,9 +1112,10 @@
     {
         if( m_cleanTranslator == null )
         {
-            WikiContext dummyContext = new WikiContext( m_engine,
-                                                        m_context.getHttpRequest(),
-                                                        m_context.getPage() );
+            WikiContext dummyContext = m_engine.getWikiContextFactory().newViewContext(
+                                                           m_context.getHttpRequest(),
+                                                           (HttpServletResponse)null,
+                                                           m_context.getPage() );            
             m_cleanTranslator = new JSPWikiMarkupParser( dummyContext, null );
 
             m_cleanTranslator.m_allowHTML = true;
@@ -2376,7 +2378,7 @@
                 }
                 catch( EmptyStackException e )
                 {
-                    log.debug("Page '"+m_context.getName()+"' closes a %%-block that has not been opened.");
+                    log.debug("Page '"+m_context.getPage().getName()+"' closes a %%-block that has not been opened.");
                     return m_currentElement;
                 }
 

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/JSPWikiMarkupParser.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/preferences/Preferences.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/preferences/Preferences.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/preferences/Preferences.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/preferences/Preferences.java Tue Dec  2 20:27:59 2008
@@ -38,6 +38,7 @@
 import com.ecyrd.jspwiki.PropertyReader;
 import com.ecyrd.jspwiki.TextUtil;
 import com.ecyrd.jspwiki.WikiContext;
+import com.ecyrd.jspwiki.action.WikiContextFactory;
 import com.ecyrd.jspwiki.i18n.InternationalizationManager;
 import com.ecyrd.jspwiki.util.HttpUtil;
 
@@ -96,7 +97,7 @@
     {
         Preferences prefs = new Preferences();
         Properties props = PropertyReader.loadWebAppProps( pageContext.getServletContext() );
-        WikiContext ctx = WikiContext.findContext( pageContext );
+        WikiContext ctx = WikiContextFactory.findContext( pageContext );
         
         prefs.put("SkinName", TextUtil.getStringProperty( props, "jspwiki.defaultprefs.template.skinname", "PlainVanilla" ) );
         prefs.put("DateFormat", 
@@ -199,7 +200,7 @@
 
     
     /**
-     * Get Locale according to user-preference settings or the user browser locale
+     * Get Locale according to user-preference settings or the Stripes ActionBeanContext.
      * 
      * @param context The context to examine.
      * @return a Locale object.

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/preferences/Preferences.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/CachingProvider.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/CachingProvider.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/CachingProvider.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/CachingProvider.java Tue Dec  2 20:27:59 2008
@@ -686,7 +686,7 @@
             {
                 String data = m_provider.getPageText(page.getName(), page.getVersion());
 
-                WikiContext ctx = new WikiContext( m_engine, page );
+                WikiContext ctx = m_engine.getWikiContextFactory().newViewContext( null, null, page );
                 MarkupParser parser = mgr.getParser( ctx, data );
 
                 parser.parse();

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/CachingProvider.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/rpc/atom/AtomAPIServlet.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/rpc/atom/AtomAPIServlet.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/rpc/atom/AtomAPIServlet.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/rpc/atom/AtomAPIServlet.java Tue Dec  2 20:27:59 2008
@@ -143,7 +143,7 @@
             WikiPage entryPage = new WikiPage( m_engine, pageName );
             entryPage.setAuthor( username );
 
-            WikiContext context = new WikiContext( m_engine, request, entryPage );
+            WikiContext context = m_engine.getWikiContextFactory().newViewContext( request, response, entryPage );
 
             StringBuffer text = new StringBuffer();
             text.append( "!"+title.getBody() );
@@ -281,7 +281,7 @@
 
             String encodedName = TextUtil.urlEncodeUTF8( p.getName() );
 
-            WikiContext context = new WikiContext( m_engine, p );
+            WikiContext context = m_engine.getWikiContextFactory().newViewContext( null, null, p );
 
             String title = TextUtil.replaceEntities(BlogUtil.getSiteName(context));
 

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/rpc/atom/AtomAPIServlet.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/rss/RSSGenerator.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/rss/RSSGenerator.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/rss/RSSGenerator.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/rss/RSSGenerator.java Tue Dec  2 20:27:59 2008
@@ -228,7 +228,7 @@
         StringBuffer buf = new StringBuffer();
         String author = getAuthor(page);
 
-        WikiContext ctx = new WikiContext( m_engine, page );
+        WikiContext ctx = m_engine.getWikiContextFactory().newViewContext( null, null, page );
         if( page.getVersion() > 1 )
         {
             String diff = m_engine.getDiff( ctx,
@@ -275,10 +275,10 @@
      *  
      *  @return A RSS 1.0 feed in the "full" mode.
      */
-    public String generate()
+    public String generate() throws WikiException
     {
-        WikiContext context = new WikiContext( m_engine,new WikiPage( m_engine, "__DUMMY" ) );
-        context.setRequestContext( WikiContext.RSS );
+        WikiContext context = m_engine.getWikiContextFactory().newContext(null,null,WikiContext.RSS);
+        context.setPage( new WikiPage( m_engine, "__DUMMY" ) );
         Feed feed = new RSS10Feed( context );
 
         String result = generateFullWikiRSS( context, feed );

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/rss/RSSGenerator.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/ContentTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/ContentTag.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/ContentTag.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/ContentTag.java Tue Dec  2 20:27:59 2008
@@ -164,10 +164,20 @@
             String requestContext = m_wikiContext.getRequestContext();
             String contentTemplate = m_mappings.get( requestContext );
 
-            // If not found, use the defaults
+            // Next, see if the variable "contentTemplate" is part of the request
+            WikiEngine engine = m_wikiContext.getEngine();
+            contentTemplate = engine.getVariable( m_wikiContext, "contentTemplate" );
+            
+            // If not found, use the default name (trim "ActionBean" from name, and append "Content"
+            // e.g., EditActionBean yields "EditContent.jsp"
             if ( contentTemplate == null )
             {
-                contentTemplate = m_wikiContext.getContentTemplate();
+                String beanName = m_wikiActionBean.getClass().getSimpleName();
+                if ( beanName.endsWith( "ActionBean" ) )
+                {
+                    beanName = beanName.substring( 0, beanName.lastIndexOf( "ActionBean") );
+                }
+                contentTemplate = beanName + "Content.jsp";
             }
             
             // If still no, something fishy is going on

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/ContentTag.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/EditorIteratorTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/EditorIteratorTag.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/EditorIteratorTag.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/EditorIteratorTag.java Tue Dec  2 20:27:59 2008
@@ -28,6 +28,7 @@
 
 import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
+import com.ecyrd.jspwiki.action.WikiContextFactory;
 import com.ecyrd.jspwiki.ui.Editor;
 import com.ecyrd.jspwiki.ui.EditorManager;
 
@@ -47,7 +48,7 @@
 
     public final int doStartTag()
     {
-        m_wikiContext = WikiContext.findContext(pageContext);
+        m_wikiContext = WikiContextFactory.findContext(pageContext);
 
         WikiEngine engine = m_wikiContext.getEngine();
         EditorManager mgr    = engine.getEditorManager();

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/EditorIteratorTag.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/IteratorTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/IteratorTag.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/IteratorTag.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/IteratorTag.java Tue Dec  2 20:27:59 2008
@@ -34,6 +34,7 @@
 
 import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiPage;
+import com.ecyrd.jspwiki.action.WikiContextFactory;
 
 /**
  *  Iterates through tags.
@@ -111,7 +112,7 @@
      */
     public int doStartTag()
     {
-        m_wikiContext = WikiContext.findContext(pageContext);
+        m_wikiContext = WikiContextFactory.findContext(pageContext);
         
         resetIterator();
         

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/IteratorTag.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/MessagesTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/MessagesTag.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/MessagesTag.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/MessagesTag.java Tue Dec  2 20:27:59 2008
@@ -21,6 +21,11 @@
 package com.ecyrd.jspwiki.tags;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sourceforge.stripes.validation.ValidationError;
+import net.sourceforge.stripes.validation.ValidationErrors;
 
 import com.ecyrd.jspwiki.TextUtil;
 import com.ecyrd.jspwiki.WikiSession;
@@ -99,7 +104,26 @@
         }
         else
         {
+            List<String> messageStrings = new ArrayList<String>();
+
+            // Add all of the Stripes validation errors first (all fields, even global errors)
+            ValidationErrors errors = m_wikiActionBean.getContext().getValidationErrors();
+            for ( List<ValidationError> fieldErrors : errors.values() ) {
+                for ( ValidationError error : fieldErrors )
+                {
+                    String message = error.getMessage( m_wikiActionBean.getContext().getLocale() );
+                    messageStrings.add( message );
+                }
+            }
+
+            // Add all of the messages added for this topic (legacy messages)
             String[] messages = ( m_topic == null ) ? session.getMessages() : session.getMessages( m_topic );
+            for ( String message : messages )
+            {
+                messageStrings.add( message );
+            }
+            messages = messageStrings.toArray( new String[messageStrings.size()] );
+            
             if ( messages.length > 0 )
             {
                 StringBuffer sb = new StringBuffer();

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/MessagesTag.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/PageNameTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/PageNameTag.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/PageNameTag.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/PageNameTag.java Tue Dec  2 20:27:59 2008
@@ -50,7 +50,7 @@
             }
             else
             {
-                pageContext.getOut().print( engine.beautifyTitle( m_wikiContext.getName() ) );
+                pageContext.getOut().print( engine.beautifyTitle( page.getName() ) );
             }
         }
 

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/PageNameTag.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/PermissionTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/PermissionTag.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/PermissionTag.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/PermissionTag.java Tue Dec  2 20:27:59 2008
@@ -28,14 +28,14 @@
 import com.ecyrd.jspwiki.WikiPage;
 import com.ecyrd.jspwiki.WikiProvider;
 import com.ecyrd.jspwiki.WikiSession;
+import com.ecyrd.jspwiki.action.GroupActionBean;
 import com.ecyrd.jspwiki.auth.AuthorizationManager;
 import com.ecyrd.jspwiki.auth.GroupPrincipal;
+import com.ecyrd.jspwiki.auth.authorize.Group;
 import com.ecyrd.jspwiki.auth.permissions.AllPermission;
 import com.ecyrd.jspwiki.auth.permissions.GroupPermission;
 import com.ecyrd.jspwiki.auth.permissions.PermissionFactory;
 import com.ecyrd.jspwiki.auth.permissions.WikiPermission;
-import com.ecyrd.jspwiki.ui.Command;
-import com.ecyrd.jspwiki.ui.GroupCommand;
 
 /**
  *  Tells whether the user in the current wiki context possesses a particular
@@ -121,27 +121,23 @@
         {
             gotPermission = mgr.checkPermission( session, new WikiPermission( page.getWiki(), permission ) );
         }
-        else if ( VIEW_GROUP.equals( permission ) 
-            || EDIT_GROUP.equals( permission )
-            || DELETE_GROUP.equals( permission ) )
-        {
-            Command command = m_wikiContext.getCommand();
-            gotPermission = false;
-            if ( command instanceof GroupCommand && command.getTarget() != null )
-            {
-                GroupPrincipal group = (GroupPrincipal)command.getTarget();
-                String groupName = group.getName();
-                String action = "view";
-                if( EDIT_GROUP.equals( permission ) )
-                {
-                    action = "edit";
-                }
-                else if ( DELETE_GROUP.equals( permission ) )
-                {
-                    action = "delete";
-                }
-                gotPermission = mgr.checkPermission( session, new GroupPermission( groupName, action ) );
-            }
+        else if ( VIEW_GROUP.equals( permission ) )
+        {
+            Group group = ((GroupActionBean)m_wikiActionBean).getGroup();
+            Permission perm = new GroupPermission( group.getName(), GroupPermission.VIEW_ACTION );
+            gotPermission = mgr.checkPermission( session, perm );
+        }
+        else if ( EDIT_GROUP.equals( permission ) )
+        {
+            Group group = ((GroupActionBean)m_wikiActionBean).getGroup();
+            Permission perm = new GroupPermission( group.getName(), GroupPermission.EDIT_ACTION);
+            gotPermission = mgr.checkPermission( session, perm );
+        }
+        else if ( DELETE_GROUP.equals( permission ) )
+        {
+            Group group = ((GroupActionBean)m_wikiActionBean).getGroup();
+            Permission perm = new GroupPermission( group.getName(), GroupPermission.DELETE_ACTION );
+            gotPermission = mgr.checkPermission( session, perm );
         }
         else if ( ALL_PERMISSION.equals( permission ) )
         {

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/PermissionTag.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/SearchResultIteratorTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/SearchResultIteratorTag.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/SearchResultIteratorTag.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/SearchResultIteratorTag.java Tue Dec  2 20:27:59 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;
 
@@ -33,8 +32,6 @@
 import com.ecyrd.jspwiki.SearchResult;
 import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.ui.Command;
-import com.ecyrd.jspwiki.ui.PageCommand;
 
 /**
  *  Iterates through Search result results.
@@ -108,9 +105,7 @@
             
             // Create a wiki context for the result
             WikiEngine engine = m_wikiContext.getEngine();
-            HttpServletRequest request = m_wikiContext.getHttpRequest();
-            Command command = PageCommand.VIEW.targetedCommand( r.getPage() );
-            WikiContext context = new WikiContext( engine, request, command );
+            WikiContext context = engine.getWikiContextFactory().newViewContext( null, null, r.getPage() );
             
             // Stash it in the page context
             pageContext.setAttribute( WikiTagBase.ATTR_CONTEXT,

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/SearchResultIteratorTag.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/TabTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/TabTag.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/TabTag.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/TabTag.java Tue Dec  2 20:27:59 2008
@@ -111,7 +111,7 @@
      */
     public int doWikiStartTag() throws JspTagException
     {
-        TabbedSectionTag parent=(TabbedSectionTag)findAncestorWithClass( this, TabbedSectionTag.class );
+        TabbedSectionTag parent=getParentTag(TabbedSectionTag.class );
 
         //
         //  Sanity checks
@@ -158,7 +158,7 @@
      */
     public int doEndTag() throws javax.servlet.jsp.JspTagException
     {
-        TabbedSectionTag parent=(TabbedSectionTag)findAncestorWithClass( this, TabbedSectionTag.class );
+        TabbedSectionTag parent=getParentTag( TabbedSectionTag.class );
 
         StringBuffer sb = new StringBuffer();
 

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/TabTag.java
            ('svn:eol-style' removed)

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/WikiTagBase.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/WikiTagBase.java?rev=722757&r1=722756&r2=722757&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/WikiTagBase.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/WikiTagBase.java Tue Dec  2 20:27:59 2008
@@ -22,14 +22,16 @@
 
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.PageContext;
-import javax.servlet.jsp.tagext.TagSupport;
 import javax.servlet.jsp.tagext.TryCatchFinally;
 
+import net.sourceforge.stripes.tag.StripesTagSupport;
+
 import com.ecyrd.jspwiki.log.Logger;
 import com.ecyrd.jspwiki.log.LoggerFactory;
 
-import com.ecyrd.jspwiki.TextUtil;
-import com.ecyrd.jspwiki.WikiContext;
+import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.WikiActionBean;
+import com.ecyrd.jspwiki.action.WikiInterceptor;
 
 /**
  *  Base class for JSPWiki tags.  You do not necessarily have
@@ -41,15 +43,19 @@
  *  @since 2.0
  */
 public abstract class WikiTagBase
-    extends TagSupport
+    extends StripesTagSupport
     implements TryCatchFinally
 {
-    public static final String ATTR_CONTEXT = "jspwiki.context";
+    public static final String ATTR_CONTEXT = "wikiContext";
 
     static    Logger    log = LoggerFactory.getLogger( WikiTagBase.class );
 
     protected WikiContext m_wikiContext;
 
+    protected WikiActionBean m_wikiActionBean;
+
+    private String m_id;
+
     /**
      *   This method calls the parent setPageContext() but it also
      *   provides a way for a tag to initialize itself before
@@ -71,16 +77,38 @@
     public void initTag()
     {
         m_wikiContext = null;
+        m_id = null;
         return;
     }
     
+    /**
+     * Initializes the tag, and sets an internal reference to the current WikiActionBean
+     * by delegating to
+     * {@link com.ecyrd.jspwiki.action.WikiInterceptor#findActionBean(javax.servlet.ServletRequest)}.
+     * (That method retrieves the WikiActionBean from page scope.).
+     * If the WikiActionBean is a WikiContext, a specific reference to the WikiContext
+     * will be set also. Both of these available as protected fields {@link #m_wikiActionBean} and
+     * {@link #m_wikiContext}, respectively. It is considered an error condition if the 
+     * WikiActionBean cannot be retrieved from the PageContext.
+     * It's also an error condition if the WikiActionBean is actually a WikiContext, and it
+     * returns a <code>null</code> WikiPage.
+     */
     public int doStartTag()
         throws JspException
     {
         try
         {
-            m_wikiContext = (WikiContext) pageContext.getAttribute( ATTR_CONTEXT,
-                                                                    PageContext.REQUEST_SCOPE );
+            // Retrieve the ActionBean injected by WikiInterceptor
+            m_wikiActionBean = WikiInterceptor.findActionBean( this.getPageContext().getRequest() );
+            
+            // It's really bad news if the WikiActionBean wasn't injected (or saved as a variable!)
+            if ( m_wikiActionBean == null )
+            {
+                throw new JspException( "Can't find WikiActionBean in page or request context! (tag=" + this.getClass() + ")" );
+            }
+
+            // The WikiContext is the ActionBean's ActionBeanContext
+            m_wikiContext = m_wikiActionBean.getContext();
 
             if( m_wikiContext == null )
             {
@@ -107,6 +135,15 @@
     {
         return EVAL_PAGE;
     }
+    
+    public int doAfterBody() throws JspException {
+        return SKIP_BODY;
+    }
+    
+    public String getId()
+    {
+        return m_id;
+    }
 
     public void doCatch(Throwable arg0) throws Throwable
     {
@@ -115,11 +152,12 @@
     public void doFinally()
     {
         m_wikiContext = null;
+        m_id = null;
     }
 
     public void setId(String id)
     {
-        super.setId( TextUtil.replaceEntities( id ) );
-    }
+		m_id = ( TextUtil.replaceEntities( id ) );
+	}
 
 }

Propchange: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/WikiTagBase.java
            ('svn:eol-style' removed)