jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajaqu...@apache.org
Subject svn commit: r724978 - /incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java
Date Wed, 10 Dec 2008 05:13:32 GMT
Author: ajaquith
Date: Tue Dec  9 21:13:32 2008
New Revision: 724978

URL: http://svn.apache.org/viewvc?rev=724978&view=rev
Log:
TemplateManager gains a new (fairly volatile) method that returns a ForwardResolution to content
template pages.

Modified:
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java?rev=724978&r1=724977&r2=724978&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java Tue Dec  9 21:13:32
2008
@@ -32,17 +32,21 @@
 import javax.servlet.jsp.PageContext;
 import javax.servlet.jsp.jstl.fmt.LocaleSupport;
 
+import net.sourceforge.stripes.action.ForwardResolution;
+
 import org.apache.commons.lang.StringUtils;
-import com.ecyrd.jspwiki.log.Logger;
-import com.ecyrd.jspwiki.log.LoggerFactory;
 
 import com.ecyrd.jspwiki.InternalWikiException;
 import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
+import com.ecyrd.jspwiki.action.WikiActionBean;
 import com.ecyrd.jspwiki.action.WikiContextFactory;
+import com.ecyrd.jspwiki.log.Logger;
+import com.ecyrd.jspwiki.log.LoggerFactory;
 import com.ecyrd.jspwiki.modules.ModuleManager;
 import com.ecyrd.jspwiki.preferences.Preferences;
 import com.ecyrd.jspwiki.preferences.Preferences.TimeFormat;
+import com.ecyrd.jspwiki.ui.stripes.WikiActionBeanContext;
 
 /**
  *  This class takes care of managing JSPWiki templates.  This class also provides
@@ -123,6 +127,8 @@
     /** Requests a HTTP header. Value is {@value}. */
     public static final String RESOURCE_HTTPHEADER = "httpheader";
 
+    private WikiEngine m_engine;
+
     /**
      *  Creates a new TemplateManager.  There is typically one manager per engine.
      *
@@ -132,7 +138,7 @@
     public TemplateManager( WikiEngine engine, Properties properties )
     {
         super(engine);
-
+        m_engine = engine;
         //
         //  Uses the unlimited cache.
         //
@@ -225,6 +231,20 @@
     }
 
     /**
+     * Returns a Stripes ForwardResolution to the content page
+     * @return
+     */
+    public ForwardResolution getContentPage( WikiActionBean actionBean, String templateJsp,
String contentJsp )
+    {
+        WikiActionBeanContext wikiContext = actionBean.getContext();
+        wikiContext.setVariable( "contentTemplate", contentJsp );
+        String contentPage = findResource( wikiContext.getServletContext(), wikiContext.getTemplate(),
templateJsp );
+        
+        ForwardResolution r = new ForwardResolution( contentPage );
+        return r;
+    }
+
+    /**
      *  An utility method for finding a JSP page.  It searches only under
      *  either current context or by the absolute name.
      *



Mime
View raw message