mirror of
https://github.com/apache/struts.git
synced 2026-08-07 07:37:20 +00:00
WW-3714 Moves all classes from com.opensymphony.xwork2 into org.apache.struts2
This commit is contained in:
+3
-3
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
package org.apache.struts2.spring;
|
||||
|
||||
import com.opensymphony.xwork2.util.classloader.FileResourceStore;
|
||||
import com.opensymphony.xwork2.util.classloader.JarResourceStore;
|
||||
import com.opensymphony.xwork2.util.classloader.ReloadingClassLoader;
|
||||
import org.apache.struts2.util.classloader.FileResourceStore;
|
||||
import org.apache.struts2.util.classloader.JarResourceStore;
|
||||
import org.apache.struts2.util.classloader.ReloadingClassLoader;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.commons.jci.monitor.FilesystemAlterationListener;
|
||||
|
||||
+4
-5
@@ -16,11 +16,10 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2.spring;
|
||||
package org.apache.struts2.spring;
|
||||
|
||||
import com.opensymphony.xwork2.ObjectFactory;
|
||||
import com.opensymphony.xwork2.inject.Container;
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import org.apache.struts2.ObjectFactory;
|
||||
import org.apache.struts2.inject.Inject;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -161,7 +160,7 @@ public class SpringObjectFactory extends ObjectFactory implements ApplicationCon
|
||||
@Override
|
||||
public Object buildBean(String beanName, Map<String, Object> extraContext, boolean injectInternal) throws Exception {
|
||||
Object o;
|
||||
|
||||
|
||||
if (appContext.containsBean(beanName)) {
|
||||
o = appContext.getBean(beanName);
|
||||
if (injectInternal) {
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2.spring;
|
||||
package org.apache.struts2.spring;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+5
-5
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
package org.apache.struts2.spring;
|
||||
|
||||
import com.opensymphony.xwork2.inject.Container;
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.spring.SpringObjectFactory;
|
||||
import org.apache.struts2.inject.Container;
|
||||
import org.apache.struts2.inject.Inject;
|
||||
import org.apache.struts2.spring.SpringObjectFactory;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -68,7 +68,7 @@ public class StrutsSpringObjectFactory extends SpringObjectFactory {
|
||||
@Inject ServletContext servletContext,
|
||||
@Inject(StrutsConstants.STRUTS_DEVMODE) String devMode,
|
||||
@Inject Container container) {
|
||||
|
||||
|
||||
boolean useClassCache = BooleanUtils.toBoolean(useClassCacheStr);
|
||||
LOG.info("Initializing Struts-Spring integration...");
|
||||
|
||||
@@ -93,7 +93,7 @@ public class StrutsSpringObjectFactory extends SpringObjectFactory {
|
||||
LOG.fatal(message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String watchList = container.getInstance(String.class, SpringConstants.STRUTS_OBJECTFACTORY_SPRING_CLASS_RELOADING_WATCH_LIST);
|
||||
String acceptClasses = container.getInstance(String.class, SpringConstants.STRUTS_OBJECTFACTORY_SPRING_CLASS_RELOADING_ACCEPT_CLASSES);
|
||||
String reloadConfig = container.getInstance(String.class, SpringConstants.STRUTS_OBJECTFACTORY_SPRING_CLASS_RELOADING_RELOAD_CONFIG);
|
||||
|
||||
+5
-5
@@ -16,12 +16,12 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2.spring.interceptor;
|
||||
package org.apache.struts2.spring.interceptor;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
|
||||
import com.opensymphony.xwork2.spring.SpringObjectFactory;
|
||||
import org.apache.struts2.ActionContext;
|
||||
import org.apache.struts2.ActionInvocation;
|
||||
import org.apache.struts2.interceptor.AbstractInterceptor;
|
||||
import org.apache.struts2.spring.SpringObjectFactory;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.BeansException;
|
||||
@@ -20,25 +20,26 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
|
||||
<struts>
|
||||
<bean type="com.opensymphony.xwork2.ObjectFactory" name="spring" class="org.apache.struts2.spring.StrutsSpringObjectFactory" />
|
||||
<bean type="org.apache.struts2.ObjectFactory" name="spring"
|
||||
class="org.apache.struts2.spring.StrutsSpringObjectFactory"/>
|
||||
|
||||
<!-- Make the Spring object factory the automatic default -->
|
||||
<constant name="struts.objectFactory" value="spring" />
|
||||
<constant name="struts.objectFactory" value="spring"/>
|
||||
|
||||
<constant name="struts.objectFactory.spring.class.reloading.watchList" value="" />
|
||||
<constant name="struts.objectFactory.spring.class.reloading.acceptClasses" value="" />
|
||||
<constant name="struts.objectFactory.spring.class.reloading.reloadConfig" value="false" />
|
||||
<constant name="struts.objectFactory.spring.class.reloading.watchList" value=""/>
|
||||
<constant name="struts.objectFactory.spring.class.reloading.acceptClasses" value=""/>
|
||||
<constant name="struts.objectFactory.spring.class.reloading.reloadConfig" value="false"/>
|
||||
|
||||
<constant name="struts.disallowProxyMemberAccess" value="true" />
|
||||
<constant name="struts.json.result.excludeProxyProperties" value="true" />
|
||||
<constant name="struts.disallowProxyMemberAccess" value="true"/>
|
||||
<constant name="struts.json.result.excludeProxyProperties" value="true"/>
|
||||
|
||||
<package name="spring-default">
|
||||
<interceptors>
|
||||
<interceptor name="autowiring" class="com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor"/>
|
||||
<interceptor name="autowiring" class="org.apache.struts2.spring.interceptor.ActionAutowiringInterceptor"/>
|
||||
</interceptors>
|
||||
</package>
|
||||
</struts>
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.test;
|
||||
|
||||
public class SecurityMemberAccessProxyTest extends com.opensymphony.xwork2.ognl.SecurityMemberAccessProxyTest {
|
||||
}
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2;
|
||||
package org.apache.struts2;
|
||||
|
||||
|
||||
import org.apache.struts2.interceptor.parameter.StrutsParameter;
|
||||
+13
-16
@@ -16,13 +16,10 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2;
|
||||
package org.apache.struts2;
|
||||
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import com.opensymphony.xwork2.Result;
|
||||
import com.opensymphony.xwork2.config.Configuration;
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import org.apache.struts2.config.Configuration;
|
||||
import org.apache.struts2.inject.Inject;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -35,7 +32,7 @@ import java.util.*;
|
||||
*/
|
||||
public class SimpleAction extends ActionSupport {
|
||||
|
||||
public static final String COMMAND_RETURN_CODE = "com.opensymphony.xwork2.SimpleAction.CommandInvoked";
|
||||
public static final String COMMAND_RETURN_CODE = "org.apache.struts2.SimpleAction.CommandInvoked";
|
||||
|
||||
|
||||
private ArrayList<String> someList = new ArrayList<>();
|
||||
@@ -59,7 +56,7 @@ public class SimpleAction extends ActionSupport {
|
||||
private Map<String, String> existingMap = new HashMap<>();
|
||||
|
||||
private List<TestBean> beanList;
|
||||
|
||||
|
||||
public static boolean resultCalled;
|
||||
|
||||
|
||||
@@ -67,11 +64,11 @@ public class SimpleAction extends ActionSupport {
|
||||
resultCalled = false;
|
||||
existingMap.put("existingKey", "value");
|
||||
}
|
||||
|
||||
|
||||
public Map<String,String> getTheProtectedMap() {
|
||||
return protectedMap;
|
||||
}
|
||||
|
||||
|
||||
protected Map<String,String> getTheSemiProtectedMap() {
|
||||
return protectedMap;
|
||||
}
|
||||
@@ -190,15 +187,15 @@ public class SimpleAction extends ActionSupport {
|
||||
public ArrayList<String> getSomeList() {
|
||||
return someList;
|
||||
}
|
||||
|
||||
|
||||
public String getIndexedProp(int index) {
|
||||
return indexedProps.get(index);
|
||||
}
|
||||
|
||||
|
||||
public void setIndexedProp(int index, String val) {
|
||||
indexedProps.put(index, val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setThrowException(boolean throwException) {
|
||||
this.throwException = throwException;
|
||||
@@ -207,7 +204,7 @@ public class SimpleAction extends ActionSupport {
|
||||
public String commandMethod() throws Exception {
|
||||
return COMMAND_RETURN_CODE;
|
||||
}
|
||||
|
||||
|
||||
public Result resultAction() throws Exception {
|
||||
return new Result() {
|
||||
public Configuration configuration;
|
||||
@@ -220,7 +217,7 @@ public class SimpleAction extends ActionSupport {
|
||||
if (configuration != null)
|
||||
resultCalled = true;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -254,7 +251,7 @@ public class SimpleAction extends ActionSupport {
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
public long getLongFoo() {
|
||||
return longFoo;
|
||||
}
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2;
|
||||
package org.apache.struts2;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -32,7 +32,7 @@ public class TestBean {
|
||||
private Date birth;
|
||||
private String name;
|
||||
private int count;
|
||||
|
||||
|
||||
private TestChildBean child = new TestChildBean();
|
||||
|
||||
public TestBean() {
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2;
|
||||
package org.apache.struts2;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2;
|
||||
package org.apache.struts2;
|
||||
|
||||
public class TestSubBean extends TestBean {
|
||||
|
||||
+3
-3
@@ -16,10 +16,10 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2.mock;
|
||||
package org.apache.struts2.mock;
|
||||
|
||||
import com.opensymphony.xwork2.TextProvider;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import org.apache.struts2.TextProvider;
|
||||
import org.apache.struts2.util.ValueStack;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
+5
-5
@@ -16,11 +16,11 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2.ognl;
|
||||
package org.apache.struts2.ognl;
|
||||
|
||||
import com.opensymphony.xwork2.ActionProxy;
|
||||
import com.opensymphony.xwork2.XWorkJUnit4TestCase;
|
||||
import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
|
||||
import org.apache.struts2.ActionProxy;
|
||||
import org.apache.struts2.XWorkJUnit4TestCase;
|
||||
import org.apache.struts2.config.providers.XmlConfigurationProvider;
|
||||
import org.apache.struts2.config.StrutsXmlConfigurationProvider;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -48,7 +48,7 @@ public class SecurityMemberAccessProxyTest extends XWorkJUnit4TestCase {
|
||||
@Before
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
XmlConfigurationProvider provider = new StrutsXmlConfigurationProvider("com/opensymphony/xwork2/spring/actionContext-xwork.xml");
|
||||
XmlConfigurationProvider provider = new StrutsXmlConfigurationProvider("org/apache/struts2/spring/actionContext-xwork.xml");
|
||||
loadConfigurationProviders(provider);
|
||||
|
||||
context = new HashMap<>();
|
||||
+10
-10
@@ -16,16 +16,16 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2.spring;
|
||||
package org.apache.struts2.spring;
|
||||
|
||||
import com.opensymphony.xwork2.Action;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionProxy;
|
||||
import com.opensymphony.xwork2.ObjectFactory;
|
||||
import com.opensymphony.xwork2.SimpleAction;
|
||||
import com.opensymphony.xwork2.TestSubBean;
|
||||
import com.opensymphony.xwork2.XWorkTestCase;
|
||||
import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
|
||||
import org.apache.struts2.Action;
|
||||
import org.apache.struts2.ActionContext;
|
||||
import org.apache.struts2.ActionProxy;
|
||||
import org.apache.struts2.ObjectFactory;
|
||||
import org.apache.struts2.SimpleAction;
|
||||
import org.apache.struts2.TestSubBean;
|
||||
import org.apache.struts2.XWorkTestCase;
|
||||
import org.apache.struts2.config.providers.XmlConfigurationProvider;
|
||||
import org.apache.commons.lang3.reflect.MethodUtils;
|
||||
import org.apache.struts2.config.StrutsXmlConfigurationProvider;
|
||||
import org.apache.struts2.dispatcher.HttpParameters;
|
||||
@@ -47,7 +47,7 @@ public class ActionsFromSpringTest extends XWorkTestCase {
|
||||
super.setUp();
|
||||
|
||||
// Set up XWork
|
||||
XmlConfigurationProvider provider = new StrutsXmlConfigurationProvider("com/opensymphony/xwork2/spring/actionContext-xwork.xml");
|
||||
XmlConfigurationProvider provider = new StrutsXmlConfigurationProvider("org/apache/struts2/spring/actionContext-xwork.xml");
|
||||
container.inject(provider);
|
||||
loadConfigurationProviders(provider);
|
||||
appContext = ((SpringObjectFactory) container.getInstance(ObjectFactory.class)).appContext;
|
||||
+3
-3
@@ -16,9 +16,9 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2.spring;
|
||||
package org.apache.struts2.spring;
|
||||
|
||||
import com.opensymphony.xwork2.Action;
|
||||
import org.apache.struts2.Action;
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
|
||||
@@ -32,5 +32,5 @@ public class ExecuteInterceptor implements MethodInterceptor {
|
||||
return Action.INPUT;
|
||||
return mi.proceed();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+27
-27
@@ -16,32 +16,32 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2.spring;
|
||||
package org.apache.struts2.spring;
|
||||
|
||||
import com.opensymphony.xwork2.Action;
|
||||
import com.opensymphony.xwork2.ActionChainResult;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ModelDrivenAction;
|
||||
import com.opensymphony.xwork2.ObjectFactory;
|
||||
import com.opensymphony.xwork2.Result;
|
||||
import com.opensymphony.xwork2.SimpleAction;
|
||||
import com.opensymphony.xwork2.TestBean;
|
||||
import com.opensymphony.xwork2.TextProvider;
|
||||
import com.opensymphony.xwork2.XWorkTestCase;
|
||||
import com.opensymphony.xwork2.config.ConfigurationException;
|
||||
import com.opensymphony.xwork2.config.entities.ActionConfig;
|
||||
import com.opensymphony.xwork2.config.entities.InterceptorConfig;
|
||||
import com.opensymphony.xwork2.config.entities.ResultConfig;
|
||||
import com.opensymphony.xwork2.inject.ContainerBuilder;
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.interceptor.Interceptor;
|
||||
import com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor;
|
||||
import com.opensymphony.xwork2.mock.DummyTextProvider;
|
||||
import com.opensymphony.xwork2.test.StubConfigurationProvider;
|
||||
import com.opensymphony.xwork2.util.location.LocatableProperties;
|
||||
import com.opensymphony.xwork2.validator.Validator;
|
||||
import com.opensymphony.xwork2.validator.validators.ExpressionValidator;
|
||||
import com.opensymphony.xwork2.validator.validators.RequiredStringValidator;
|
||||
import org.apache.struts2.Action;
|
||||
import org.apache.struts2.ActionChainResult;
|
||||
import org.apache.struts2.ActionContext;
|
||||
import org.apache.struts2.ModelDrivenAction;
|
||||
import org.apache.struts2.ObjectFactory;
|
||||
import org.apache.struts2.Result;
|
||||
import org.apache.struts2.SimpleAction;
|
||||
import org.apache.struts2.TestBean;
|
||||
import org.apache.struts2.TextProvider;
|
||||
import org.apache.struts2.XWorkTestCase;
|
||||
import org.apache.struts2.config.ConfigurationException;
|
||||
import org.apache.struts2.config.entities.ActionConfig;
|
||||
import org.apache.struts2.config.entities.InterceptorConfig;
|
||||
import org.apache.struts2.config.entities.ResultConfig;
|
||||
import org.apache.struts2.inject.ContainerBuilder;
|
||||
import org.apache.struts2.inject.Inject;
|
||||
import org.apache.struts2.interceptor.Interceptor;
|
||||
import org.apache.struts2.interceptor.ModelDrivenInterceptor;
|
||||
import org.apache.struts2.mock.DummyTextProvider;
|
||||
import org.apache.struts2.test.StubConfigurationProvider;
|
||||
import org.apache.struts2.util.location.LocatableProperties;
|
||||
import org.apache.struts2.validator.Validator;
|
||||
import org.apache.struts2.validator.validators.ExpressionValidator;
|
||||
import org.apache.struts2.validator.validators.RequiredStringValidator;
|
||||
import org.apache.struts2.interceptor.NoOpInterceptor;
|
||||
import org.springframework.aop.framework.Advised;
|
||||
import org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator;
|
||||
@@ -73,12 +73,12 @@ public class SpringObjectFactoryTest extends XWorkTestCase {
|
||||
LocatableProperties props) throws ConfigurationException {
|
||||
|
||||
// No registered beans during initialization; They will be registered in each test, runtime.
|
||||
props.setProperty("applicationContextPath", "com/opensymphony/xwork2/spring/emptyContext-spring.xml");
|
||||
props.setProperty("applicationContextPath", "org/apache/struts2/spring/emptyContext-spring.xml");
|
||||
|
||||
builder.factory(TextProvider.class, DummyTextProvider.class);
|
||||
builder.factory(ObjectFactory.class, SpringObjectFactory.class);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
objectFactory = (SpringObjectFactory) container.getInstance(ObjectFactory.class);
|
||||
+9
-9
@@ -16,15 +16,15 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2.spring;
|
||||
package org.apache.struts2.spring;
|
||||
|
||||
import com.opensymphony.xwork2.ObjectFactory;
|
||||
import com.opensymphony.xwork2.SimpleAction;
|
||||
import com.opensymphony.xwork2.TestBean;
|
||||
import com.opensymphony.xwork2.TestSubBean;
|
||||
import com.opensymphony.xwork2.XWorkTestCase;
|
||||
import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
|
||||
import com.opensymphony.xwork2.util.ProxyUtil;
|
||||
import org.apache.struts2.ObjectFactory;
|
||||
import org.apache.struts2.SimpleAction;
|
||||
import org.apache.struts2.TestBean;
|
||||
import org.apache.struts2.TestSubBean;
|
||||
import org.apache.struts2.XWorkTestCase;
|
||||
import org.apache.struts2.config.providers.XmlConfigurationProvider;
|
||||
import org.apache.struts2.util.ProxyUtil;
|
||||
import org.apache.struts2.config.StrutsXmlConfigurationProvider;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class SpringProxyUtilTest extends XWorkTestCase {
|
||||
super.setUp();
|
||||
|
||||
// Set up XWork
|
||||
XmlConfigurationProvider provider = new StrutsXmlConfigurationProvider("com/opensymphony/xwork2/spring/actionContext-xwork.xml");
|
||||
XmlConfigurationProvider provider = new StrutsXmlConfigurationProvider("org/apache/struts2/spring/actionContext-xwork.xml");
|
||||
container.inject(provider);
|
||||
loadConfigurationProviders(provider);
|
||||
appContext = ((SpringObjectFactory) container.getInstance(ObjectFactory.class)).appContext;
|
||||
+3
-3
@@ -16,10 +16,10 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2.spring;
|
||||
package org.apache.struts2.spring;
|
||||
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.Result;
|
||||
import org.apache.struts2.ActionInvocation;
|
||||
import org.apache.struts2.Result;
|
||||
|
||||
public class SpringResult implements Result {
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.struts2.spring;
|
||||
|
||||
import com.opensymphony.xwork2.inject.Container;
|
||||
import org.apache.struts2.inject.Container;
|
||||
import junit.framework.TestCase;
|
||||
import org.easymock.EasyMock;
|
||||
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
||||
@@ -39,7 +39,7 @@ public class StrutsSpringObjectFactoryTest extends TestCase {
|
||||
// to cover situations where there will be logged an error
|
||||
Container container = EasyMock.createNiceMock(Container.class);
|
||||
EasyMock.replay(container);
|
||||
|
||||
|
||||
StrutsSpringObjectFactory fac = new StrutsSpringObjectFactory(null, null, null, null, new MockServletContext(), null, container);
|
||||
|
||||
assertEquals(AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, fac.getAutowireStrategy());
|
||||
@@ -53,7 +53,7 @@ public class StrutsSpringObjectFactoryTest extends TestCase {
|
||||
ServletContext msc = new MockServletContext();
|
||||
msc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ac);
|
||||
ac.setServletContext(msc);
|
||||
ac.setConfigLocations(new String[] {"org/apache/struts2/spring/StrutsSpringObjectFactoryTest-applicationContext.xml"});
|
||||
ac.setConfigLocations("org/apache/struts2/spring/emptyContext-spring.xml");
|
||||
ac.refresh();
|
||||
StrutsSpringObjectFactory fac = new StrutsSpringObjectFactory("constructor", null, null, null, msc, null, container);
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2.spring;
|
||||
package org.apache.struts2.spring;
|
||||
|
||||
public class TestAspect {
|
||||
protected String log = "";
|
||||
+8
-8
@@ -16,14 +16,14 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2.spring.interceptor;
|
||||
package org.apache.struts2.spring.interceptor;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.SimpleAction;
|
||||
import com.opensymphony.xwork2.TestBean;
|
||||
import com.opensymphony.xwork2.XWorkTestCase;
|
||||
import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
|
||||
import org.apache.struts2.ActionContext;
|
||||
import org.apache.struts2.ActionInvocation;
|
||||
import org.apache.struts2.SimpleAction;
|
||||
import org.apache.struts2.TestBean;
|
||||
import org.apache.struts2.XWorkTestCase;
|
||||
import org.apache.struts2.config.providers.XmlConfigurationProvider;
|
||||
import org.apache.struts2.config.StrutsXmlConfigurationProvider;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
@@ -60,7 +60,7 @@ public class ActionAutowiringInterceptorTest extends XWorkTestCase {
|
||||
XmlConfigurationProvider prov = new StrutsXmlConfigurationProvider("xwork-default.xml");
|
||||
container.inject(prov);
|
||||
prov.setThrowExceptionOnDuplicateBeans(false);
|
||||
XmlConfigurationProvider c = new StrutsXmlConfigurationProvider("com/opensymphony/xwork2/spring/xwork-autowire.xml");
|
||||
XmlConfigurationProvider c = new StrutsXmlConfigurationProvider("org/apache/struts2/spring/xwork-autowire.xml");
|
||||
container.inject(c);
|
||||
loadConfigurationProviders(c, prov);
|
||||
|
||||
+4
-4
@@ -16,11 +16,11 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.opensymphony.xwork2.spring.interceptor;
|
||||
package org.apache.struts2.spring.interceptor;
|
||||
|
||||
import com.opensymphony.xwork2.*;
|
||||
import com.opensymphony.xwork2.interceptor.PreResultListener;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import org.apache.struts2.*;
|
||||
import org.apache.struts2.interceptor.PreResultListener;
|
||||
import org.apache.struts2.util.ValueStack;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
-95
@@ -1,95 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/aop
|
||||
http://www.springframework.org/schema/aop/spring-aop.xsd">
|
||||
|
||||
<bean id="simple-action" class="com.opensymphony.xwork2.SimpleAction" scope="prototype"/>
|
||||
|
||||
<bean id="dependency-action" class="com.opensymphony.xwork2.SimpleAction" scope="prototype">
|
||||
<property name="blah"><value>injected</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="execute-interceptor" class="com.opensymphony.xwork2.spring.ExecuteInterceptor"/>
|
||||
|
||||
<bean id="proxied-action" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="singleton"><value>false</value></property>
|
||||
<property name="proxyTargetClass"><value>true</value></property>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<value>execute-interceptor</value>
|
||||
<!-- When "singleton" is false, the target appears to be required here to
|
||||
ensure that the config works as it should -->
|
||||
<value>simple-action</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="auto-proxied-action" class="com.opensymphony.xwork2.SimpleAction" scope="prototype"/>
|
||||
|
||||
<bean id="xwork-actions-proxy-creator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
|
||||
<property name="proxyTargetClass"><value>true</value></property>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<value>execute-interceptor</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="beanNames"><value>auto-proxied-action</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="springResult" class="com.opensymphony.xwork2.spring.SpringResult" init-method="initialize">
|
||||
<property name="stringParameter" value="my string"/>
|
||||
</bean>
|
||||
|
||||
<bean id="pointcutted-test-bean" class="com.opensymphony.xwork2.TestBean">
|
||||
<property name="name"><value>WW-4105</value></property>
|
||||
<property name="count"><value>1</value></property>
|
||||
</bean>
|
||||
<bean id="pointcutted-test-sub-bean" class="com.opensymphony.xwork2.TestSubBean">
|
||||
<property name="issueId"><value>WW-4105</value></property>
|
||||
</bean>
|
||||
<bean id="test-aspect" class="com.opensymphony.xwork2.spring.TestAspect" />
|
||||
<aop:config>
|
||||
<aop:aspect id="myAspect" ref="test-aspect">
|
||||
<aop:pointcut id="testBeanGetName"
|
||||
expression="execution(String com.opensymphony.xwork2.TestBean.getName()) and bean(pointcutted-test-bean)" />
|
||||
<aop:after-returning pointcut-ref="testBeanGetName"
|
||||
method="setName" returning="name" />
|
||||
<aop:pointcut id="testBeanGetCount"
|
||||
expression="execution(int com.opensymphony.xwork2.TestBean.getCount()) and bean(pointcutted-test-bean)" />
|
||||
<aop:after-returning pointcut-ref="testBeanGetCount"
|
||||
method="setCount" returning="count" />
|
||||
<aop:pointcut id="testSubBeanGetIssueId"
|
||||
expression="execution(String com.opensymphony.xwork2.TestSubBean.getIssueId()) and bean(pointcutted-test-sub-bean)" />
|
||||
<aop:after-returning pointcut-ref="testSubBeanGetIssueId"
|
||||
method="setIssueId" returning="issueId" />
|
||||
<aop:pointcut id="testBeanSetCount"
|
||||
expression="execution(void com.opensymphony.xwork2.TestBean.setCount(int)) and args(count2) and bean(pointcutted-test-sub-bean)" />
|
||||
<aop:before pointcut-ref="testBeanSetCount"
|
||||
method="setCount2" arg-names="count2"/>
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
</beans>
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
|
||||
<beans>
|
||||
</beans>
|
||||
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/aop
|
||||
http://www.springframework.org/schema/aop/spring-aop.xsd">
|
||||
|
||||
<bean id="simple-action" class="org.apache.struts2.SimpleAction" scope="prototype"/>
|
||||
|
||||
<bean id="dependency-action" class="org.apache.struts2.SimpleAction" scope="prototype">
|
||||
<property name="blah">
|
||||
<value>injected</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="execute-interceptor" class="org.apache.struts2.spring.ExecuteInterceptor"/>
|
||||
|
||||
<bean id="proxied-action" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="singleton">
|
||||
<value>false</value>
|
||||
</property>
|
||||
<property name="proxyTargetClass">
|
||||
<value>true</value>
|
||||
</property>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<value>execute-interceptor</value>
|
||||
<!-- When "singleton" is false, the target appears to be required here to
|
||||
ensure that the config works as it should -->
|
||||
<value>simple-action</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="auto-proxied-action" class="org.apache.struts2.SimpleAction" scope="prototype"/>
|
||||
|
||||
<bean id="xwork-actions-proxy-creator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
|
||||
<property name="proxyTargetClass">
|
||||
<value>true</value>
|
||||
</property>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<value>execute-interceptor</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="beanNames">
|
||||
<value>auto-proxied-action</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="springResult" class="org.apache.struts2.spring.SpringResult" init-method="initialize">
|
||||
<property name="stringParameter" value="my string"/>
|
||||
</bean>
|
||||
|
||||
<bean id="pointcutted-test-bean" class="org.apache.struts2.TestBean">
|
||||
<property name="name">
|
||||
<value>WW-4105</value>
|
||||
</property>
|
||||
<property name="count">
|
||||
<value>1</value>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="pointcutted-test-sub-bean" class="org.apache.struts2.TestSubBean">
|
||||
<property name="issueId">
|
||||
<value>WW-4105</value>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="test-aspect" class="org.apache.struts2.spring.TestAspect"/>
|
||||
<aop:config>
|
||||
<aop:aspect id="myAspect" ref="test-aspect">
|
||||
<aop:pointcut id="testBeanGetName"
|
||||
expression="execution(String org.apache.struts2.TestBean.getName()) and bean(pointcutted-test-bean)"/>
|
||||
<aop:after-returning pointcut-ref="testBeanGetName"
|
||||
method="setName" returning="name"/>
|
||||
<aop:pointcut id="testBeanGetCount"
|
||||
expression="execution(int org.apache.struts2.TestBean.getCount()) and bean(pointcutted-test-bean)"/>
|
||||
<aop:after-returning pointcut-ref="testBeanGetCount"
|
||||
method="setCount" returning="count"/>
|
||||
<aop:pointcut id="testSubBeanGetIssueId"
|
||||
expression="execution(String org.apache.struts2.TestSubBean.getIssueId()) and bean(pointcutted-test-sub-bean)"/>
|
||||
<aop:after-returning pointcut-ref="testSubBeanGetIssueId"
|
||||
method="setIssueId" returning="issueId"/>
|
||||
<aop:pointcut id="testBeanSetCount"
|
||||
expression="execution(void org.apache.struts2.TestBean.setCount(int)) and args(count2) and bean(pointcutted-test-sub-bean)"/>
|
||||
<aop:before pointcut-ref="testBeanSetCount"
|
||||
method="setCount2" arg-names="count2"/>
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
</beans>
|
||||
+16
-16
@@ -23,23 +23,23 @@
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
<struts>
|
||||
<bean type="com.opensymphony.xwork2.ObjectFactory" class="com.opensymphony.xwork2.spring.SpringObjectFactory" />
|
||||
<constant name="applicationContextPath" value="com/opensymphony/xwork2/spring/actionContext-spring.xml" />
|
||||
<constant name="struts.disallowProxyMemberAccess" value="true" />
|
||||
<bean type="org.apache.struts2.ObjectFactory" class="org.apache.struts2.spring.SpringObjectFactory"/>
|
||||
<constant name="applicationContextPath" value="org/apache/struts2/spring/actionContext-spring.xml"/>
|
||||
<constant name="struts.disallowProxyMemberAccess" value="true"/>
|
||||
<package name="default">
|
||||
<result-types>
|
||||
<result-type name="null" class="com.opensymphony.xwork2.mock.MockResult" default="true"/>
|
||||
<result-type name="springResult" class="springResult" />
|
||||
<result-type name="null" class="org.apache.struts2.mock.MockResult" default="true"/>
|
||||
<result-type name="springResult" class="springResult"/>
|
||||
<result-type name="chain"
|
||||
class="com.opensymphony.xwork2.ActionChainResult" />
|
||||
class="org.apache.struts2.ActionChainResult"/>
|
||||
</result-types>
|
||||
|
||||
<interceptors>
|
||||
<interceptor name="chain" class="com.opensymphony.xwork2.interceptor.ChainingInterceptor"/>
|
||||
<interceptor name="chain" class="org.apache.struts2.interceptor.ChainingInterceptor"/>
|
||||
<interceptor name="params" class="org.apache.struts2.interceptor.parameter.ParametersInterceptor"/>
|
||||
</interceptors>
|
||||
|
||||
<action name="simpleAction" class="simple-action"/>
|
||||
<action name="simpleAction" class="simple-action"/>
|
||||
|
||||
<action name="dependencyAction" class="dependency-action"/>
|
||||
|
||||
@@ -48,21 +48,21 @@
|
||||
<action name="autoProxiedAction" class="auto-proxied-action"/>
|
||||
|
||||
<action name="simpleActionSpringResult" class="simple-action">
|
||||
<result name="error" type="springResult"/>
|
||||
</action>
|
||||
<result name="error" type="springResult"/>
|
||||
</action>
|
||||
|
||||
<action name="chainedAOPedTestBeanAction" class="pointcutted-test-bean"
|
||||
method="getName">
|
||||
method="getName">
|
||||
<result name="WW-4105" type="chain">
|
||||
<param name="actionName">chaintoAOPedTestSubBeanAction</param>
|
||||
</result>
|
||||
</action>
|
||||
<action name="chaintoAOPedTestSubBeanAction" class="pointcutted-test-sub-bean"
|
||||
method="getIssueId">
|
||||
<interceptor-ref name="chain" />
|
||||
<interceptor-ref name="params" />
|
||||
<result name="WW-4105" type="null" />
|
||||
<result name="S2-047" type="null" />
|
||||
method="getIssueId">
|
||||
<interceptor-ref name="chain"/>
|
||||
<interceptor-ref name="params"/>
|
||||
<result name="WW-4105" type="null"/>
|
||||
<result name="S2-047" type="null"/>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
Reference in New Issue
Block a user