You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ja...@apache.org on 2008/12/20 12:26:37 UTC
svn commit: r728270 -
/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/WikiContextFactory.java
Author: jalkanen
Date: Sat Dec 20 03:26:36 2008
New Revision: 728270
URL: http://svn.apache.org/viewvc?rev=728270&view=rev
Log:
Added newViewContext(WikiPage) to get rid of null arguments all over the place.
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/WikiContextFactory.java
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/WikiContextFactory.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/WikiContextFactory.java?rev=728270&r1=728269&r2=728270&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/WikiContextFactory.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/WikiContextFactory.java Sat Dec 20 03:26:36 2008
@@ -22,6 +22,8 @@
import com.ecyrd.jspwiki.*;
import com.ecyrd.jspwiki.auth.SessionMonitor;
+import com.ecyrd.jspwiki.content.ContentManager;
+import com.ecyrd.jspwiki.content.WikiName;
import com.ecyrd.jspwiki.log.Logger;
import com.ecyrd.jspwiki.log.LoggerFactory;
import com.ecyrd.jspwiki.parser.MarkupParser;
@@ -128,12 +130,7 @@
{
// 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() );
- }
+ page = engine.getFrontPage( ContentManager.DEFAULT_SPACE );
context.setPage( page );
}
request.setAttribute( WikiTagBase.ATTR_CONTEXT, context );
@@ -363,6 +360,17 @@
}
/**
+ * Provides a clean shortcut to newViewContext(null,null,page).
+ *
+ * @param page The WikiPage object for this page.
+ * @return A new WikiPage.
+ */
+ public WikiActionBeanContext newViewContext( WikiPage page )
+ {
+ return newViewContext( null, null, page );
+ }
+
+ /**
* Searches a set of named packages for WikiActionBean implementations, and
* returns any it finds.
*
@@ -614,7 +622,7 @@
if( wikipage == null )
{
page = MarkupParser.cleanLink( page );
- wikipage = new WikiPage( m_engine, page );
+ wikipage = m_engine.createPage( WikiName.valueOf( page ) );
}
return wikipage;
}