Author: ajaquith
Date: Wed Feb 3 05:19:37 2010
New Revision: 905890
URL: http://svn.apache.org/viewvc?rev=905890&view=rev
Log:
Moved injection of JSTL variables ${wikiEngine} and ${wikiSession} to
SessionMonitor, so that they are always present even if Stripes isn't involved.
Modified:
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/SessionMonitor.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/ui/stripes/WikiInterceptor.java
Modified:
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/SessionMonitor.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/SessionMonitor.java?rev=905890&r1=905889&r2=905890&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/SessionMonitor.java
(original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/SessionMonitor.java
Wed Feb 3 05:19:37 2010
@@ -32,6 +32,7 @@
import org.apache.wiki.WikiEngine;
import org.apache.wiki.WikiSession;
+import org.apache.wiki.action.WikiContextFactory;
import org.apache.wiki.event.*;
import org.apache.wiki.log.Logger;
import org.apache.wiki.log.LoggerFactory;
@@ -274,9 +275,17 @@
}
/**
- * Fires when the web container creates a new HTTP session;
- * it also injects scripting session attribute <code>templates</code>
- * into the session.
+ * <p>Prepares JSPWiki scripting variables when the web container creates
+ * a new HTTP session. These session attributes are injected:</p>
+ * <ul>
+ * <li>{...@code templates} - the template resource resolver map,
returned
+ * by {...@link
org.apache.wiki.ui.TemplateManager#getTemplateResources()}</li>
+ * <li>{...@code wikiEngine} - the {...@link
org.apache.wiki.WikiEngine}</li>
+ * <li>{...@code wikiSession} - the {...@link
org.apache.wiki.WikiSession}</li>
+ * </ul>
+ * <p>After the session attributes are injected, downstream classes
+ * like WikiTagBase can use it. The attributes can also be accessed as
variables
+ * using the JSP Expression Language (example:
<code>${wikiSession}</code>).</p>
*
* @param event the HTTP session event
*/
@@ -294,6 +303,10 @@
// Stash 'templates' attribute for scripting
session.setAttribute( "templates",
engine.getTemplateManager().getTemplateResources() );
+
+ // Stash the WikiEngine and WikiSession for scripting
+ session.setAttribute( WikiContextFactory.ATTR_WIKIENGINE, engine );
+ session.setAttribute( WikiContextFactory.ATTR_WIKISESSION, find(
session ) );
}
/**
Modified:
incubator/jspwiki/trunk/src/java/org/apache/wiki/ui/stripes/WikiInterceptor.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/ui/stripes/WikiInterceptor.java?rev=905890&r1=905889&r2=905890&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/java/org/apache/wiki/ui/stripes/WikiInterceptor.java
(original)
+++
incubator/jspwiki/trunk/src/java/org/apache/wiki/ui/stripes/WikiInterceptor.java
Wed Feb 3 05:19:37 2010
@@ -268,11 +268,11 @@
* After the Stripes
* {...@link
net.sourceforge.stripes.controller.LifecycleStage#ActionBeanResolution}
* executes, this method runs the login stack to check for user
authentication,
- * injects the current WikiEngine, WikiSession and WikiActionBean into
- * request scope, and returns <code>null</code>. After the objects are
- * injected, downstream classes like WikiTagBase can use them. The
attribute
- * can also be accessed as variables using the JSP Expression Language
- * (example: <code>${wikiPage}</code>). User preferences are also set up.
+ * injects the current WikiActionBean into request scope, and returns
+ * <code>null</code>. After the action bean is injected, downstream classes
+ * like WikiTagBase can use it. The attribute can also be accessed as
variables
+ * using the JSP Expression Language (example:
<code>${wikiActionBean}</code>).
+ * User preferences are also set up.
*
* @param context the execution context
* @return a Resolution if the
@@ -306,9 +306,7 @@
WikiEngine engine = actionBeanContext.getEngine();
engine.getAuthenticationManager().login( request );
- // Stash the WikiEngine, WikiSession and ActionBean
- request.setAttribute( WikiContextFactory.ATTR_WIKIENGINE,
actionBeanContext.getEngine() );
- request.setAttribute( WikiContextFactory.ATTR_WIKISESSION,
actionBeanContext.getWikiSession() );
+ // Stash the WikiActionBean
request.setAttribute( ATTR_ACTIONBEAN, actionBean );
// Stash the ActionBean as a PageContext attribute too