struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr...@apache.org
Subject svn commit: r577728 [1/2] - in /struts/struts2/trunk: apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/ apps/showcase/src/main/resources/ core/src/main/java/org/apache/struts2/ core/src/main/java/org/apache/struts2/components/ core/sr...
Date Thu, 20 Sep 2007 12:51:45 GMT
Author: mrdon
Date: Thu Sep 20 05:51:41 2007
New Revision: 577728

URL: http://svn.apache.org/viewvc?rev=577728&view=rev
Log:
Changes necessary for XWork 2.1:
 * New EL abstraction to allow ONGL to be replaced
 * Got rid of static factories and state, in favor of dep injection
 * New plugin API points for the EL abstraction

XW-566 XW-461 XW-561

Removed:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/Sorter.java
Modified:
    struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java
    struts/struts2/trunk/apps/showcase/src/main/resources/struts.xml
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Bean.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Debug.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Include.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/BeanSelectionProvider.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/MethodConfigurationProvider.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxy.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxyFactory.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/debugging/ObjectToHTMLWriter.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsUtil.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/validators/DWRValidator.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/OgnlTool.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/util/UrlHelper.java
    struts/struts2/trunk/core/src/main/resources/struts-default.xml
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/FormButtonTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/FormTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/PropertyTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/UIBeanTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/config/MethodConfigurationProviderTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/FilterDispatcherTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/FilterTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/HttpHeaderResultTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/PlainTextResultTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/StrutsResultSupportTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/VelocityResultTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptorTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/interceptor/TokenInterceptorTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/interceptor/validation/AnnotationValidationInterceptorTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptorTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/util/InvocationSessionStoreTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/util/StrutsUtilTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreeMarkerResultTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/tags/TagModelTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ElseIfTagTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ElseTagTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/IfTagTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/util/ContextUtilTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/util/UrlHelperTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java
    struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ListValidatorsAction.java
    struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowConfigAction.java
    struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowValidatorAction.java
    struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/AbstractTagTest.java
    struts/struts2/trunk/plugins/jsf/src/main/java/org/apache/struts2/jsf/StrutsVariableResolver.java
    struts/struts2/trunk/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusObjectFactory.java
    struts/struts2/trunk/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/TemplatePageFilter.java
    struts/struts2/trunk/plugins/struts1/src/main/java/org/apache/struts2/s1/Struts1Action.java

Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java Thu Sep 20 05:51:41 2007
@@ -26,7 +26,7 @@
 import org.apache.struts2.views.freemarker.FreemarkerManager;
 import org.apache.struts2.views.freemarker.ScopesHashModel;
 
-import com.opensymphony.xwork2.util.OgnlValueStack;
+import com.opensymphony.xwork2.ognl.OgnlValueStack;
 import com.opensymphony.xwork2.util.ValueStack;
 
 /**

Modified: struts/struts2/trunk/apps/showcase/src/main/resources/struts.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/resources/struts.xml?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/resources/struts.xml (original)
+++ struts/struts2/trunk/apps/showcase/src/main/resources/struts.xml Thu Sep 20 05:51:41 2007
@@ -12,6 +12,7 @@
     <constant name="struts.devMode" value="true" />
     <constant name="struts.configuration.xml.reload" value="false" />
     <constant name="struts.custom.i18n.resources" value="globalMessages" />
+    <constant name="struts.action.extension" value="action,," />
 
     <constant name="struts.codebehind.defaultPackage" value="person" />
     <constant name="struts.freemarker.manager.classname" value="customFreemarkerManager" />

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java Thu Sep 20 05:51:41 2007
@@ -165,4 +165,16 @@
 	/** The name of the parameter to determine whether static method access will be allowed in OGNL expressions or not */
 	public static final String STRUTS_ALLOW_STATIC_METHOD_ACCESS = "struts.ognl.allowStaticMethodAccess";
 
+	/** The com.opensymphony.xwork2.validator.ActionValidatorManager implementation class */
+    public static final String STRUTS_ACTIONVALIDATORMANAGER = "struts.actionValidatorManager";
+
+    /** The {@link com.opensymphony.xwork2.util.ValueStackFactory} implementation class */
+    public static final String STRUTS_VALUESTACKFACTORY = "struts.valueStackFactory";
+
+    /** The {@link com.opensymphony.xwork2.reflection.ReflectionProvider} implementation class */
+    public static final String STRUTS_REFLECTIONPROVIDER = "struts.reflectionProvider";
+
+    /** The {@link com.opensymphony.xwork2.reflection.ReflectionContextFactory} implementation class */
+    public static final String STRUTS_REFLECTIONCONTEXTFACTORY = "struts.reflectionContextFactory";
+
 }

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java Thu Sep 20 05:51:41 2007
@@ -120,6 +120,7 @@
     protected HttpServletResponse res;
     protected HttpServletRequest req;
 
+    protected ValueStackFactory valueStackFactory;
     protected ActionProxyFactory actionProxyFactory;
     protected ActionProxy proxy;
     protected String name;
@@ -141,6 +142,11 @@
     public void setActionProxyFactory(ActionProxyFactory actionProxyFactory) {
         this.actionProxyFactory = actionProxyFactory;
     }
+    
+    @Inject
+    public void setValueStackFactory(ValueStackFactory valueStackFactory) {
+        this.valueStackFactory = valueStackFactory;
+    }
 
     public boolean end(Writer writer, String body) {
         boolean end = super.end(writer, "", false);
@@ -192,7 +198,7 @@
                 res,
                 servletContext);
 
-        ValueStack newStack = ValueStackFactory.getFactory().createValueStack(stack);
+        ValueStack newStack = valueStackFactory.createValueStack(stack);
         extraContext.put(ActionContext.VALUE_STACK, newStack);
 
         // add page context, such that ServletDispatcherResult will do an include

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Bean.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Bean.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Bean.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Bean.java Thu Sep 20 05:51:41 2007
@@ -30,8 +30,8 @@
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ClassLoaderUtil;
 import com.opensymphony.xwork2.ObjectFactory;
-import com.opensymphony.xwork2.util.OgnlUtil;
 import com.opensymphony.xwork2.util.ValueStack;
+import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
 
 /**
  * <!-- START SNIPPET: javadoc -->
@@ -101,6 +101,7 @@
     protected Object bean;
     protected String name;
     protected ObjectFactory objectFactory;
+    protected ReflectionProvider reflectionProvider;
 
     public Bean(ValueStack stack) {
         super(stack);
@@ -110,6 +111,11 @@
     public void setObjectFactory(ObjectFactory objectFactory) {
         this.objectFactory = objectFactory;
     }
+    
+    @Inject
+    public void setReflectionProvider(ReflectionProvider prov) {
+        this.reflectionProvider = prov;
+    }
 
     public boolean start(Writer writer) {
         boolean result = super.start(writer);
@@ -142,7 +148,7 @@
     }
 
     public void addParameter(String key, Object value) {
-        OgnlUtil.setProperty(key, value, bean, getStack().getContext());
+        reflectionProvider.setProperty(key, value, bean, getStack().getContext());
     }
 
     @StrutsTagAttribute(description="The class name of the bean to be instantiated (must respect JavaBean specification)",

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java Thu Sep 20 05:51:41 2007
@@ -342,7 +342,7 @@
                                         boolean includeContext, boolean encodeResult, boolean forceAddSchemeHostAndPort,
                                         boolean escapeAmp) {
         String finalAction = findString(action);
-	String finalMethod = method != null ? findString(method) : method;
+        String finalMethod = method != null ? findString(method) : method;
         String finalNamespace = determineNamespace(namespace, getStack(), req);
         ActionMapping mapping = new ActionMapping(finalAction, finalNamespace, finalMethod, parameters);
         String uri = actionMapper.getUriFromActionMapping(mapping);

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Debug.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Debug.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Debug.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Debug.java Thu Sep 20 05:51:41 2007
@@ -20,8 +20,9 @@
  */
 package org.apache.struts2.components;
 
