You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2006/01/16 22:56:47 UTC
svn commit: r369582 -
/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/ControlFilter.java
Author: cschoett
Date: Mon Jan 16 13:56:43 2006
New Revision: 369582
URL: http://svn.apache.org/viewcvs?rev=369582&view=rev
Log:
Partial fix for BEEHIVE-1028, this fix addresses the ControlFilter only NOT pageflows. The fix consists of removing the 'useSession' flag from the ControlFilter and creating a new control bean context for each request.
Modified:
beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/ControlFilter.java
Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/ControlFilter.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/ControlFilter.java?rev=369582&r1=369581&r2=369582&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/ControlFilter.java (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/servlet/ControlFilter.java Mon Jan 16 13:56:43 2006
@@ -24,8 +24,6 @@
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
/**
* The ControlFilter class provides an implementation of an HTTP servlet filter that supports
@@ -45,13 +43,6 @@
*/
/**
- * The useSession init parameter is a boolean value that indicates whether the bean context
- * should be stored in session. This makes the context (and any contained controls)
- * accessible across multiple http requests.
- */
- public static String INIT_PARAM_USE_SESSION = "useSession";
-
- /**
* The contextClass init parameter is a class name that defines the BeanContext class to use
* for containing Controls in the servlet container. This class <b>must be</b> a subclass of
* the org.apache.beehive.runtime.servlet.ServletBeanContext class.
@@ -61,7 +52,6 @@
public void init(FilterConfig filterConfig) throws ServletException
{
_filterConfig = filterConfig;
- _useSessionContext = new Boolean(filterConfig.getInitParameter(INIT_PARAM_USE_SESSION)).booleanValue();
String contextClassName = filterConfig.getInitParameter(INIT_PARAM_CONTEXT_CLASS);
if(contextClassName != null)
{
@@ -86,43 +76,21 @@
{
if (request instanceof HttpServletRequest)
{
- ServletBeanContext beanContext = null;
- HttpSession httpSession = null;
-
- //
- // If preserving control bean context within session state, then retrieve
- // it.
- //
- if (_useSessionContext)
+ ServletBeanContext beanContext;
+ try
{
- httpSession = ((HttpServletRequest)request).getSession(true);
- beanContext = (ServletBeanContext)httpSession.getAttribute(BEAN_CONTEXT_ATTRIBUTE);
+ beanContext = (ServletBeanContext)_contextClass.newInstance();
}
-
- //
- // If no context exists, then create a new one and (optionally) store it
- // within session state.
- // OPTIMIZE: Avoid per-request creation using TLS or some other mechanism
- //
- if (beanContext == null)
+ catch(Exception e)
{
- try
- {
- beanContext = (ServletBeanContext)_contextClass.newInstance();
- }
- catch(Exception e)
- {
- throw new ServletException("Cannot construct BeanContext class instance: " +
- _contextClass.getName());
- }
- if (httpSession != null)
- httpSession.setAttribute(BEAN_CONTEXT_ATTRIBUTE, beanContext);
+ throw new ServletException("Cannot construct BeanContext class instance: " +
+ _contextClass.getName());
}
//
// Start a new execution context
//
- beanContext.beginContext(_filterConfig.getServletContext(), request, response);
+ beanContext.beginContext(_filterConfig.getServletContext(), request, response);
try
{
//
@@ -154,11 +122,6 @@
* The FilterConfig associated with this filter instance.
*/
FilterConfig _filterConfig;
-
- /**
- * The resolved value of the 'useSession' filter attribute.
- */
- private boolean _useSessionContext = false;
/**
* The BeanContext class to use as the container for controls running in the ServletContainer