Revision: 344
Author: tfenne
Date: 2006-07-08 06:22:41 -0700 (Sat, 08 Jul 2006)
ViewCVS: http://svn.sourceforge.net/stripes/?rev=344&view=rev
Log Message:
-----------
Fix for STS-207: provide access to the ServletContext through the
ActionBeanContext without the need to create a session
Modified Paths:
--------------
trunk/stripes/src/net/sourceforge/stripes/action/ActionBeanContext.java
trunk/stripes/src/net/sourceforge/stripes/controller/DispatcherServlet.java
trunk/stripes/src/net/sourceforge/stripes/tag/UseActionBeanTag.java
Modified:
trunk/stripes/src/net/sourceforge/stripes/action/ActionBeanContext.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/action/ActionBeanContext.java
2006-07-08 13:07:43 UTC (rev 343)
+++ trunk/stripes/src/net/sourceforge/stripes/action/ActionBeanContext.java
2006-07-08 13:22:41 UTC (rev 344)
@@ -21,6 +21,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletContext;
import java.util.Locale;
import java.util.List;
import java.util.ArrayList;
@@ -42,6 +43,7 @@
private HttpServletRequest request;
private HttpServletResponse response;
+ private ServletContext servletContext;
private String eventName;
private ValidationErrors validationErrors;
@@ -79,6 +81,24 @@
}
/**
+ * Retrieves the ServletContext object that is associated with the context
in which the
+ * current request is being processed.
+ * @return ServletContext the current ServletContext
+ */
+ public ServletContext getServletContext() {
+ return servletContext;
+ }
+
+ /**
+ * Sets the ServletContext object that is associated with the context in
which the
+ * current request is being processed.
+ * @param servletContext the current ServletContext
+ */
+ public void setServletContext(ServletContext servletContext) {
+ this.servletContext = servletContext;
+ }
+
+ /**
* Supplies the name of the event being handled. While a specific method
is usually invoked on
* an ActionBean, through the use of default handlers ambiguity can arise.
This allows
* ActionBeans to definitively know the name of the event that was fired.
Modified:
trunk/stripes/src/net/sourceforge/stripes/controller/DispatcherServlet.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/controller/DispatcherServlet.java
2006-07-08 13:07:43 UTC (rev 343)
+++ trunk/stripes/src/net/sourceforge/stripes/controller/DispatcherServlet.java
2006-07-08 13:22:41 UTC (rev 344)
@@ -122,6 +122,7 @@
// First manufacture an ActionBeanContext
final ActionBeanContext context =
config.getActionBeanContextFactory().getContextInstance(request, response);
+ context.setServletContext(getServletContext());
// Then setup the ExecutionContext that we'll use to process this
request
final ExecutionContext ctx = new ExecutionContext();
Modified: trunk/stripes/src/net/sourceforge/stripes/tag/UseActionBeanTag.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/tag/UseActionBeanTag.java
2006-07-08 13:07:43 UTC (rev 343)
+++ trunk/stripes/src/net/sourceforge/stripes/tag/UseActionBeanTag.java
2006-07-08 13:22:41 UTC (rev 344)
@@ -81,6 +81,7 @@
// Setup the context stuff needed to emulate the dispatcher
ActionBeanContext tempContext =
config.getActionBeanContextFactory().getContextInstance(request, response);
+
tempContext.setServletContext(getPageContext().getServletContext());
ExecutionContext ctx = new ExecutionContext();
ctx.setLifecycleStage(LifecycleStage.ActionBeanResolution);
ctx.setActionBeanContext(tempContext);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development