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/25 06:06:28 UTC
svn commit: r720416 [1/2] - in
/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH:
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/diff/ src/com/ecyrd/jspwi...
Author: ajaquith
Date: Mon Nov 24 21:06:19 2008
New Revision: 720416
URL: http://svn.apache.org/viewvc?rev=720416&view=rev
Log:
WikiActionBeanFactory renamed to WikiContextFactory, and slightly refactored.
Added:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiContextFactory.java
- copied, changed from r720116, incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBeanFactory.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/action/WikiContextFactoryTest.java
- copied, changed from r720116, incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/action/WikiActionBeanFactoryTest.java
Removed:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBeanFactory.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/action/WikiActionBeanFactoryTest.java
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/VariableManager.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiContext.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiEngine.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/DefaultWikiContext.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/LoginActionBean.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/UserProfileActionBean.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/ViewActionBean.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBeanContext.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiInterceptor.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiPageTypeConverter.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/package.html
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/acl/DefaultAclManager.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/dav/items/HTMLPageDavItem.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/diff/TraditionalDiffProvider.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/filters/SpamFilter.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/parser/JSPWikiMarkupParser.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/preferences/Preferences.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/providers/CachingProvider.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/rpc/atom/AtomAPIServlet.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/rss/RSSGenerator.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/EditorIteratorTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IteratorTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageNameTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/SearchResultIteratorTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/WikiTagBase.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/TemplateManager.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/WikiJSPFilter.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/url/StripesURLConstructor.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/MetaWeblogHandler.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandler.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandlerUTF8.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/org/apache/jspwiki/api/AbstractContext.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/TestEngine.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/VariableManagerTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/WikiEngineTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/action/AllTests.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/action/LoginActionBeanTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/action/RenameActionBeanTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/action/UserProfileActionBeanTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/attachment/AttachmentManagerTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/content/PageRenamerTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/diff/ContextualDiffProviderTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/parser/JSPWikiMarkupParserTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/CounterPluginTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/PluginManagerTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/ReferringPagesPluginTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/UndefinedPagesPluginTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/providers/RCSFileProviderTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/providers/VersioningFileProviderTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/render/CreoleRendererTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/render/RenderingManagerTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/render/WysiwygEditingRendererTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/rss/RSSGeneratorTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/InputValidatorTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/StripesJspTransformer.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/util/MailUtilTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/xmlrpc/RPCHandlerTest.java
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/VariableManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/VariableManager.java?rev=720416&r1=720415&r2=720416&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/VariableManager.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/VariableManager.java Mon Nov 24 21:06:19 2008
@@ -29,7 +29,6 @@
import org.apache.log4j.Logger;
-import com.ecyrd.jspwiki.action.WikiActionBean;
import com.ecyrd.jspwiki.filters.PageFilter;
import com.ecyrd.jspwiki.i18n.InternationalizationManager;
import com.ecyrd.jspwiki.modules.InternalModule;
@@ -172,7 +171,7 @@
}
/**
- * Returns the value of a named variable. See {@link #getValue(WikiActionBean, String)}.
+ * Returns the value of a named variable. See {@link #getValue(WikiContext, String)}.
* The only difference is that this method does not throw an exception, but it
* returns the given default value instead.
*
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiContext.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiContext.java?rev=720416&r1=720415&r2=720416&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiContext.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiContext.java Mon Nov 24 21:06:19 2008
@@ -265,21 +265,6 @@
public void setTemplate( String dir );
/**
- * Returns the target of this wiki context: a page, group name or JSP. If
- * the associated Command is a PageCommand, this method returns the page's
- * name. Otherwise, this method delegates to the associated Command's
- * {@link com.ecyrd.jspwiki.ui.Command#getName()} method. Calling classes
- * can rely on the results of this method for looking up canonically-correct
- * page or group names. Because it does not automatically assume that the
- * wiki context is a PageCommand, calling this method is inherently safer
- * than calling <code>getPage().getName()</code>.
- * @return the name of the target of this wiki context
- * @see com.ecyrd.jspwiki.ui.PageCommand#getName()
- * @see com.ecyrd.jspwiki.ui.GroupCommand#getName()
- */
- public String getName();
-
- /**
* Gets the template that is to be used throughout this request.
* @since 2.1.15.
* @return template name
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiEngine.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiEngine.java?rev=720416&r1=720415&r2=720416&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiEngine.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/WikiEngine.java Mon Nov 24 21:06:19 2008
@@ -38,9 +38,8 @@
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
-import com.ecyrd.jspwiki.action.HandlerInfo;
import com.ecyrd.jspwiki.action.WikiActionBeanContext;
-import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
+import com.ecyrd.jspwiki.action.WikiContextFactory;
import com.ecyrd.jspwiki.attachment.Attachment;
import com.ecyrd.jspwiki.attachment.AttachmentManager;
import com.ecyrd.jspwiki.auth.AuthenticationManager;
@@ -197,8 +196,8 @@
/** Stores the ACL manager. */
private AclManager m_aclManager = null;
- /** Creates wiki action beans based on context names. */
- private WikiActionBeanFactory m_beanFactory = null;
+ /** Creates WikiContexts. */
+ private WikiContextFactory m_contextFactory = null;
private TemplateManager m_templateManager = null;
@@ -517,7 +516,7 @@
try
{
// Initialize the WikiActionBeanResolver -- this MUST be done after setting the baseURL
- m_beanFactory = new WikiActionBeanFactory( this, props );
+ m_contextFactory = new WikiContextFactory( this, props );
Class urlclass = ClassUtil.findClass( "com.ecyrd.jspwiki.url",
TextUtil.getStringProperty( props, PROP_URLCONSTRUCTOR, "DefaultURLConstructor" ) );
@@ -1048,7 +1047,7 @@
* <p>If the page is a special page, then returns a direct URL
* to that page. Otherwise returns <code>null</code>.
* This method delegates requests to
- * {@link com.ecyrd.jspwiki.action.WikiActionBeanFactory#getSpecialPageReference(String)}.
+ * {@link com.ecyrd.jspwiki.action.WikiContextFactory#getSpecialPageReference(String)}.
* </p>
* <p>
* Special pages are defined in jspwiki.properties using the jspwiki.specialPage
@@ -1061,7 +1060,7 @@
*/
public String getSpecialPageReference( String original )
{
- return m_beanFactory.getSpecialPageReference( original );
+ return m_contextFactory.getSpecialPageReference( original );
}
/**
@@ -1147,7 +1146,7 @@
try
{
- if( m_beanFactory.getSpecialPageReference(page) != null ) return true;
+ if( m_contextFactory.getSpecialPageReference(page) != null ) return true;
if( getFinalPageName( page ) != null )
{
@@ -1176,7 +1175,7 @@
public boolean pageExists( String page, int version )
throws ProviderException
{
- if( m_beanFactory.getSpecialPageReference(page) != null ) return true;
+ if( m_contextFactory.getSpecialPageReference(page) != null ) return true;
String finalName = getFinalPageName( page );
@@ -1232,7 +1231,7 @@
* Returns the correct page name, or null, if no such
* page can be found. Aliases are considered. This
* method simply delegates to
- * {@link com.ecyrd.jspwiki.action.WikiActionBeanFactory#getFinalPageName(String)}.
+ * {@link com.ecyrd.jspwiki.action.WikiContextFactory#getFinalPageName(String)}.
* @since 2.0
* @param page Page name.
* @return The rewritten page name, or null, if the page does not exist.
@@ -1241,7 +1240,7 @@
public String getFinalPageName( String page )
throws ProviderException
{
- return m_beanFactory.getFinalPageName( page );
+ return m_contextFactory.getFinalPageName( page );
}
/**
@@ -1472,7 +1471,7 @@
{
WikiPage page = getPage( pagename, version );
- WikiContext context = m_beanFactory.newViewWikiContext( null, null, page );
+ WikiContext context = m_contextFactory.newViewContext( null, null, page );
String res = getHTML( context, page );
@@ -1540,7 +1539,7 @@
{
LinkCollector localCollector = new LinkCollector();
- textToHTML( m_beanFactory.newViewWikiContext( null, null, page ),
+ textToHTML( m_contextFactory.newViewContext( null, null, page ),
pagedata,
localCollector,
null,
@@ -2029,12 +2028,12 @@
}
/**
- * Returns the WikiActionBeanFactory for this wiki engine.
+ * Returns the WikiContextFactory for this wiki engine.
* @return the factory
*/
- public WikiActionBeanFactory getWikiActionBeanFactory()
+ public WikiContextFactory getWikiContextFactory()
{
- return m_beanFactory;
+ return m_contextFactory;
}
/**
@@ -2105,8 +2104,6 @@
* @param request the HTTP request
* @param requestContext the default context to use
* @return a new WikiContext object.
- * @deprecated use WikiActionBeanFactory instead, especially for WikiActionBeans that are not page-related.
- * This method returns <em>only</em> WikiContexts, not other WikiActionBean types
* @since 2.1.15.
*/
// FIXME: We need to have a version which takes a fixed page
@@ -2119,21 +2116,13 @@
throw new InternalWikiException("WikiEngine has not been properly started. It is likely that the configuration is faulty. Please check all logs for the possible reason.");
}
- // Find the WikiActionBean and event handler for this request context
- HandlerInfo handler = m_beanFactory.findEventHandler( requestContext );
- if( handler == null )
- {
- log.error( "No HandlerInfo found for request context '" + requestContext + "'! Check your annotations." );
- return null;
- }
-
- // Build the wiki context... dummy reply and response objects will be added by WikiActionBeanFactory
+ // Build the wiki context... dummy reply and response objects will be added by WikiContextFactory
try
{
- WikiActionBeanContext context = m_beanFactory.newWikiContext( request, (HttpServletResponse)null, requestContext );
+ WikiActionBeanContext context = m_contextFactory.newContext( request, (HttpServletResponse)null, requestContext );
// Stash the action bean/wiki context, and return it!
- WikiActionBeanFactory.saveContext( request, context );
+ WikiContextFactory.saveContext( request, context );
return context;
}
catch ( WikiException e )
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/DefaultWikiContext.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/DefaultWikiContext.java?rev=720416&r1=720415&r2=720416&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/DefaultWikiContext.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/DefaultWikiContext.java Mon Nov 24 21:06:19 2008
@@ -222,25 +222,6 @@
}
/**
- * Returns the target of this wiki context: a page, group name or JSP. If
- * the associated Command is a PageCommand, this method returns the page's
- * name. Otherwise, this method delegates to the associated Command's
- * {@link com.ecyrd.jspwiki.ui.Command#getName()} method. Calling classes
- * can rely on the results of this method for looking up canonically-correct
- * page or group names. Because it does not automatically assume that the
- * wiki context is a PageCommand, calling this method is inherently safer
- * than calling <code>getPage().getName()</code>.
- *
- * @return the name of the target of this wiki context
- * @see com.ecyrd.jspwiki.ui.PageCommand#getName()
- * @see com.ecyrd.jspwiki.ui.GroupCommand#getName()
- */
- public String getName()
- {
- return m_page != null ? m_page.getName() : "<no page>";
- }
-
- /**
* Returns the page that is being handled.
*
* @return the page which was fetched.
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/LoginActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/LoginActionBean.java?rev=720416&r1=720415&r2=720416&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/LoginActionBean.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/LoginActionBean.java Mon Nov 24 21:06:19 2008
@@ -97,7 +97,6 @@
if( getContext().getWikiSession().isAuthenticated() )
{
errors.addGlobalError( new SimpleError( rb.getString( "login.error.noaccess" ) ) );
- getContext().flash( this );
return new RedirectResolution( MessageActionBean.class );
}
@@ -129,7 +128,6 @@
{
UrlBuilder builder = new UrlBuilder( getContext().getLocale(), "/Login.jsp", false );
builder.addParameter( "tab", "logincontent" );
- getContext().flash( this );
r = new RedirectResolution( builder.toString() );
}
@@ -215,7 +213,6 @@
{
ResourceBundle rb = getContext().getBundle( "CoreResources" );
getContext().getValidationErrors().addGlobalError( new SimpleError( rb.getString( "login.error.noaccess" ) ) );
- getContext().flash( this );
return new RedirectResolution( MessageActionBean.class );
}
session.setAttribute( "_redirect", "I love Outi" ); // Any marker
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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -23,7 +23,7 @@
/**
* @author Andrew Jaquith
*/
-@UrlBinding( "/UserProfile.jsp" )
+@UrlBinding( "/UserProfile.action" )
public class UserProfileActionBean extends AbstractActionBean
{
Logger log = Logger.getLogger( UserProfileActionBean.class );
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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -51,7 +51,7 @@
* for one, or a "special page" reference. This method considers
* special page names from <code>jspwiki.properties</code>, and possible aliases.
* To determine whether the page is a special page, this method calls
- * {@link com.ecyrd.jspwiki.action.WikiActionBeanFactory#getSpecialPageReference(String)}.
+ * {@link com.ecyrd.jspwiki.action.WikiContextFactory#getSpecialPageReference(String)}.
* @return a {@link net.sourceforge.stripes.action.RedirectResolution} to the special
* page's real URL, if a special page was specified, or <code>null</code> otherwise
*/
@@ -102,7 +102,7 @@
// Ok, the user supplied a page. That's nice. But is it a special page?
String pageName = page.getName();
- String specialUrl = getContext().getEngine().getWikiActionBeanFactory().getSpecialPageReference( pageName );
+ String specialUrl = getContext().getEngine().getWikiContextFactory().getSpecialPageReference( pageName );
if ( specialUrl != null )
{
return new RedirectResolution( getContext().getViewURL( specialUrl ) );
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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -8,13 +8,11 @@
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;
-import com.ecyrd.jspwiki.tags.WikiTagBase;
/**
* <p>
@@ -25,7 +23,7 @@
* </p>
* <p>
* When the WikiActionBeanContext is created, callers <em>must</em> set the
- * WikiEngine reference by calling either {@link #setWikiEngine(WikiEngine)}
+ * WikiEngine reference by calling either {@link #setEngine(WikiEngine)}
* (which sets it directly), or {@link #setServletContext(ServletContext)}
* (which sets it lazily). when {@link #setServletContext(ServletContext)}. The
* HttpServletRequest reference is set via
@@ -48,37 +46,6 @@
}
/**
- * 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
- */
- public void flash( WikiActionBean actionBean )
- {
- 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 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
@@ -113,7 +80,7 @@
*/
public void setRequestContext( String arg )
{
- HandlerInfo handler = getEngine().getWikiActionBeanFactory().findEventHandler( arg );
+ HandlerInfo handler = getEngine().getWikiContextFactory().findEventHandler( arg );
setEventName( handler.getEventName() );
m_delegate.setRequestContext( arg );
}
@@ -248,14 +215,6 @@
/**
* {@inheritDoc}
*/
- public String getName()
- {
- return m_delegate.getName();
- }
-
- /**
- * {@inheritDoc}
- */
public WikiPage getPage()
{
return m_delegate.getPage();
Copied: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiContextFactory.java (from r720116, 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/WikiContextFactory.java?p2=incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiContextFactory.java&p1=incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiActionBeanFactory.java&r1=720116&r2=720416&rev=720416&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/WikiContextFactory.java Mon Nov 24 21:06:19 2008
@@ -3,13 +3,11 @@
import java.lang.reflect.Method;
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;
import net.sourceforge.stripes.mock.MockHttpServletRequest;
import net.sourceforge.stripes.mock.MockHttpServletResponse;
import net.sourceforge.stripes.mock.MockHttpSession;
@@ -37,15 +35,9 @@
* @author Andrew Jaquith
* @since 2.4.22
*/
-public final class WikiActionBeanFactory
+public final class WikiContextFactory
{
/**
- * The PageContext attribute name of the WikiActionBean stored by
- * WikiInterceptor.
- */
- public static final String ATTR_ACTIONBEAN = "wikiActionBean";
-
- /**
* The PageContext attribute name of the WikiEngine stored by
* WikiInterceptor.
*/
@@ -57,13 +49,6 @@
*/
public static final String ATTR_WIKISESSION = "wikiSession";
- private static final Logger log = Logger.getLogger( WikiActionBeanFactory.class );
-
- private static final long serialVersionUID = 1L;
-
- /** Prefix in jspwiki.properties signifying special page keys. */
- private static final String PROP_SPECIALPAGE = "jspwiki.specialPage.";
-
/** Default list of packages to search for WikiActionBean implementations. */
public static final String DEFAULT_ACTIONBEAN_PACKAGES = "com.ecyrd.jspwiki.action";
@@ -73,91 +58,107 @@
*/
public static final String PROPS_ACTIONBEAN_PACKAGES = "jspwiki.actionBean.packages";
- /** Private map with JSPs as keys, Resolutions as values */
- private final Map<String, RedirectResolution> m_specialRedirects;
-
- private final WikiEngine m_engine;
-
- private String m_mockContextPath;
+ private static final Logger log = Logger.getLogger( WikiContextFactory.class );
- /** If true, we'll also consider english plurals (+s) a match. */
- private boolean m_matchEnglishPlurals;
+ private static final long serialVersionUID = 1L;
- /** Maps (pre-3.0) request contexts map to WikiActionBeans. */
- private final Map<String, HandlerInfo> m_contextMap = new HashMap<String, HandlerInfo>();
+ /** Prefix in jspwiki.properties signifying special page keys. */
+ private static final String PROP_SPECIALPAGE = "jspwiki.specialPage.";
/**
- * Initializes the internal map that matches wiki request contexts with
- * HandlerInfo objects.
- *
- * @param properties
+ * 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.
*/
- private void initRequestContextMap( Properties properties )
+ public static WikiContext findContext( PageContext pageContext )
{
- // Look up all classes that are WikiActionBeans.
- String beanPackagesProp = properties.getProperty( PROPS_ACTIONBEAN_PACKAGES, DEFAULT_ACTIONBEAN_PACKAGES ).trim();
- String[] beanPackages = beanPackagesProp.split( "," );
- Set<Class<? extends WikiActionBean>> beanClasses = findBeanClasses( beanPackages );
-
- // Stash the contexts and corresponding classes into a Map.
- for( Class<? extends WikiActionBean> beanClass : beanClasses )
- {
- Map<Method, HandlerInfo> handlerMethods = HandlerInfo.getHandlerInfoCollection( beanClass );
- for( HandlerInfo handler : handlerMethods.values() )
- {
- String requestContext = handler.getRequestContext();
- if( m_contextMap.containsKey( requestContext ) )
- {
- HandlerInfo duplicateHandler = m_contextMap.get( requestContext );
- log.error( "Bean class " + beanClass.getCanonicalName() + " contains @WikiRequestContext annotation '"
- + requestContext + "' that duplicates one already declared for "
- + duplicateHandler.getActionBeanClass() );
- }
- else
- {
- m_contextMap.put( requestContext, handler );
- log.info( "Discovered request context '" + requestContext + "' for WikiActionBean="
- + beanClass.getCanonicalName() + ",event=" + handler.getEventName() );
- }
- }
- }
+ HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
+ WikiContext context = (WikiContext) request.getAttribute( WikiTagBase.ATTR_CONTEXT );
+ return context;
}
/**
- * Searches a set of named packages for WikiActionBean implementations, and
- * returns any it finds.
+ * Returns the locale of the HTTP request if available, otherwise returns
+ * the default Locale of the server.
*
- * @param beanPackages the packages to search on the current classpath,
- * separated by commas
- * @return the discovered classes
+ * @return A valid locale object
+ * @param context The WikiContext
*/
- private Set<Class<? extends WikiActionBean>> findBeanClasses( String[] beanPackages )
+ public static Locale getLocale( WikiContext context )
{
- ResolverUtil<WikiActionBean> resolver = new ResolverUtil<WikiActionBean>();
- resolver.findImplementations( WikiActionBean.class, beanPackages );
- return resolver.getClasses();
+ return Preferences.getLocale( context );
+ /*
+ * HttpServletRequest request = context.getHttpRequest(); return (
+ * request != null ) ? request.getLocale() : Locale.getDefault();
+ */
}
/**
- * Looks up and returns the correct HandlerInfo class corresponding to a
- * supplied wiki context. The supplied context name is matched against the
- * values annotated using
- * {@link com.ecyrd.jspwiki.action.WikiRequestContext}. If a match is not
- * found, this method throws an IllegalArgumentException.
+ * <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, for example <code>${wikiContext}</code>.
+ * </p>
+ * <p>
+ * 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 context the context to look up
- * @return the WikiActionBean event handler info
+ * @param request the HTTP request
+ * @param context the WikiContext to save
*/
- public HandlerInfo findEventHandler( String context )
+ public static void saveContext( HttpServletRequest request, WikiContext context )
{
- HandlerInfo handler = m_contextMap.get( context );
- if( handler == null )
+ // Stash WikiEngine as a request attribute (can be
+ // used later as ${wikiEngine} in EL markup)
+ 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 );
+
+ WikiPage page = context.getPage();
+ if( page == null )
{
- throw new IllegalArgumentException( "No HandlerInfo found for request context '" + context + "'!" );
+ // 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() );
+ }
+ context.setPage( page );
}
- return handler;
+ request.setAttribute( WikiTagBase.ATTR_CONTEXT, context );
}
+ /** Private map with JSPs as keys, Resolutions as values */
+ private final Map<String, RedirectResolution> m_specialRedirects;
+
+ private final WikiEngine m_engine;
+
+ private String m_mockContextPath;
+
+ /** If true, we'll also consider english plurals (+s) a match. */
+ private boolean m_matchEnglishPlurals;
+
+ /** Maps (pre-3.0) request contexts map to WikiActionBeans. */
+ private final Map<String, HandlerInfo> m_contextMap = new HashMap<String, HandlerInfo>();
+
/**
* Constructs a WikiActionBeanResolver for a given WikiEngine. This
* constructor will extract the special page references for this wiki and
@@ -166,7 +167,7 @@
* @param engine the wiki engine
* @param properties the properties used to initialize the wiki
*/
- public WikiActionBeanFactory( WikiEngine engine, Properties properties )
+ public WikiContextFactory( WikiEngine engine, Properties properties )
{
super();
m_engine = engine;
@@ -187,33 +188,23 @@
}
/**
- * Skims through a supplied set of Properties and looks for anything with
- * the "special page" prefix, and creates Stripes
- * {@link net.sourceforge.stripes.action.RedirectResolution} objects for any
- * that are found.
+ * Looks up and returns the correct HandlerInfo class corresponding to a
+ * supplied wiki context. The supplied context name is matched against the
+ * values annotated using
+ * {@link com.ecyrd.jspwiki.action.WikiRequestContext}. If a match is not
+ * found, this method throws an IllegalArgumentException.
+ *
+ * @param requestContext the context to look up
+ * @return the WikiActionBean event handler info
*/
- private void initSpecialPageRedirects( Properties properties )
+ public HandlerInfo findEventHandler( String requestContext )
{
- for( Map.Entry entry : properties.entrySet() )
+ HandlerInfo handler = m_contextMap.get( requestContext );
+ if( handler == null )
{
- String key = (String) entry.getKey();
- if( key.startsWith( PROP_SPECIALPAGE ) )
- {
- String specialPage = key.substring( PROP_SPECIALPAGE.length() );
- String redirectUrl = (String) entry.getValue();
- if( specialPage != null && redirectUrl != null )
- {
- specialPage = specialPage.trim();
- redirectUrl = redirectUrl.trim();
- RedirectResolution resolution = m_specialRedirects.get( specialPage );
- if( resolution == null )
- {
- resolution = new RedirectResolution( redirectUrl );
- m_specialRedirects.put( specialPage, resolution );
- }
- }
- }
+ throw new IllegalArgumentException( "No HandlerInfo found for request context '" + requestContext + "'!" );
}
+ return handler;
}
/**
@@ -336,15 +327,18 @@
* @param requestContext the request context to use by default
* @return the new WikiActionBeanContext
*/
- public WikiActionBeanContext newWikiContext( HttpServletRequest request, HttpServletResponse response, String requestContext )
- throws WikiException
+ public WikiActionBeanContext newContext( HttpServletRequest request, HttpServletResponse response, String requestContext )
+ throws WikiException
{
- return newContext( requestContext, request, response, null );
+ return createContext( requestContext, request, response, null );
}
/**
- * <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)},
+ * <p>
+ * Creates a new WikiActionBeanContext for the given HttpServletRequest,
+ * HttpServletResponse and WikiPage, using the {@link WikiContext#VIEW}
+ * request context. Similar to method
+ * {@link #newContext(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
@@ -361,13 +355,13 @@
* older version of a page, you must supply this parameter
* @return the new WikiActionBeanContext
*/
- public WikiActionBeanContext newViewWikiContext( HttpServletRequest request, HttpServletResponse response, WikiPage page )
+ public WikiActionBeanContext newViewContext( HttpServletRequest request, HttpServletResponse response, WikiPage page )
{
// Create a new "view" WikiActionBeanContext, and swallow any exceptions
WikiActionBeanContext ctx = null;
try
{
- ctx = newContext( WikiContext.VIEW, request, response, page );
+ ctx = createContext( WikiContext.VIEW, request, response, page );
if( ctx == null )
{
throw new IllegalStateException( "Could not create new WikiContext of type VIEW! This indicates a bug..." );
@@ -382,56 +376,85 @@
}
/**
- * <p>
- * Determines the correct wiki page based on a supplied HTTP request. This
- * method attempts to determine the page requested by a user, taking into
- * account special pages. The resolution algorithm will extract the page
- * name from the URL by looking for the first parameter value returned for
- * the <code>page</code> parameter. If a page name was, in fact, passed in
- * the request, this method the correct name after taking into account
- * potential plural matches.
- * </p>
- * <p>
- * If neither of these methods work, or if the request is <code>null</code>
- * this method returns <code>null</code>
- * </p>.
+ * Searches a set of named packages for WikiActionBean implementations, and
+ * returns any it finds.
*
- * @param request the HTTP request
- * @return the resolved page name
+ * @param beanPackages the packages to search on the current classpath,
+ * separated by commas
+ * @return the discovered classes
*/
- protected final String extractPageFromParameter( HttpServletRequest request )
+ private Set<Class<? extends WikiActionBean>> findBeanClasses( String[] beanPackages )
{
- // Corner case when request == null
- if( request == null )
- {
- return null;
- }
+ ResolverUtil<WikiActionBean> resolver = new ResolverUtil<WikiActionBean>();
+ resolver.findImplementations( WikiActionBean.class, beanPackages );
+ return resolver.getClasses();
+ }
- // Extract the page name from the URL directly
- String[] pages = request.getParameterValues( "page" );
- String page = null;
- if( pages != null && pages.length > 0 )
+ /**
+ * Initializes the internal map that matches wiki request contexts with
+ * HandlerInfo objects.
+ *
+ * @param properties
+ */
+ private void initRequestContextMap( Properties properties )
+ {
+ // Look up all classes that are WikiActionBeans.
+ String beanPackagesProp = properties.getProperty( PROPS_ACTIONBEAN_PACKAGES, DEFAULT_ACTIONBEAN_PACKAGES ).trim();
+ String[] beanPackages = beanPackagesProp.split( "," );
+ Set<Class<? extends WikiActionBean>> beanClasses = findBeanClasses( beanPackages );
+
+ // Stash the contexts and corresponding classes into a Map.
+ for( Class<? extends WikiActionBean> beanClass : beanClasses )
{
- page = pages[0];
- try
+ Map<Method, HandlerInfo> handlerMethods = HandlerInfo.getHandlerInfoCollection( beanClass );
+ for( HandlerInfo handler : handlerMethods.values() )
{
- // Look for singular/plural variants; if one
- // not found, take the one the user supplied
- String finalPage = getFinalPageName( page );
- if( finalPage != null )
+ String requestContext = handler.getRequestContext();
+ if( m_contextMap.containsKey( requestContext ) )
{
- page = finalPage;
+ HandlerInfo duplicateHandler = m_contextMap.get( requestContext );
+ log.error( "Bean class " + beanClass.getCanonicalName() + " contains @WikiRequestContext annotation '"
+ + requestContext + "' that duplicates one already declared for "
+ + duplicateHandler.getActionBeanClass() );
+ }
+ else
+ {
+ m_contextMap.put( requestContext, handler );
+ log.info( "Discovered request context '" + requestContext + "' for WikiActionBean="
+ + beanClass.getCanonicalName() + ",event=" + handler.getEventName() );
}
}
- catch( ProviderException e )
+ }
+ }
+
+ /**
+ * Skims through a supplied set of Properties and looks for anything with
+ * the "special page" prefix, and creates Stripes
+ * {@link net.sourceforge.stripes.action.RedirectResolution} objects for any
+ * that are found.
+ */
+ private void initSpecialPageRedirects( Properties properties )
+ {
+ for( Map.Entry entry : properties.entrySet() )
+ {
+ String key = (String) entry.getKey();
+ if( key.startsWith( PROP_SPECIALPAGE ) )
{
- // FIXME: Should not ignore!
+ String specialPage = key.substring( PROP_SPECIALPAGE.length() );
+ String redirectUrl = (String) entry.getValue();
+ if( specialPage != null && redirectUrl != null )
+ {
+ specialPage = specialPage.trim();
+ redirectUrl = redirectUrl.trim();
+ RedirectResolution resolution = m_specialRedirects.get( specialPage );
+ if( resolution == null )
+ {
+ resolution = new RedirectResolution( redirectUrl );
+ m_specialRedirects.put( specialPage, resolution );
+ }
+ }
}
- return page;
}
-
- // Didn't resolve; return null
- return page;
}
/**
@@ -446,8 +469,8 @@
* @param response
* @return the newly instantiated bean
*/
- protected WikiActionBeanContext newContext( String requestContext, HttpServletRequest request,
- HttpServletResponse response, WikiPage page ) throws WikiException
+ protected WikiActionBeanContext createContext( String requestContext, HttpServletRequest request, HttpServletResponse response,
+ WikiPage page ) throws WikiException
{
// Create synthetic request if not supplied
if( request == null )
@@ -464,16 +487,16 @@
}
// Create the WikiActionBeanContext and set all of its relevant
// properties
- WikiActionBeanContext actionBeanContext = new WikiActionBeanContext();
- actionBeanContext.setRequest( request );
- actionBeanContext.setResponse( response );
- actionBeanContext.setEngine( m_engine );
- actionBeanContext.setServletContext( m_engine.getServletContext() );
+ WikiActionBeanContext context = new WikiActionBeanContext();
+ context.setRequest( request );
+ context.setResponse( response );
+ context.setEngine( m_engine );
+ context.setServletContext( m_engine.getServletContext() );
WikiSession wikiSession = SessionMonitor.getInstance( m_engine ).find( request.getSession() );
- actionBeanContext.setWikiSession( wikiSession );
+ context.setWikiSession( wikiSession );
// Set the request context (and related event name)
- actionBeanContext.setRequestContext( requestContext );
+ context.setRequestContext( requestContext );
// Extract and set the WikiPage
if( page == null )
@@ -496,10 +519,63 @@
if( page != null )
{
- actionBeanContext.setPage( page );
+ context.setPage( page );
}
- return actionBeanContext;
+ return context;
+ }
+
+ /**
+ * <p>
+ * Determines the correct wiki page based on a supplied HTTP request. This
+ * method attempts to determine the page requested by a user, taking into
+ * account special pages. The resolution algorithm will extract the page
+ * name from the URL by looking for the first parameter value returned for
+ * the <code>page</code> parameter. If a page name was, in fact, passed in
+ * the request, this method the correct name after taking into account
+ * potential plural matches.
+ * </p>
+ * <p>
+ * If neither of these methods work, or if the request is <code>null</code>
+ * this method returns <code>null</code>
+ * </p>.
+ *
+ * @param request the HTTP request
+ * @return the resolved page name
+ */
+ protected final String extractPageFromParameter( HttpServletRequest request )
+ {
+ // Corner case when request == null
+ if( request == null )
+ {
+ return null;
+ }
+
+ // Extract the page name from the URL directly
+ String[] pages = request.getParameterValues( "page" );
+ String page = null;
+ if( pages != null && pages.length > 0 )
+ {
+ page = pages[0];
+ try
+ {
+ // Look for singular/plural variants; if one
+ // not found, take the one the user supplied
+ String finalPage = getFinalPageName( page );
+ if( finalPage != null )
+ {
+ page = finalPage;
+ }
+ }
+ catch( ProviderException e )
+ {
+ // FIXME: Should not ignore!
+ }
+ return page;
+ }
+
+ // Didn't resolve; return null
+ return page;
}
/**
@@ -551,140 +627,4 @@
}
return m_engine.getPageManager().pageExists( page );
}
-
- /**
- * 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
- * {@link net.sourceforge.stripes.controller.StripesConstants#REQ_ATTR_ACTION_BEAN}
- * will be attempted.
- *
- * @param request the HTTP request
- * @return the WikiActionBean
- * @throws IllegalStateException if the WikiActionBean was not found in the
- * request scope
- */
- public static WikiActionBean findActionBean( ServletRequest request )
- {
- WikiActionBean bean = (WikiActionBean) request.getAttribute( ATTR_ACTIONBEAN );
- if( bean == null )
- {
- log.debug( "WikiActionBean not found under request attribute '" + ATTR_ACTIONBEAN
- + "'; trying standard Stripes attribute '" + StripesConstants.REQ_ATTR_ACTION_BEAN + "'." );
- bean = (WikiActionBean) request.getAttribute( StripesConstants.REQ_ATTR_ACTION_BEAN );
- }
-
- if( bean == null )
- {
- throw new IllegalStateException( "WikiActionBean not found in request! Something failed to stash it..." );
- }
- return bean;
- }
-
- /**
- * <p>
- * 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}. 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: 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 context the WikiContext to save
- */
- 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 = 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 );
-
- WikiPage page = context.getPage();
- 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() );
- }
- context.setPage( page );
- }
- 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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -4,18 +4,17 @@
import java.security.Permission;
import java.util.Map;
+import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.PageContext;
import net.sourceforge.stripes.action.RedirectResolution;
import net.sourceforge.stripes.action.Resolution;
-import net.sourceforge.stripes.controller.ExecutionContext;
-import net.sourceforge.stripes.controller.Interceptor;
-import net.sourceforge.stripes.controller.Intercepts;
-import net.sourceforge.stripes.controller.LifecycleStage;
+import net.sourceforge.stripes.controller.*;
import org.apache.log4j.Logger;
+import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
import com.ecyrd.jspwiki.WikiSession;
import com.ecyrd.jspwiki.auth.AuthorizationManager;
@@ -54,7 +53,7 @@
* <p>
* After the intercept method fires, calling classes can obtain the saved
* WikiActionBean by calling
- * {@link WikiActionBeanFactory#findActionBean(javax.servlet.ServletRequest)}.
+ * {@link WikiInterceptor#findActionBean(javax.servlet.ServletRequest)}.
* This is the recommended method that JSP scriptlet code should use.
* </p>
* <p>
@@ -70,6 +69,11 @@
public class WikiInterceptor implements Interceptor
{
private static final Logger log = Logger.getLogger( WikiInterceptor.class );
+ /**
+ * The PageContext attribute name of the WikiActionBean stored by
+ * WikiInterceptor.
+ */
+ public static final String ATTR_ACTIONBEAN = "wikiActionBean";
/**
* Intercepts the Stripes lifecycle stages and dispatches execution to
@@ -138,7 +142,7 @@
}
// Stash the WikiActionBean and WikiPage in the request
- WikiActionBeanFactory.saveActionBean( request, actionBean );
+ WikiInterceptor.saveActionBean( request, actionBean );
if( log.isDebugEnabled() )
{
@@ -223,4 +227,56 @@
return null;
}
+ /**
+ * <p>
+ * Saves the supplied WikiActionBean and its associated WikiContext,
+ * WikiEngine and WikiSession in
+ * request scope. The action bean is saved as an attribute named
+ * {@link WikiInterceptor#ATTR_ACTIONBEAN}. The other attributes are saved
+ * as described in {@link WikiContextFactory#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( WikiInterceptor.ATTR_ACTIONBEAN, actionBean );
+
+ // Stash the other attributes
+ WikiContextFactory.saveContext( request, actionBean.getContext() );
+ }
+
+ /**
+ * Returns the WikiActionBean associated with the current
+ * {@link javax.servlet.http.HttpServletRequest}. The ActionBean will be
+ * retrieved from attribute {@link WikiInterceptor#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.
+ *
+ * @param request the HTTP request
+ * @return the WikiActionBean
+ * @throws IllegalStateException if the WikiActionBean was not found in the
+ * request scope
+ */
+ public static WikiActionBean findActionBean( ServletRequest request )
+ {
+ WikiActionBean bean = (WikiActionBean) request.getAttribute( WikiInterceptor.ATTR_ACTIONBEAN );
+ if( bean == null )
+ {
+ log.debug( "WikiActionBean not found under request attribute '" + WikiInterceptor.ATTR_ACTIONBEAN
+ + "'; trying standard Stripes attribute '" + StripesConstants.REQ_ATTR_ACTION_BEAN + "'." );
+ bean = (WikiActionBean) request.getAttribute( StripesConstants.REQ_ATTR_ACTION_BEAN );
+ }
+
+ if( bean == null )
+ {
+ throw new IllegalStateException( "WikiActionBean not found in request! Something failed to stash it..." );
+ }
+ return bean;
+ }
+
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiPageTypeConverter.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiPageTypeConverter.java?rev=720416&r1=720415&r2=720416&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiPageTypeConverter.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/WikiPageTypeConverter.java Mon Nov 24 21:06:19 2008
@@ -66,7 +66,7 @@
{
try
{
- String finalName = engine.getWikiActionBeanFactory().getFinalPageName( pageName );
+ String finalName = engine.getWikiContextFactory().getFinalPageName( pageName );
if( finalName == null || engine.getPage( finalName ) == null )
{
errors.add( new LocalizableError( "pageNotFound", pageName ) );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/package.html
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/package.html?rev=720416&r1=720415&r2=720416&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/package.html (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/action/package.html Mon Nov 24 21:06:19 2008
@@ -30,9 +30,9 @@
JSPWiki templates stored in their "action" form parameters. In JSPWiki
3.0, we provide a subclass called <a href="../ui/WikiActionBean.html">WikiActionBean</a>
includes accessors for things needed by JSPWiki, such as a {@linkplain
-com.ecyrd.jspwiki.action.WikiActionBean#getEngine()} method that returns
+com.ecyrd.jspwiki.action.WikiActionBeanContext#getEngine()} method that returns
the WikiEngine, and {@linkplain
-com.ecyrd.jspwiki.action.WikiActionBean#getWikiSession()} that returns
+com.ecyrd.jspwiki.action.WikiActionBeanContext#getWikiSession()} that returns
the user's WikiSession.</p>
<h3>Request parameter binding</h3>
@@ -422,7 +422,7 @@
example, the previous scriptlet code could be re-written as an
EditActionBean event handler as follows:
<pre>
-@HandlesEvent("save")
+@HandlesEvent("save")
public Resolution save()
{
if( m_change != null && m_change.getTime() != m_pagedate )
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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -180,7 +180,7 @@
//
// Or, try parsing the page
//
- WikiContext ctx = m_engine.getWikiActionBeanFactory().newViewWikiContext( null, null, page );
+ WikiContext ctx = m_engine.getWikiContextFactory().newViewContext( 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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -76,7 +76,7 @@
{
WikiEngine engine = ((WikiDavProvider)m_provider).getEngine();
- WikiContext context = engine.getWikiActionBeanFactory().newViewWikiContext( null, null, m_page );
+ WikiContext context = engine.getWikiContextFactory().newViewContext( 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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -37,7 +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.action.WikiContextFactory;
import com.ecyrd.jspwiki.i18n.InternationalizationManager;
@@ -182,7 +182,7 @@
double[] choiceLimits = { 1, 2 };
MessageFormat fmt = new MessageFormat("");
- fmt.setLocale( WikiActionBeanFactory.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() };
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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -37,7 +37,7 @@
import org.apache.oro.text.regex.*;
import com.ecyrd.jspwiki.*;
-import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
+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 +1127,7 @@
*/
public static final String insertInputFields( PageContext pageContext )
{
- WikiContext ctx = WikiActionBeanFactory.findContext(pageContext);
+ WikiContext ctx = WikiContextFactory.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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -546,12 +546,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,7 +1111,7 @@
{
if( m_cleanTranslator == null )
{
- WikiContext dummyContext = m_engine.getWikiActionBeanFactory().newViewWikiContext(
+ WikiContext dummyContext = m_engine.getWikiContextFactory().newViewContext(
m_context.getHttpRequest(),
(HttpServletResponse)null,
m_context.getPage() );
@@ -2377,7 +2377,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;
}
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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -37,7 +37,7 @@
import com.ecyrd.jspwiki.PropertyReader;
import com.ecyrd.jspwiki.TextUtil;
import com.ecyrd.jspwiki.WikiContext;
-import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
+import com.ecyrd.jspwiki.action.WikiContextFactory;
import com.ecyrd.jspwiki.i18n.InternationalizationManager;
import com.ecyrd.jspwiki.util.HttpUtil;
@@ -96,7 +96,7 @@
{
Preferences prefs = new Preferences();
Properties props = PropertyReader.loadWebAppProps( pageContext.getServletContext() );
- WikiContext ctx = WikiActionBeanFactory.findContext( pageContext );
+ WikiContext ctx = WikiContextFactory.findContext( pageContext );
prefs.put("SkinName", TextUtil.getStringProperty( props, "jspwiki.defaultprefs.template.skinname", "PlainVanilla" ) );
prefs.put("DateFormat",
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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -685,7 +685,7 @@
{
String data = m_provider.getPageText(page.getName(), page.getVersion());
- WikiContext ctx = m_engine.getWikiActionBeanFactory().newViewWikiContext( null, null, page );
+ WikiContext ctx = m_engine.getWikiContextFactory().newViewContext( 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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -142,7 +142,7 @@
WikiPage entryPage = new WikiPage( m_engine, pageName );
entryPage.setAuthor( username );
- WikiContext context = m_engine.getWikiActionBeanFactory().newViewWikiContext( request, response, entryPage );
+ WikiContext context = m_engine.getWikiContextFactory().newViewContext( 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().newViewWikiContext( null, null, p );
+ WikiContext context = m_engine.getWikiContextFactory().newViewContext( 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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -227,7 +227,7 @@
StringBuffer buf = new StringBuffer();
String author = getAuthor(page);
- WikiContext ctx = m_engine.getWikiActionBeanFactory().newViewWikiContext( null, null, page );
+ WikiContext ctx = m_engine.getWikiContextFactory().newViewContext( null, null, page );
if( page.getVersion() > 1 )
{
String diff = m_engine.getDiff( ctx,
@@ -276,7 +276,7 @@
*/
public String generate() throws WikiException
{
- WikiContext context = m_engine.getWikiActionBeanFactory().newWikiContext(null,null,WikiContext.RSS);
+ WikiContext context = m_engine.getWikiContextFactory().newContext(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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -27,7 +27,7 @@
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
+import com.ecyrd.jspwiki.action.WikiContextFactory;
import com.ecyrd.jspwiki.ui.Editor;
import com.ecyrd.jspwiki.ui.EditorManager;
@@ -47,7 +47,7 @@
public final int doStartTag()
{
- m_wikiContext = WikiActionBeanFactory.findContext(pageContext);
+ m_wikiContext = WikiContextFactory.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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -33,7 +33,7 @@
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiPage;
-import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
+import com.ecyrd.jspwiki.action.WikiContextFactory;
/**
* Iterates through tags.
@@ -111,7 +111,7 @@
*/
public int doStartTag()
{
- m_wikiContext = WikiActionBeanFactory.findContext(pageContext);
+ m_wikiContext = WikiContextFactory.findContext(pageContext);
resetIterator();
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageNameTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageNameTag.java?rev=720416&r1=720415&r2=720416&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageNameTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageNameTag.java Mon Nov 24 21:06:19 2008
@@ -50,7 +50,7 @@
}
else
{
- pageContext.getOut().print( engine.beautifyTitle( m_wikiContext.getName() ) );
+ pageContext.getOut().print( engine.beautifyTitle( page.getName() ) );
}
}
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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -104,7 +104,7 @@
// Create a wiki context for the result
WikiEngine engine = m_wikiContext.getEngine();
- WikiContext context = engine.getWikiActionBeanFactory().newViewWikiContext( null, null, r.getPage() );
+ WikiContext context = engine.getWikiContextFactory().newViewContext( 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/tags/WikiTagBase.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/WikiTagBase.java?rev=720416&r1=720415&r2=720416&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/WikiTagBase.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/WikiTagBase.java Mon Nov 24 21:06:19 2008
@@ -30,7 +30,7 @@
import com.ecyrd.jspwiki.*;
import com.ecyrd.jspwiki.action.WikiActionBean;
-import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
+import com.ecyrd.jspwiki.action.WikiInterceptor;
/**
* Base class for JSPWiki tags. You do not necessarily have
@@ -83,7 +83,7 @@
/**
* Initializes the tag, and sets an internal reference to the current WikiActionBean
* by delegating to
- * {@link com.ecyrd.jspwiki.action.WikiActionBeanFactory#findActionBean(javax.servlet.ServletRequest)}.
+ * {@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
@@ -98,7 +98,7 @@
try
{
// Retrieve the ActionBean injected by WikiInterceptor
- m_wikiActionBean = WikiActionBeanFactory.findActionBean( this.getPageContext().getRequest() );
+ 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 )
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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 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.WikiActionBeanFactory;
+import com.ecyrd.jspwiki.action.WikiContextFactory;
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 = WikiActionBeanFactory.findContext( pageContext );
+ WikiContext context = WikiContextFactory.findContext( pageContext );
Properties props = m_engine.getWikiProperties();
ArrayList<String> tfArr = new ArrayList<String>(40);
LinkedHashMap<String,String> resultMap = new LinkedHashMap<String,String>();
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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -32,7 +32,7 @@
import com.ecyrd.jspwiki.TextUtil;
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.action.WikiActionBean;
-import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
+import com.ecyrd.jspwiki.action.WikiInterceptor;
import com.ecyrd.jspwiki.event.*;
import com.ecyrd.jspwiki.util.UtilJ2eeCompat;
import com.ecyrd.jspwiki.util.WatchDog;
@@ -104,7 +104,7 @@
}
// fire PAGE_REQUESTED event
- WikiActionBean wikiActionBean = WikiActionBeanFactory.findActionBean( request );
+ WikiActionBean wikiActionBean = WikiInterceptor.findActionBean( request );
WikiContext wikiContext = wikiActionBean.getContext();
boolean isViewContext = WikiContext.VIEW .equals( wikiContext.getRequestContext() );
if ( isViewContext )
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/url/StripesURLConstructor.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/url/StripesURLConstructor.java?rev=720416&r1=720415&r2=720416&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/url/StripesURLConstructor.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/url/StripesURLConstructor.java Mon Nov 24 21:06:19 2008
@@ -105,7 +105,7 @@
// For the other contexts, initialize UrlBuilder with the WikiActionBean's URLBinding
else
{
- HandlerInfo handler = m_engine.getWikiActionBeanFactory().findEventHandler( context );
+ HandlerInfo handler = m_engine.getWikiContextFactory().findEventHandler( context );
Class<? extends WikiActionBean> beanClass = handler.getActionBeanClass();
UrlBinding mapping = UrlBindingFactory.getInstance().getBindingPrototype(beanClass);
baseUrl = mapping == null ? null : mapping.getPath();
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=720416&r1=720415&r2=720416&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 Mon Nov 24 21:06:19 2008
@@ -268,7 +268,7 @@
WikiPage entryPage = new WikiPage( engine, pageName );
entryPage.setAuthor( username );
- WikiContext context = engine.getWikiActionBeanFactory().newViewWikiContext( null, null, entryPage );
+ WikiContext context = engine.getWikiContextFactory().newViewContext( 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().newViewWikiContext( null, null, entryPage );
+ WikiContext context = engine.getWikiContextFactory().newViewContext( null, null, entryPage );
StringBuffer text = new StringBuffer();
text.append( "!"+content.get("title") );