+import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ValueStack;
-import com.opensymphony.xwork2.util.OgnlUtil;
+import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
 
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletRequest;
@@ -38,11 +39,20 @@
         description="Prints debugging information")
 public class Debug extends UIBean {
     public static final String TEMPLATE = "debug";
+    
+    protected ReflectionProvider reflectionProvider;
+
+    
 
     public Debug(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
         super(stack, request, response);
     }
 
+    @Inject
+    public void setReflectionProvider(ReflectionProvider prov) {
+        this.reflectionProvider = prov;
+    }
+    
     protected String getDefaultTemplate() {
         return TEMPLATE;
     }
@@ -57,7 +67,7 @@
             Object o = iter.next();
             Map values;
             try {
-                values = OgnlUtil.getBeanMap(o);
+                values = reflectionProvider.getBeanMap(o);
             } catch (Exception e) {
                 throw new StrutsException("Caught an exception while getting the property values of " + o, e);
             }

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java Thu Sep 20 05:51:41 2007
@@ -28,7 +28,7 @@
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.interceptor.MethodFilterInterceptorUtil;
 import com.opensymphony.xwork2.util.ValueStack;
-import com.opensymphony.xwork2.validator.ActionValidatorManagerFactory;
+import com.opensymphony.xwork2.validator.ActionValidatorManager;
 import com.opensymphony.xwork2.validator.FieldValidator;
 import com.opensymphony.xwork2.validator.ValidationInterceptor;
 import com.opensymphony.xwork2.validator.Validator;
@@ -107,6 +107,7 @@
     protected Configuration configuration;
     protected ObjectFactory objectFactory;
     protected UrlRenderer urlRenderer;
+    protected ActionValidatorManager actionValidatorManager;
 
     public Form(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
         super(stack, request, response);
@@ -143,6 +144,11 @@
     public void setUrlRenderer(UrlRenderer urlRenderer) {
     	this.urlRenderer = urlRenderer;
     }
+    
+    @Inject
+    public void setActionValidatorManager(ActionValidatorManager mgr) {
+        this.actionValidatorManager = mgr;
+    }
 
 
     /*
@@ -264,7 +270,7 @@
             return Collections.EMPTY_LIST;
         }
 
-        List<Validator> all = ActionValidatorManagerFactory.getInstance().getValidators(actionClass, (String) getParameters().get("actionName"));
+        List<Validator> all = actionValidatorManager.getValidators(actionClass, (String) getParameters().get("actionName"));
         List<Validator> validators = new ArrayList<Validator>();
         for (Validator validator : all) {
             if (validator instanceof FieldValidator) {

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Include.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Include.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Include.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Include.java Thu Sep 20 05:51:41 2007
@@ -115,7 +115,7 @@
     }
 
     @Inject(StrutsConstants.STRUTS_I18N_ENCODING)
-    public static void setDefaultEncoding(String encoding) {
+    public void setDefaultEncoding(String encoding) {
         defaultEncoding = encoding;
     }
 

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/BeanSelectionProvider.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/BeanSelectionProvider.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/BeanSelectionProvider.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/BeanSelectionProvider.java Thu Sep 20 05:51:41 2007
@@ -47,7 +47,11 @@
 import com.opensymphony.xwork2.inject.Scope;
 import com.opensymphony.xwork2.util.ClassLoaderUtil;
 import com.opensymphony.xwork2.util.LocalizedTextUtil;
+import com.opensymphony.xwork2.util.ValueStackFactory;
 import com.opensymphony.xwork2.util.location.LocatableProperties;
+import com.opensymphony.xwork2.util.reflection.ReflectionContextFactory;
+import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
+import com.opensymphony.xwork2.validator.ActionValidatorManager;
 
 /**
  * Selects the implementations of key framework extension points, using the loaded
@@ -161,6 +165,10 @@
         alias(FreemarkerManager.class, StrutsConstants.STRUTS_FREEMARKER_MANAGER_CLASSNAME, builder, props);
         alias(VelocityManager.class, StrutsConstants.STRUTS_VELOCITY_MANAGER_CLASSNAME, builder, props);
         alias(UrlRenderer.class, StrutsConstants.STRUTS_URL_RENDERER, builder, props);
+        alias(ActionValidatorManager.class, StrutsConstants.STRUTS_ACTIONVALIDATORMANAGER, builder, props);
+        alias(ValueStackFactory.class, StrutsConstants.STRUTS_VALUESTACKFACTORY, builder, props);
+        alias(ReflectionProvider.class, StrutsConstants.STRUTS_REFLECTIONPROVIDER, builder, props);
+        alias(ReflectionContextFactory.class, StrutsConstants.STRUTS_REFLECTIONCONTEXTFACTORY, builder, props);
         
         if ("true".equalsIgnoreCase(props.getProperty(StrutsConstants.STRUTS_DEVMODE))) {
             props.setProperty(StrutsConstants.STRUTS_I18N_RELOAD, "true");

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/MethodConfigurationProvider.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/MethodConfigurationProvider.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/MethodConfigurationProvider.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/MethodConfigurationProvider.java Thu Sep 20 05:51:41 2007
@@ -27,6 +27,7 @@
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.config.entities.PackageConfig;
 import com.opensymphony.xwork2.inject.ContainerBuilder;
+import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.location.LocatableProperties;
 import com.opensymphony.xwork2.ObjectFactory;
 
@@ -141,25 +142,12 @@
      * Updates ObjectFactory property.
      * @param factory
      */
+    @Inject
     public void setObjectFactory(ObjectFactory factory) {
         this.factory = factory;
     }
 
     /**
-     * Provides ObjectFactory property.
-     * @return
-     * @throws ConfigurationException if ObjectFactory has not been set.
-     */
-    private ObjectFactory getObjectFactory() throws ConfigurationException {
-        if (factory == null) {
-            factory = ObjectFactory.getObjectFactory();
-            if (factory == null) throw new
-                    ConfigurationException("MethodConfigurationProvider.getObjectFactory: ObjectFactory==null");
-        }
-        return factory;
-    }
-
-    /**
      * Verifies that character at a String position is upper case.
      * @param pos Position to test
      * @param string Text containing position
@@ -205,7 +193,6 @@
         String className = actionConfig.getClassName();
         Set actionMethods = new HashSet();
         Class actionClass;
-        ObjectFactory factory = getObjectFactory();
         try {
             actionClass = factory.getClassInstance(className);
         } catch (ClassNotFoundException e) {

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java Thu Sep 20 05:51:41 2007
@@ -40,7 +40,11 @@
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.StrutsStatics;
-import org.apache.struts2.config.*;
+import org.apache.struts2.config.BeanSelectionProvider;
+import org.apache.struts2.config.ClasspathConfigurationProvider;
+import org.apache.struts2.config.DefaultPropertiesProvider;
+import org.apache.struts2.config.LegacyPropertiesConfigurationProvider;
+import org.apache.struts2.config.StrutsXmlConfigurationProvider;
 import org.apache.struts2.config.ClasspathConfigurationProvider.ClasspathPageLocator;
 import org.apache.struts2.config.ClasspathConfigurationProvider.PageLocator;
 import org.apache.struts2.dispatcher.mapper.ActionMapping;
@@ -51,25 +55,26 @@
 import org.apache.struts2.util.ObjectFactoryDestroyable;
 import org.apache.struts2.views.freemarker.FreemarkerManager;
 
-import com.opensymphony.xwork2.util.FileManager;
-import com.opensymphony.xwork2.*;
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionProxy;
+import com.opensymphony.xwork2.ActionProxyFactory;
+import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.Result;
 import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationException;
 import com.opensymphony.xwork2.config.ConfigurationManager;
 import com.opensymphony.xwork2.config.ConfigurationProvider;
 import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
-import com.opensymphony.xwork2.conversion.ObjectTypeDeterminer;
-import com.opensymphony.xwork2.conversion.ObjectTypeDeterminerFactory;
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.ContainerBuilder;
 import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.util.FileManager;
 import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.util.ValueStackFactory;
+import com.opensymphony.xwork2.util.location.LocatableProperties;
 import com.opensymphony.xwork2.util.location.Location;
 import com.opensymphony.xwork2.util.location.LocationUtils;
-import com.opensymphony.xwork2.util.location.LocatableProperties;
 import com.opensymphony.xwork2.util.profiling.UtilTimerStack;
 
 import freemarker.template.Template;
@@ -155,18 +160,6 @@
      */
     public static void setInstance(Dispatcher instance) {
         Dispatcher.instance.set(instance);
-
-        // Tie the ObjectFactory threadlocal instance to this Dispatcher instance
-        if (instance != null) {
-            Container cont = instance.getContainer();
-            if (cont != null) {
-                ObjectFactory.setObjectFactory(cont.getInstance(ObjectFactory.class));
-            } else {
-                LOG.warn("This dispatcher instance doesn't have a container, so the object factory won't be set.");
-            }
-        } else {
-            ObjectFactory.setObjectFactory(null);
-        }
     }
 
     /**
@@ -190,6 +183,8 @@
     private ServletContext servletContext;
     private Map<String, String> initParams;
 
+    private ValueStackFactory valueStackFactory;
+
 
     /**
      * Create the Dispatcher instance for a given ServletContext and set of initialization parameters.
@@ -207,7 +202,7 @@
      * @param mode New setting
      */
     @Inject(StrutsConstants.STRUTS_DEVMODE)
-    public static void setDevMode(String mode) {
+    public void setDevMode(String mode) {
         devMode = "true".equals(mode);
     }
 
@@ -216,7 +211,7 @@
      * @param val New setting
      */
     @Inject(value=StrutsConstants.STRUTS_LOCALE, required=false)
-    public static void setDefaultLocale(String val) {
+    public void setDefaultLocale(String val) {
         defaultLocale = val;
     }
 
@@ -225,7 +220,7 @@
      * @param val New setting
      */
     @Inject(StrutsConstants.STRUTS_I18N_ENCODING)
-    public static void setDefaultEncoding(String val) {
+    public void setDefaultEncoding(String val) {
         defaultEncoding = val;
     }
 
@@ -234,9 +229,14 @@
      * @param val New setting
      */
     @Inject(StrutsConstants.STRUTS_MULTIPART_SAVEDIR)
-    public static void setMultipartSaveDir(String val) {
+    public void setMultipartSaveDir(String val) {
         multipartSaveDir = val;
     }
+    
+    @Inject
+    public void setValueStackFactory(ValueStackFactory valueStackFactory) {
+        this.valueStackFactory = valueStackFactory;
+    }
 
     /**
      * Releases all instances bound to this dispatcher instance.
@@ -392,9 +392,6 @@
         boolean reloadi18n = Boolean.valueOf(container.getInstance(String.class, StrutsConstants.STRUTS_I18N_RELOAD));
         LocalizedTextUtil.setReloadBundles(reloadi18n);
 
-        ObjectTypeDeterminer objectTypeDeterminer = container.getInstance(ObjectTypeDeterminer.class);
-        ObjectTypeDeterminerFactory.setInstance(objectTypeDeterminer);
-
         return container;
     }
 
@@ -444,6 +441,7 @@
         init_AliasStandardObjects() ; // [7]
 
         Container container = init_PreloadConfiguration();
+        container.inject(this);
         init_CheckConfigurationReloading(container);
         init_CheckWebLogicWorkaround(container);
 
@@ -474,7 +472,7 @@
         // If there was a previous value stack, then create a new copy and pass it in to be used by the new Action
         ValueStack stack = (ValueStack) request.getAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY);
         if (stack != null) {
-            extraContext.put(ActionContext.VALUE_STACK, ValueStackFactory.getFactory().createValueStack(stack));
+            extraContext.put(ActionContext.VALUE_STACK, valueStackFactory.createValueStack(stack));
         }
 
         String timerKey = "Handling request from Dispatcher";

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java Thu Sep 20 05:51:41 2007
@@ -161,22 +161,22 @@
     /**
      * Store state of StrutsConstants.STRUTS_SERVE_STATIC_CONTENT setting.
      */
-    private static boolean serveStatic;
+    private boolean serveStatic;
 
     /**
      * Store state of StrutsConstants.STRUTS_SERVE_STATIC_BROWSER_CACHE setting.
      */
-    private static boolean serveStaticBrowserCache;
+    private boolean serveStaticBrowserCache;
 
     /**
      * Store state of StrutsConstants.STRUTS_I18N_ENCODING setting.
      */
-    private static String encoding;
+    private String encoding;
 
     /**
      * Provide ActionMapper instance, set by injection.
      */
-    private static ActionMapper actionMapper;
+    private ActionMapper actionMapper;
 
     /**
      * Provide FilterConfig instance, set on init.
@@ -199,6 +199,7 @@
 
         dispatcher = createDispatcher(filterConfig);
         dispatcher.init();
+        dispatcher.getContainer().inject(this);
 
         String param = filterConfig.getInitParameter("packages");
         String packages = "org.apache.struts2.static template org.apache.struts2.interceptor.debugging";
@@ -244,7 +245,7 @@
      * @param val New setting
      */
     @Inject(StrutsConstants.STRUTS_SERVE_STATIC_CONTENT)
-    public static void setServeStaticContent(String val) {
+    public void setServeStaticContent(String val) {
         serveStatic = "true".equals(val);
     }
 
@@ -253,7 +254,7 @@
      * @param val New setting
      */
     @Inject(StrutsConstants.STRUTS_SERVE_STATIC_BROWSER_CACHE)
-    public static void setServeStaticBrowserCache(String val) {
+    public void setServeStaticBrowserCache(String val) {
         serveStaticBrowserCache = "true".equals(val);
     }
 
@@ -262,7 +263,7 @@
      * @param val New setting
      */
     @Inject(StrutsConstants.STRUTS_I18N_ENCODING)
-    public static void setEncoding(String val) {
+    public void setEncoding(String val) {
         encoding = val;
     }
 
@@ -271,7 +272,7 @@
      * @param mapper New instance
      */
     @Inject
-    public static void setActionMapper(ActionMapper mapper) {
+    public void setActionMapper(ActionMapper mapper) {
         actionMapper = mapper;
     }
 

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java Thu Sep 20 05:51:41 2007
@@ -27,6 +27,8 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.struts2.dispatcher.mapper.ActionMapper;
 import org.apache.struts2.dispatcher.mapper.ActionMapping;
 import org.apache.struts2.views.util.UrlHelper;
@@ -34,6 +36,8 @@
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.config.entities.ResultConfig;
 import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.util.reflection.ReflectionException;
+import com.opensymphony.xwork2.util.reflection.ReflectionExceptionHandler;
 
 /**
  * <!-- START SNIPPET: description -->
@@ -111,12 +115,14 @@
  *
  * @see ActionMapper
  */
-public class ServletActionRedirectResult extends ServletRedirectResult {
+public class ServletActionRedirectResult extends ServletRedirectResult implements ReflectionExceptionHandler {
 
     private static final long serialVersionUID = -9042425229314584066L;
 
     /** The default parameter */
     public static final String DEFAULT_PARAM = "actionName";
+    
+    private static final Log LOG = LogFactory.getLog(ServletActionRedirectResult.class);
 
     protected String actionName;
     protected String namespace;
@@ -223,6 +229,11 @@
     public ServletActionRedirectResult addParameter(String key, Object value) {
         requestParameters.put(key, String.valueOf(value));
         return this;
+    }
+
+    public void handle(ReflectionException ex) {
+        // Only log as debug as they are probably parameters to be appended to the url
+        LOG.debug(ex.getMessage(), ex);
     }
 
 }

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxy.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxy.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxy.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxy.java Thu Sep 20 05:51:41 2007
@@ -23,6 +23,7 @@
 package org.apache.struts2.impl;
 
 import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.DefaultActionProxy;
 
 import java.util.Map;
@@ -31,9 +32,9 @@
 
     private static final long serialVersionUID = -2434901249671934080L;
 
-    public StrutsActionProxy(String namespace, String actionName, Map extraContext,
+    public StrutsActionProxy(ActionInvocation inv, String namespace, String actionName, Map extraContext,
                              boolean executeResult, boolean cleanupContext) throws Exception {
-        super(namespace, actionName, extraContext, executeResult, cleanupContext);
+        super(inv, namespace, actionName, extraContext, executeResult, cleanupContext);
     }
 
     public String execute() throws Exception {

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxyFactory.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxyFactory.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxyFactory.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxyFactory.java Thu Sep 20 05:51:41 2007
@@ -24,19 +24,17 @@
 
 import java.util.Map;
 
+import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.ActionProxy;
+import com.opensymphony.xwork2.DefaultActionInvocation;
+import com.opensymphony.xwork2.DefaultActionProxy;
 import com.opensymphony.xwork2.DefaultActionProxyFactory;
 
 public class StrutsActionProxyFactory extends DefaultActionProxyFactory {
 
-    public ActionProxy createActionProxy(String namespace, String actionName, Map extraContext)
-            throws Exception {
-        return createActionProxy(namespace, actionName, extraContext, true, true);
-    }
-
-    public ActionProxy createActionProxy(String namespace, String actionName, Map extraContext,
-            boolean executeResult, boolean cleanupContext) throws Exception {
-        ActionProxy proxy = new StrutsActionProxy(namespace, actionName, extraContext, executeResult, cleanupContext);
+    public ActionProxy createActionProxy(ActionInvocation inv, String namespace, String actionName, Map extraContext, boolean executeResult, boolean cleanupContext) throws Exception {
+        
+        ActionProxy proxy = new StrutsActionProxy(inv, namespace, actionName, extraContext, executeResult, cleanupContext);
         container.inject(proxy);
         proxy.prepare();
         return proxy;

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java Thu Sep 20 05:51:41 2007
@@ -28,7 +28,6 @@
 import com.opensymphony.xwork2.config.entities.InterceptorConfig;
 import com.opensymphony.xwork2.config.entities.ResultConfig;
 import com.opensymphony.xwork2.interceptor.Interceptor;
-import com.opensymphony.xwork2.util.OgnlUtil;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -51,7 +50,7 @@
             // interceptor instances are long-lived and used across user sessions, so don't try to pass in any extra
             // context
             Object o = buildBean(className, null);
-            OgnlUtil.setProperties(params, o);
+            reflectionProvider.setProperties(params, o);
 
             if (o instanceof Interceptor) {
                 Interceptor interceptor = (Interceptor) o;
@@ -92,7 +91,7 @@
             return null;
 
         Object result = buildBean(resultClassName, extraContext);
-        OgnlUtil.setProperties(resultConfig.getParams(), result, extraContext);
+        reflectionProvider.setProperties(resultConfig.getParams(), result, extraContext);
 
         if (result instanceof Result)
             return (Result) result;

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java Thu Sep 20 05:51:41 2007
@@ -50,6 +50,7 @@
 import com.opensymphony.xwork2.interceptor.Interceptor;
 import com.opensymphony.xwork2.interceptor.PreResultListener;
 import com.opensymphony.xwork2.util.ValueStack;
+import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
 
 /**
  * <!-- START SNIPPET: description -->
@@ -116,6 +117,7 @@
     private FreemarkerManager freemarkerManager;
     
     private boolean consoleEnabled = false;
+    private ReflectionProvider reflectionProvider;
 
     @Inject(StrutsConstants.STRUTS_DEVMODE)
     public void setDevMode(String mode) {
@@ -126,6 +128,11 @@
     public void setFreemarkerManager(FreemarkerManager mgr) {
         this.freemarkerManager = mgr;
     }
+    
+    @Inject
+    public void setReflectionProvider(ReflectionProvider reflectionProvider) {
+        this.reflectionProvider = reflectionProvider;
+    }
 
     /**
      * Unused.
@@ -226,7 +233,7 @@
                             try {
                                 StringWriter writer = new StringWriter();
                                 ObjectToHTMLWriter htmlWriter = new ObjectToHTMLWriter(writer);
-                                htmlWriter.write(rootObject, rootObjectExpression);
+                                htmlWriter.write(reflectionProvider, rootObject, rootObjectExpression);
                                 String html = writer.toString();
                                 writer.close();
                                 

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/debugging/ObjectToHTMLWriter.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/debugging/ObjectToHTMLWriter.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/debugging/ObjectToHTMLWriter.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/debugging/ObjectToHTMLWriter.java Thu Sep 20 05:51:41 2007
@@ -28,9 +28,8 @@
 import java.util.Map;
 import java.util.Set;
 
-import ognl.OgnlException;
-
-import com.opensymphony.xwork2.util.OgnlUtil;
+import com.opensymphony.xwork2.util.reflection.ReflectionException;
+import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
 
 /**
  * Writes an object as a table, where each field can be expanded if it is an Object/Collection/Array
@@ -45,8 +44,8 @@
     }
 
     @SuppressWarnings("unchecked")
-    public void write(Object root, String expr) throws IntrospectionException,
-        OgnlException {
+    public void write(ReflectionProvider reflectionProvider, Object root, String expr) throws IntrospectionException,
+        ReflectionException {
         prettyWriter.startNode("table");
         prettyWriter.addAttribute("class", "debugTable");
 
@@ -76,7 +75,7 @@
             }
         } else {
             //print properties
-            Map<String, Object> properties = OgnlUtil.getBeanMap(root);
+            Map<String, Object> properties = reflectionProvider.getBeanMap(root);
             for (Map.Entry<String, Object> property : properties.entrySet()) {
                 String name = property.getKey();
                 Object value = property.getValue();

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java Thu Sep 20 05:51:41 2007
@@ -26,7 +26,10 @@
 import org.apache.struts2.dispatcher.Dispatcher;
 import org.springframework.mock.web.MockServletContext;
 
+import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.util.LocalizedTextUtil;
+import com.opensymphony.xwork2.util.ValueStack;
+import com.opensymphony.xwork2.util.ValueStackFactory;
 
 /**
  * Generic test setup methods to be used with any unit testing framework. 
@@ -48,10 +51,17 @@
         Dispatcher du = new Dispatcher(new MockServletContext(), params);
         du.init();
         Dispatcher.setInstance(du);
+        
+        // Reset the value stack
+        ValueStack stack = du.getContainer().getInstance(ValueStackFactory.class).createValueStack();
+        stack.getContext().put(ActionContext.CONTAINER, du.getContainer());
+        ActionContext.setContext(new ActionContext(stack.getContext()));
+        
         return du;
     }
 
     public static void tearDown() throws Exception {
         Dispatcher.setInstance(null);
+        ActionContext.setContext(null);
     }
 }

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsUtil.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsUtil.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsUtil.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsUtil.java Thu Sep 20 05:51:41 2007
@@ -44,8 +44,10 @@
 import org.apache.struts2.views.jsp.ui.OgnlTool;
 import org.apache.struts2.views.util.UrlHelper;
 
+import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.util.TextUtils;
 import com.opensymphony.xwork2.util.ValueStack;
+import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ObjectFactory;
 
 
@@ -61,7 +63,7 @@
     protected HttpServletRequest request;
     protected HttpServletResponse response;
     protected Map classes = new Hashtable();
-    protected OgnlTool ognl = OgnlTool.getInstance();
+    protected OgnlTool ognl;
     protected ValueStack stack;
 
 
@@ -69,6 +71,7 @@
         this.stack = stack;
         this.request = request;
         this.response = response;
+        this.ognl = ((Container)stack.getContext().get(ActionContext.CONTAINER)).getInstance(OgnlTool.class);
     }
 
 

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/validators/DWRValidator.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/validators/DWRValidator.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/validators/DWRValidator.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/validators/DWRValidator.java Thu Sep 20 05:51:41 2007
@@ -37,7 +37,9 @@
 import uk.ltd.getahead.dwr.WebContextFactory;
 
 import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.ActionProxy;
+import com.opensymphony.xwork2.ActionProxyFactory;
 import com.opensymphony.xwork2.DefaultActionInvocation;
 import com.opensymphony.xwork2.DefaultActionProxy;
 import com.opensymphony.xwork2.ObjectFactory;
@@ -46,6 +48,7 @@
 import com.opensymphony.xwork2.ValidationAwareSupport;
 import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.inject.Inject;
 
 /**
  * <p/>
@@ -66,6 +69,13 @@
  */
 public class DWRValidator {
     private static final Log LOG = LogFactory.getLog(DWRValidator.class);
+    
+    private ActionProxyFactory actionProxyFactory;
+    
+    @Inject
+    public void setActionProxyFactory(ActionProxyFactory fac) {
+        this.actionProxyFactory = fac;
+    }
 
     public ValidationAwareSupport doPost(String namespace, String action, Map params) throws Exception {
         HttpServletRequest req = WebContextFactory.get().getHttpServletRequest();
@@ -92,9 +102,8 @@
 
         try {
             Configuration cfg = du.getConfigurationManager().getConfiguration();
-            ValidatorActionProxy proxy = new ValidatorActionProxy(namespace, action, ctx);
-            cfg.getContainer().inject(proxy);
-            proxy.prepare();
+            ActionInvocation inv = new ValidatorActionInvocation(ctx, true);
+            ActionProxy proxy = actionProxyFactory.createActionProxy(inv, namespace, action, ctx, true, true);
             proxy.execute();
             Object a = proxy.getAction();
 
@@ -118,8 +127,8 @@
     public static class ValidatorActionInvocation extends DefaultActionInvocation {
         private static final long serialVersionUID = -7645433725470191275L;
 
-        protected ValidatorActionInvocation(ObjectFactory objectFactory, UnknownHandler handler, ActionProxy proxy, Map extraContext) throws Exception {
-            super(objectFactory, handler, proxy, extraContext, true);
+        protected ValidatorActionInvocation(Map extraContext, boolean pushAction) throws Exception {
+            super(extraContext, pushAction);
         }
 
         protected String invokeAction(Object action, ActionConfig actionConfig) throws Exception {
@@ -127,16 +136,4 @@
         }
     }
 
-    public static class ValidatorActionProxy extends DefaultActionProxy {
-        private static final long serialVersionUID = 5754781916414047963L;
-
-        protected ValidatorActionProxy(String namespace, String actionName, Map extraContext) throws Exception {
-            super(namespace, actionName, extraContext, false, true);
-        }
-
-        public void prepare() throws Exception {
-            super.prepare();
-            invocation = new ValidatorActionInvocation(objectFactory, unknownHandler, this, extraContext);
-        }
-    }
 }

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java Thu Sep 20 05:51:41 2007
@@ -52,7 +52,7 @@
         ValueStack stack = (ValueStack) req.getAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY);
 
         if (stack == null) {
-            stack = ValueStackFactory.getFactory().createValueStack();
+            stack = Dispatcher.getInstance().getContainer().getInstance(ValueStackFactory.class).createValueStack();
 
             HttpServletResponse res = (HttpServletResponse) pageContext.getResponse();
             Dispatcher du = Dispatcher.getInstance();

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/OgnlTool.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/OgnlTool.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/OgnlTool.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/OgnlTool.java Thu Sep 20 05:51:41 2007
@@ -23,24 +23,30 @@
 import ognl.Ognl;
 import ognl.OgnlException;
 
-import com.opensymphony.xwork2.util.OgnlUtil;
+import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.ognl.OgnlUtil;
 
 
 /**
  */
 public class OgnlTool {
-    private static OgnlTool instance = new OgnlTool();
 
-    private OgnlTool() {
+    private OgnlUtil ognlUtil;
+    
+    public OgnlTool() {
     }
-
-    public static OgnlTool getInstance() {
-        return instance;
+    
+    @Inject
+    public void setOgnlUtil(OgnlUtil ognlUtil) {
+        this.ognlUtil = ognlUtil;
     }
+    
+    
+
 
     public Object findValue(String expr, Object context) {
         try {
-            return Ognl.getValue(OgnlUtil.compile(expr), context);
+            return Ognl.getValue(ognlUtil.compile(expr), context);
         } catch (OgnlException e) {
             return null;
         }

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java Thu Sep 20 05:51:41 2007
@@ -32,6 +32,8 @@
 
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
+import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ValueStack;
 
@@ -51,13 +53,6 @@
     public static final String STRUTS = "struts";
     public static final String ACTION = "action";
     
-    public static boolean altSyntax;
-    
-    @Inject(StrutsConstants.STRUTS_TAG_ALTSYNTAX)
-    public static void setAltSyntax(String val) {
-        altSyntax = "true".equals(val);
-    }
-
     public static Map getStandardContext(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
         HashMap map = new HashMap();
         map.put(REQUEST, req);
@@ -67,7 +62,7 @@
         map.put(SESSION, req.getSession(false));
         map.put(BASE, req.getContextPath());
         map.put(STACK, stack);
-        map.put(OGNL, OgnlTool.getInstance());
+        map.put(OGNL, ((Container)stack.getContext().get(ActionContext.CONTAINER)).getInstance(OgnlTool.class));
         map.put(STRUTS, new StrutsUtil(stack, req, res));
 
         ActionInvocation invocation = (ActionInvocation) stack.getContext().get(ActionContext.ACTION_INVOCATION);
@@ -86,12 +81,12 @@
         // We didn't make altSyntax static cause, if so, struts.configuration.xml.reload will not work
         // plus the Configuration implementation should cache the properties, which the framework's
         // configuration implementation does
-        return altSyntax ||(
+        return "true".equals(((Container)context.get(ActionContext.CONTAINER)).getInstance(String.class, StrutsConstants.STRUTS_TAG_ALTSYNTAX)) ||(
                 (context.containsKey("useAltSyntax") &&
                         context.get("useAltSyntax") != null &&
                         "true".equals(context.get("useAltSyntax").toString())));
     }
-
+    
     /**
      * Returns a String for overriding the default templateSuffix if templateSuffix is on the stack
      * @param context stack's context

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/util/UrlHelper.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/util/UrlHelper.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/util/UrlHelper.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/util/UrlHelper.java Thu Sep 20 05:51:41 2007
@@ -38,6 +38,8 @@
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.StrutsConstants;
 
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.TextParseUtil;
 import com.opensymphony.xwork2.util.ValueStack;
@@ -62,25 +64,6 @@
 
     private static final String AMP = "&amp;";
 
-    private static int httpPort = DEFAULT_HTTP_PORT;
-    private static int httpsPort = DEFAULT_HTTPS_PORT;
-    private static String customEncoding;
-
-    @Inject(StrutsConstants.STRUTS_URL_HTTP_PORT)
-    public static void setHttpPort(String val) {
-        httpPort = Integer.parseInt(val);
-    }
-
-    @Inject(StrutsConstants.STRUTS_URL_HTTPS_PORT)
-    public static void setHttpsPort(String val) {
-        httpsPort = Integer.parseInt(val);
-    }
-
-    @Inject(StrutsConstants.STRUTS_I18N_ENCODING)
-    public static void setCustomEncoding(String val) {
-        customEncoding = val;
-    }
-
     public static String buildUrl(String action, HttpServletRequest request, HttpServletResponse response, Map params) {
         return buildUrl(action, request, response, params, null, true, true);
     }
@@ -97,6 +80,11 @@
         StringBuffer link = new StringBuffer();
 
         boolean changedScheme = false;
+        
+        // FIXME: temporary hack until class is made a properly injected bean
+        Container cont = ActionContext.getContext().getContainer();
+        int httpPort = Integer.parseInt(cont.getInstance(String.class, StrutsConstants.STRUTS_URL_HTTP_PORT));
+        int httpsPort = Integer.parseInt(cont.getInstance(String.class, StrutsConstants.STRUTS_URL_HTTPS_PORT));
 
         // only append scheme if it is different to the current scheme *OR*
         // if we explicity want it to be appended by having forceAddSchemeHostAndPort = true
@@ -301,6 +289,11 @@
 
     private static String getEncodingFromConfiguration() {
         final String encoding;
+        
+        // FIXME: temporary hack until class is made a properly injected bean
+        Container cont = ActionContext.getContext().getContainer();
+        String customEncoding = cont.getInstance(String.class, StrutsConstants.STRUTS_I18N_ENCODING);
+        
         if (customEncoding != null) {
             encoding = customEncoding;
         } else {

Modified: struts/struts2/trunk/core/src/main/resources/struts-default.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/struts-default.xml?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/struts-default.xml (original)
+++ struts/struts2/trunk/core/src/main/resources/struts-default.xml Thu Sep 20 05:51:41 2007
@@ -57,22 +57,45 @@
 
     <bean type="com.opensymphony.xwork2.conversion.impl.XWorkConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.XWorkConverter" />
     <bean type="com.opensymphony.xwork2.conversion.impl.XWorkConverter" name="xwork1" class="com.opensymphony.xwork2.conversion.impl.XWorkConverter" />
+    <bean class="com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter" />
 
     <bean type="com.opensymphony.xwork2.TextProvider" name="xwork1" class="com.opensymphony.xwork2.TextProviderSupport" />
     <bean type="com.opensymphony.xwork2.TextProvider" name="struts" class="com.opensymphony.xwork2.TextProviderSupport" />
 
 	<bean type="org.apache.struts2.components.UrlRenderer" name="struts" class="org.apache.struts2.components.ServletUrlRenderer"/>
-	
-    <!--  Only have static injections -->
-    <bean class="com.opensymphony.xwork2.ObjectFactory" static="true" />
-    <bean class="com.opensymphony.xwork2.conversion.impl.XWorkConverter" static="true" />
-    <bean class="com.opensymphony.xwork2.util.OgnlValueStack" static="true" />
-    <bean class="org.apache.struts2.dispatcher.Dispatcher" static="true" />
-    <bean class="org.apache.struts2.components.Include" static="true" />
-    <bean class="org.apache.struts2.dispatcher.FilterDispatcher" static="true" />
-    <bean class="org.apache.struts2.views.util.ContextUtil" static="true" />
-    <bean class="org.apache.struts2.views.util.UrlHelper" static="true" />
 
+	<bean type="com.opensymphony.xwork2.util.ValueStackFactory" name="struts" class="com.opensymphony.xwork2.ognl.OgnlValueStackFactory" />
+	<bean type="com.opensymphony.xwork2.util.reflection.ReflectionProvider" name="struts" class="com.opensymphony.xwork2.ognl.OgnlReflectionProvider" />	
+	<bean type="com.opensymphony.xwork2.util.reflection.ReflectionContextFactory" name="struts" class="com.opensymphony.xwork2.ognl.OgnlReflectionContextFactory" />
+	
+	<bean type="com.opensymphony.xwork2.TextProvider" name="system" class="com.opensymphony.xwork2.DefaultTextProvider" />
+	<bean type="com.opensymphony.xwork2.conversion.NullHandler" name="java.lang.Object" class="com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler" />
+	
+	<bean type="com.opensymphony.xwork2.validator.ActionValidatorManager" name="struts" class="com.opensymphony.xwork2.validator.AnnotationActionValidatorManager" />
+	<bean type="com.opensymphony.xwork2.validator.ActionValidatorManager" name="no-annotations" class="com.opensymphony.xwork2.validator.DefaultActionValidatorManager" />
+	
+	<bean class="com.opensymphony.xwork2.ognl.OgnlUtil" />
+	
+	<bean type="ognl.PropertyAccessor" name="com.opensymphony.xwork2.util.CompoundRoot" class="com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor" />
+	<bean type="ognl.PropertyAccessor" name="java.lang.Object" class="com.opensymphony.xwork2.ognl.accessor.ObjectAccessor" />
+	<bean type="ognl.PropertyAccessor" name="java.util.Iterator" class="com.opensymphony.xwork2.ognl.accessor.XWorkIteratorPropertyAccessor" />
+	<bean type="ognl.PropertyAccessor" name="java.util.Enumeration" class="com.opensymphony.xwork2.ognl.accessor.XWorkEnumerationAccessor" />
+	<bean type="ognl.PropertyAccessor" name="java.util.List" class="com.opensymphony.xwork2.ognl.accessor.XWorkListPropertyAccessor" />
+	<bean type="ognl.PropertyAccessor" name="java.util.Set" class="com.opensymphony.xwork2.ognl.accessor.XWorkCollectionPropertyAccessor" />
+	<bean type="ognl.PropertyAccessor" name="java.util.Map" class="com.opensymphony.xwork2.ognl.accessor.XWorkMapPropertyAccessor" />
+	<bean type="ognl.PropertyAccessor" name="java.util.Collection" class="com.opensymphony.xwork2.ognl.accessor.XWorkCollectionPropertyAccessor" />
+	<bean type="ognl.PropertyAccessor" name="com.opensymphony.xwork2.ognl.ObjectProxy" class="com.opensymphony.xwork2.ognl.accessor.ObjectProxyPropertyAccessor" />
+	
+	<bean type="ognl.MethodAccessor" name="java.lang.Object" class="com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor" />
+	<bean type="ognl.MethodAccessor" name="com.opensymphony.xwork2.util.CompoundRoot" class="com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor" />
+	
+	<bean class="org.apache.struts2.views.jsp.ui.OgnlTool" />
+	
+	<!--  Silly workarounds for OGNL since there is currently no way to flush its internal caches -->
+	<bean type="ognl.PropertyAccessor" name="java.util.ArrayList" class="com.opensymphony.xwork2.ognl.accessor.XWorkListPropertyAccessor" />
+	<bean type="ognl.PropertyAccessor" name="java.util.HashSet" class="com.opensymphony.xwork2.ognl.accessor.XWorkCollectionPropertyAccessor" />
+	<bean type="ognl.PropertyAccessor" name="java.util.HashMap" class="com.opensymphony.xwork2.ognl.accessor.XWorkMapPropertyAccessor" />
+               
     <package name="struts-default" abstract="true">
         <result-types>
             <result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/>

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/FormButtonTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/FormButtonTest.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/FormButtonTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/FormButtonTest.java Thu Sep 20 05:51:41 2007
@@ -24,6 +24,7 @@
 import org.springframework.mock.web.MockHttpServletRequest;
 import org.springframework.mock.web.MockHttpServletResponse;
 
+import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.util.ValueStackFactory;
 
@@ -36,7 +37,7 @@
     public void testPopulateComponentHtmlId1() throws Exception {
         MockHttpServletRequest req = new MockHttpServletRequest();
         MockHttpServletResponse res = new MockHttpServletResponse();
-        ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        ValueStack stack = ActionContext.getContext().getValueStack();
 
         Form form = new Form(stack, req, res);
         form.getParameters().put("id", "formId");
@@ -52,7 +53,7 @@
     public void testPopulateComponentHtmlId2() throws Exception {
         MockHttpServletRequest req = new MockHttpServletRequest();
         MockHttpServletResponse res = new MockHttpServletResponse();
-        ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        ValueStack stack = ActionContext.getContext().getValueStack();
 
         Form form = new Form(stack, req, res);
         form.getParameters().put("id", "formId");
@@ -68,7 +69,7 @@
     public void testPopulateComponentHtmlId3() throws Exception {
         MockHttpServletRequest req = new MockHttpServletRequest();
         MockHttpServletResponse res = new MockHttpServletResponse();
-        ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        ValueStack stack = ActionContext.getContext().getValueStack();
 
         Form form = new Form(stack, req, res);
         form.getParameters().put("id", "formId");
@@ -85,7 +86,7 @@
     public void testPopulateComponentHtmlId4() throws Exception {
         MockHttpServletRequest req = new MockHttpServletRequest();
         MockHttpServletResponse res = new MockHttpServletResponse();
-        ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        ValueStack stack = ActionContext.getContext().getValueStack();
 
         Submit submit = new Submit(stack, req, res);
         submit.setId("submitId");
@@ -98,7 +99,7 @@
     public void testPopulateComponentHtmlId5() throws Exception {
         MockHttpServletRequest req = new MockHttpServletRequest();
         MockHttpServletResponse res = new MockHttpServletResponse();
-        ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        ValueStack stack = ActionContext.getContext().getValueStack();
 
         Submit submit = new Submit(stack, req, res);
         submit.setName("submitName");
@@ -111,7 +112,7 @@
     public void testPopulateComponentHtmlId6() throws Exception {
         MockHttpServletRequest req = new MockHttpServletRequest();
         MockHttpServletResponse res = new MockHttpServletResponse();
-        ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        ValueStack stack = ActionContext.getContext().getValueStack();
 
         Submit submit = new Submit(stack, req, res);
         submit.setAction("submitAction");

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/FormTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/FormTest.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/FormTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/FormTest.java Thu Sep 20 05:51:41 2007
@@ -36,6 +36,7 @@
 
     public void testTestFormGetValidators() {
         Form form = new Form(stack, request, response);
+        container.inject(form);
         form.getParameters().put("actionClass", TestAction.class);
         List v = form.getValidators("foo");
         assertEquals(1, v.size());

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/PropertyTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/PropertyTest.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/PropertyTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/PropertyTest.java Thu Sep 20 05:51:41 2007
@@ -26,8 +26,10 @@
 import junit.framework.TestCase;
 import ognl.Ognl;
 
+import org.apache.struts2.StrutsTestCase;
 import org.apache.struts2.util.StrutsTypeConverter;
 
+import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.util.ValueStackFactory;
@@ -35,9 +37,9 @@
 /**
  *
  */
-public class PropertyTest extends TestCase {
+public class PropertyTest extends StrutsTestCase {
     public void testNormalBehaviour() {
-        final ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        final ValueStack stack = ActionContext.getContext().getValueStack();
         stack.push(new FooBar("foo-value", "bar-value"));
         final Property property = new Property(stack);
         property.setDefault("default");
@@ -46,7 +48,7 @@
     }
 
     public void testDefaultShouldBeOutputIfBeanNotAvailable() {
-        final ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        final ValueStack stack = ActionContext.getContext().getValueStack();
         final Property property = new Property(stack);
         property.setDefault("default");
         property.setValue("foo");
@@ -54,7 +56,7 @@
     }
 
     public void testDefaultShouldBeOutputIfPropertyIsNull() {
-        final ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        final ValueStack stack = ActionContext.getContext().getValueStack();
         stack.push(new FooBar(null, "bar-value"));
         final Property property = new Property(stack);
         property.setDefault("default");
@@ -63,7 +65,7 @@
     }
 
     public void testTopValueShouldReturnTopOfValueStack() {
-        final ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        final ValueStack stack = ActionContext.getContext().getValueStack();
         stack.push(new FooBar("foo-value", "bar-value"));
         final Property property = new Property(stack);
         property.setDefault("default");
@@ -72,7 +74,7 @@
     }
 
     public void testTypeConverterShouldBeUsed() {
-        final ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        final ValueStack stack = ActionContext.getContext().getValueStack();
         Ognl.setTypeConverter(stack.getContext(), new TestDefaultConverter());
 
         stack.push(new FooBar("foo-value", "bar-value"));
@@ -83,7 +85,7 @@
     }
 
     public void testTypeConverterReturningNullShouldLeadToDisplayOfDefaultValue() {
-        final ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        final ValueStack stack = ActionContext.getContext().getValueStack();
         Ognl.setTypeConverter(stack.getContext(), new TestDefaultConverter());
 
         stack.push(new FooBar("foo-value", null));

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/UIBeanTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/UIBeanTest.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/UIBeanTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/UIBeanTest.java Thu Sep 20 05:51:41 2007
@@ -24,6 +24,7 @@
 import org.springframework.mock.web.MockHttpServletRequest;
 import org.springframework.mock.web.MockHttpServletResponse;
 
+import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.util.ValueStackFactory;
 
@@ -34,7 +35,7 @@
 public class UIBeanTest extends StrutsTestCase {
 
     public void testPopulateComponentHtmlId1() throws Exception {
-        ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        ValueStack stack = ActionContext.getContext().getValueStack();
         MockHttpServletRequest req = new MockHttpServletRequest();
         MockHttpServletResponse res = new MockHttpServletResponse();
 
@@ -50,7 +51,7 @@
     }
     
     public void testPopulateComponentHtmlIdWithOgnl() throws Exception {
-        ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        ValueStack stack = ActionContext.getContext().getValueStack();
         MockHttpServletRequest req = new MockHttpServletRequest();
         MockHttpServletResponse res = new MockHttpServletResponse();
 
@@ -66,7 +67,7 @@
     }
 
     public void testPopulateComponentHtmlId2() throws Exception {
-        ValueStack stack = ValueStackFactory.getFactory().createValueStack();
+        ValueStack stack = ActionContext.getContext().getValueStack();
         MockHttpServletRequest req = new MockHttpServletRequest();
         MockHttpServletResponse res = new MockHttpServletResponse();
 

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/config/MethodConfigurationProviderTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/config/MethodConfigurationProviderTest.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/config/MethodConfigurationProviderTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/config/MethodConfigurationProviderTest.java Thu Sep 20 05:51:41 2007
@@ -29,6 +29,7 @@
 import com.opensymphony.xwork2.config.entities.*;
 import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
 import com.opensymphony.xwork2.ActionSupport;
+import com.opensymphony.xwork2.ObjectFactory;
 
 import junit.framework.TestCase;
 
@@ -61,7 +62,6 @@
      * Creates a mock Dispatcher and seeds Configuration.
      */
     public void setUp() {
-
         InternalConfigurationManager configurationManager = new InternalConfigurationManager();
         dispatcher = new Dispatcher(new MockServletContext(), new HashMap<String, String>());
         dispatcher.setConfigurationManager(configurationManager);
@@ -93,6 +93,7 @@
 
         provider = new MethodConfigurationProvider();
         provider.init(configuration);
+        provider.setObjectFactory(new ObjectFactory());
         provider.loadPackages();
     }
 

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java Thu Sep 20 05:51:41 2007
@@ -23,16 +23,31 @@
 import java.util.HashMap;
 import java.util.Locale;
 
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.StrutsTestCase;
+import org.apache.struts2.dispatcher.FilterDispatcherTest.InnerActionMapper;
+import org.apache.struts2.dispatcher.FilterDispatcherTest.InnerDestroyableObjectFactory;
+import org.apache.struts2.dispatcher.FilterDispatcherTest.InnerDispatcher;
+import org.springframework.mock.web.MockFilterConfig;
 import org.springframework.mock.web.MockHttpServletRequest;
 import org.springframework.mock.web.MockHttpServletResponse;
 import org.springframework.mock.web.MockServletContext;
 
+import com.mockobjects.dynamic.C;
+import com.mockobjects.dynamic.Mock;
+import com.mockobjects.servlet.MockFilterChain;
+import com.opensymphony.xwork2.ObjectFactory;
+import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationManager;
+import com.opensymphony.xwork2.inject.Container;
+import com.opensymphony.xwork2.inject.ContainerBuilder;
+import com.opensymphony.xwork2.inject.Context;
+import com.opensymphony.xwork2.inject.Factory;
 import com.opensymphony.xwork2.util.LocalizedTextUtil;
 
 /**
@@ -129,6 +144,27 @@
     	finally {
     		du.setInstance(null);
     	}
+    }
+    
+    public void testObjectFactoryDestroy() throws Exception {
+
+        final InnerDestroyableObjectFactory destroyedObjectFactory = new InnerDestroyableObjectFactory();
+        Dispatcher du = new Dispatcher(new MockServletContext(), new HashMap<String, String>());
+        ConfigurationManager cm = new ConfigurationManager();
+        Mock mockConfiguration = new Mock(Configuration.class);
+        cm.setConfiguration((Configuration)mockConfiguration.proxy());
+        
+        Mock mockContainer = new Mock(Container.class);
+        mockConfiguration.expectAndReturn("getContainer", mockContainer.proxy());
+        mockContainer.expectAndReturn("getInstance", C.args(C.eq(ObjectFactory.class)), destroyedObjectFactory);
+        mockConfiguration.expect("destroy");
+        
+        du.setConfigurationManager(cm);
+        assertFalse(destroyedObjectFactory.destroyed);
+        du.cleanup();
+        assertTrue(destroyedObjectFactory.destroyed);
+        mockConfiguration.verify();
+        mockContainer.verify();
     }
     
     class InternalConfigurationManager extends ConfigurationManager {

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/FilterDispatcherTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/FilterDispatcherTest.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/FilterDispatcherTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/FilterDispatcherTest.java Thu Sep 20 05:51:41 2007
@@ -83,32 +83,7 @@
         assertEquals(result4[3], "foo/bar/package4/");
     }
 
-    public void testObjectFactoryDestroy() throws Exception {
-
-        final InnerDestroyableObjectFactory destroyedObjectFactory = new InnerDestroyableObjectFactory();
-        FilterDispatcher filterDispatcher = new FilterDispatcher() {
-            @Override
-            protected Dispatcher createDispatcher(FilterConfig cfg) {
-                return new Dispatcher(cfg.getServletContext(), new HashMap()) {
-                    Container cont = new ContainerBuilder()
-                        .factory(ObjectFactory.class, new Factory() {
-                            public Object create(Context context) throws Exception { return destroyedObjectFactory; }
-                        })
-                        .create(false);
-                    
-                    @Override
-                    public Container getContainer() {
-                        return cont;
-                    }
-                };
-            }
-        };
-        filterDispatcher.init(new MockFilterConfig((ServletContext) null));
-        
-        assertFalse(destroyedObjectFactory.destroyed);
-        filterDispatcher.destroy();
-        assertTrue(destroyedObjectFactory.destroyed);
-    }
+    
 
     public void testIfActionMapperIsNullDontServiceAction() throws Exception {
         MockServletContext servletContext = new MockServletContext();
@@ -125,8 +100,6 @@
         
 
 
-        ObjectFactory.setObjectFactory(new InnerObjectFactory());
-
         FilterDispatcher filter = new FilterDispatcher() {
             protected Dispatcher createDispatcher() {
                 return _dispatcher;
@@ -138,7 +111,7 @@
 
         assertFalse(_dispatcher.serviceRequest);
     }
-
+    
     public void testCharacterEncodingSetBeforeRequestWrappingAndActionService() throws Exception {
         MockServletContext servletContext = new MockServletContext();
         MockFilterConfig filterConfig = new MockFilterConfig(servletContext);
@@ -148,20 +121,6 @@
         final InnerDispatcher _dispatcher = new InnerDispatcher(servletContext);
         Dispatcher.setInstance(null);
 
-        DefaultConfiguration conf = new DefaultConfiguration() {
-        	@Override
-        	public Container getContainer() {
-        		return new ContainerBuilder().create(false);
-        	}
-        };
-       
-        ConfigurationManager confManager = new ConfigurationManager();
-        confManager.setConfiguration(conf);
-        _dispatcher.setConfigurationManager(confManager);
-
-
-        ObjectFactory.setObjectFactory(new InnerObjectFactory());
-
         _dispatcher.setDefaultEncoding("UTF-16_DUMMY");
 
         FilterDispatcher filter = new FilterDispatcher() {
@@ -171,13 +130,13 @@
         };
         filter.setActionMapper(new InnerActionMapper());
         filter.init(filterConfig);
+        _dispatcher.setDefaultEncoding("UTF-16_DUMMY");
         filter.doFilter(req, res, chain);
 
         assertTrue(_dispatcher.wrappedRequest);
         assertTrue(_dispatcher.serviceRequest);
     }
 
-
     // === inner class ========
     public static class InnerObjectFactory extends ObjectFactory {
 
@@ -217,7 +176,7 @@
             // if we set the chracter encoding AFTER we do wrap request, we will get
             // a failing test
             assertNotNull(request.getCharacterEncoding());
-            assertEquals(request.getCharacterEncoding(), "UTF-16_DUMMY");
+            assertEquals("UTF-16_DUMMY", request.getCharacterEncoding());
 
             return request;
         }
@@ -227,7 +186,7 @@
             // if we set the chracter encoding AFTER we do wrap request, we will get
             // a failing test
             assertNotNull(request.getCharacterEncoding());
-            assertEquals(request.getCharacterEncoding(), "UTF-16_DUMMY");
+            assertEquals("UTF-16_DUMMY", request.getCharacterEncoding());
         }
     }
 

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/FilterTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/FilterTest.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/FilterTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/FilterTest.java Thu Sep 20 05:51:41 2007
@@ -33,6 +33,7 @@
 
 import junit.framework.TestCase;
 
+import org.apache.struts2.StrutsTestCase;
 import org.apache.struts2.dispatcher.mapper.ActionMapper;
 import org.apache.struts2.dispatcher.mapper.ActionMapping;
 import org.springframework.mock.web.MockFilterConfig;
@@ -50,7 +51,7 @@
  *
  * @version $Date$ $Id$
  */
-public class FilterTest extends TestCase {
+public class FilterTest extends StrutsTestCase {
 
     protected MockFilterConfig filterConfig;
     protected MockHttpServletRequest request;
@@ -70,6 +71,7 @@
 
     @Override
     protected void tearDown() throws Exception {
+        super.tearDown();
         filterConfig = null;
         request = null;
         response = null;
@@ -84,6 +86,7 @@
 
     @Override
     protected void setUp() throws Exception {
+        super.setUp();
         Dispatcher.setInstance(null);
 
         filterConfig = new MockFilterConfig();
@@ -145,7 +148,7 @@
         assertFalse(_dispatcher2.service);
 
         filterDispatcher.init(filterConfig);
-        FilterDispatcher.setActionMapper(new FilterTest.InnerMapper());
+        filterDispatcher.setActionMapper(new FilterTest.InnerMapper());
         filterDispatcher.doFilter(request, response, filterChain2);
         filterDispatcher.destroy();
 
@@ -180,7 +183,7 @@
         assertFalse(_dispatcher2.cleanUp);
 
         filterDispatcher.init(filterConfig);
-        FilterDispatcher.setActionMapper(new FilterTest.InnerMapper());
+        filterDispatcher.setActionMapper(new FilterTest.InnerMapper());
         filterDispatcher.doFilter(request, response, filterChain2);
         filterDispatcher.doFilter(request, response, filterChain2);
         filterDispatcher.destroy();
@@ -296,7 +299,7 @@
         
         @Override 
         public Container getContainer() {
-            return null;
+            return container;
         }
 
         @Override

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/HttpHeaderResultTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/HttpHeaderResultTest.java?rev=577728&r1=577727&r2=577728&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/HttpHeaderResultTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/HttpHeaderResultTest.java Thu Sep 20 05:51:41 2007
@@ -32,7 +32,8 @@
 import com.mockobjects.dynamic.Mock;
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.util.OgnlUtil;
+import com.opensymphony.xwork2.ognl.OgnlUtil;
+import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
 
 
 /**
@@ -45,6 +46,7 @@
     HttpHeaderResult result;
     HttpServletResponse response;
     Mock responseMock;
+    ReflectionProvider reflectionProvider;
 
 
     public void testHeaderValuesAreNotParsedWhenParseIsFalse() throws Exception {
@@ -56,7 +58,7 @@
         values.put("bar", "abc");
         ActionContext.getContext().getValueStack().push(values);
 
-        OgnlUtil.setProperties(params, result);
+        reflectionProvider.setProperties(params, result);
 
         responseMock.expect("addHeader", C.args(C.eq("foo"), C.eq("${bar}")));
         responseMock.expect("addHeader", C.args(C.eq("baz"), C.eq("baz")));
@@ -74,7 +76,7 @@
         values.put("bar", "abc");
         ActionContext.getContext().getValueStack().push(values);
 
-        OgnlUtil.setProperties(params, result);
+        reflectionProvider.setProperties(params, result);
 
         responseMock.expect("addHeader", C.args(C.eq("foo"), C.eq("abc")));
         responseMock.expect("addHeader", C.args(C.eq("baz"), C.eq("baz")));
@@ -123,12 +125,12 @@
         responseMock = new Mock(HttpServletResponse.class);
         response = (HttpServletResponse) responseMock.proxy();
         invocation = (ActionInvocation) new Mock(ActionInvocation.class).proxy();
+        reflectionProvider = container.getInstance(ReflectionProvider.class);
         ServletActionContext.setResponse(response);
     }
 
     protected void tearDown() throws Exception {
         super.tearDown();
-        ServletActionContext.setResponse(null);
         ActionContext.setContext(null);
     }
 }



Mime
View raw message