Commits

Anonymous committed 61a6ff1

I am attempting to make showcase work... Starting with this helloWorld action. It will now launch standalone with only xwork and xwork's dependencies in the classpath. Before I start working on the other examples, I am going to see if I can do some more maven updates to allow this to be launched from maven (rather than java -cp /home/wesw/.m2/repo... ).

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@2016e221344d-f017-0410-9bd5-d282ab1896d7

Comments (0)

Files changed (10)

     <dependencies>
         <dependency>
             <groupId>com.opensymphony</groupId>
-            <artifactId>xwork</artifactId>
+            <artifactId>xwork-core</artifactId>
             <version>2.1.5-SNAPSHOT</version>
         </dependency>
     </dependencies>
     <build>
         <sourceDirectory>src/java</sourceDirectory>
+        <resources>
+            <resource>
+                <directory>src/resources</directory>
+            </resource>
+        </resources>
+
         <testSourceDirectory>src/test</testSourceDirectory>
         <testResources>
             <testResource>

showcase/src/java/com/opensymphony/xwork2/showcase/helloworld/HelloWorldTutorial.java

 
 import com.opensymphony.xwork2.ActionProxy;
 import com.opensymphony.xwork2.ActionProxyFactory;
+import com.opensymphony.xwork2.XWork;
 import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationManager;
 import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
 				new XmlConfigurationProvider(
 						"com/opensymphony/xwork2/showcase/helloworld/xwork-hello-world.xml", 
 						true));
-        
+        /*
         Configuration conf = confManager.getConfiguration();
 		ActionProxyFactory actionProxyFactory = conf.getContainer().getInstance(ActionProxyFactory.class);
 		ActionProxy actionProxy = actionProxyFactory.createActionProxy(
 		
 		
 		actionProxy.execute();
+		*/
+        XWork xwork = new XWork(confManager);
+        xwork.executeAction("/helloWorld", "helloWorld", "execute", new LinkedHashMap());
 	}
 }

showcase/src/java/com/opensymphony/xwork2/showcase/helloworld/xwork-hello-world.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE xwork PUBLIC 
-	"-//OpenSymphony Group//XWork 1.1.1//EN"
-	"http://www.opensymphony.com/xwork/xwork-1.1.1.dtd">
-
-<!-- START SNIPPET: helloworld-xwork -->
-
-<xwork>
-	<include file="xwork-default.xml" />
-	<package name="default-hello-world" extends="xwork-default" namespace="/helloWorld">
-		<result-types>
-			<result-type name="printToConsole" class="com.opensymphony.xwork2.showcase.PrintToConsoleResult" />
-		</result-types>
-		
-		<action name="helloWorld" class="com.opensymphony.xwork2.showcase.helloworld.HelloWorldAction">
-			<result type="printToConsole">
-				<param name="param">${message}</param>
-			</result>
-		</action>
-	</package>
-</xwork>
-
-<!-- END SNIPPET: helloworld-xwork -->
-

showcase/src/java/com/opensymphony/xwork2/showcase/interceptorExample/xwork-interceptor-example.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE xwork PUBLIC 
-	"-//OpenSymphony Group//XWork 1.1.1//EN"
-	"http://www.opensymphony.com/xwork/xwork-1.1.1.dtd">
-	
-<xwork>
-	<include file="xwork-default.xml" />
-	<package name="default-interceptor-example" namespace="/interceptorExample">
-		<result-types>
-			<result-type name="printToConsole" class="com.opensymphony.xwork2.showcase.PrintToConsoleResult" />
-		</result-types>
-	
-		<interceptors>
-			<interceptor name="interceptor1" class="com.opensymphony.xwork2.showcase.interceptorExample.Interceptor1" >
-				<param name="param">paramValue1</param>
-			</interceptor>
-			<interceptor name="interceptor2" class="com.opensmyphony.xwork2.showcase.interceptorExample.Interceptor2">
-				<param name="param">paramValue2</param>
-			</interceptor>
-			<interceptor name="interceptor3" class="com.opensymphony.xwork2.showcase.interceptorExample.Interceptor3">
-				<param name="param">paramValue2</param> 
-			</interceptor>
-			<interceptor-stack name="myInterceptorStack">
-				<interceptor-ref name="interceptor1" />
-				<interceptor-ref name="interceptor2" />
-				<interceptor-ref name="interceptor3" />
-			</interceptor-stack>
-		</interceptors>
-		
-		<action name="interceptorExampleAction1" 
-		class="com.opensymphony.xwork2.showcase.interceptorExample.Action1"
-		>
-			<interceptor-ref name="interceptor1" />
-			<interceptor-ref name="interceptor2" />
-			<result type="printToConsole">InterceptorExample - Action1 - Result</result>
-		</action>
-		
-		<action name="interceptorExampleAction2" class="com.opensymphony.xwork2.showcase.interceptorExample.Action2">
-			<interceptor-ref name="myInterceptorStack" />
-			<result type="printToConsole">InterceptorExample - Action2 - Result</result>
-		</action>
-		
-		<action name="interceptorExampleAction3" class="com.opensymphony.xwork2.showcase.interceptorExample.Action3">
-			<interceptor-ref name="interceptor1">
-				<param name="param">new paramValue1</param>
-			</interceptor-ref>
-			<result type="printToConsole">InterceptorExample - Action3 - Result</result>
-		</action>
-		
-		<action name="interceptorExampleAction4" class="com.opensymphony.xwork2.showcase.interceptorExample.Action4">
-			<interceptor-ref name="myInterceptorStack">
-				<param name="interceptor1.param">new paramValue1</param>
-			</interceptor-ref>
-			<result type="printToConsole">InterceptorExample - Action4 - Result</result>
-		</action>
-	</package>
-</xwork>		
-	
-	

showcase/src/java/com/opensymphony/xwork2/showcase/validationExample/ValidationExampleAction-validation.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE validators PUBLIC 
-	"-//OpenSymphony Group//XWork Validator 1.0.2//EN" 
-	"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
-
-<!-- START SNIPPET: xwork-validation -->
-<validators>
-	<validator type="expression">
-		<param name="expression"><![CDATA[name != null && age != null]]></param>
-		<message>Both fields are required</message>
-	</validator>
-	<field name="name">
-		<field-validator type="requiredstring">
-			<message>Name is mandatory</message>
-		</field-validator>
-	</field>
-	<field name="age">
-		<field-validator type="requiredstring">
-			<message>Age is mandatory</message>
-		</field-validator>
-		<field-validator type="int">
-			<param name="min">20</param>
-			<param name="max">50</param>
-			<message>Age must be between 20 and 50</message>
-		</field-validator>
-	</field>
-</validators>
-<!-- END SNIPPET: xwork-validation -->
-

showcase/src/java/log4j.properties

-log4j.rootLogger = WARN, stdout
-
-log4j.appender.stdout = org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Threshold = DEBUG
-log4j.appender.stdout.Target   = System.out
-log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern = %d{ISO8601} %-5p [%F:%L] : %m%n
-
-log4j.logger.com.opensymphony.xwork2=DEBUG
-log4j.logger.com.opensymphony.xwork2.showcase=DEBUG
-

showcase/src/resources/com/opensymphony/xwork2/showcase/helloworld/xwork-hello-world.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE xwork PUBLIC 
+	"-//OpenSymphony Group//XWork 2.1//EN"
+	"http://www.opensymphony.com/xwork/xwork-2.1.dtd">
+
+<!-- START SNIPPET: helloworld-xwork -->
+
+<xwork>
+
+    <bean class="com.opensymphony.xwork2.ObjectFactory"/>
+    <bean type="com.opensymphony.xwork2.ActionProxyFactory"
+          class="com.opensymphony.xwork2.DefaultActionProxyFactory"/>
+    <bean type="com.opensymphony.xwork2.conversion.ObjectTypeDeterminer"
+          class="com.opensymphony.xwork2.conversion.impl.DefaultObjectTypeDeterminer"/>
+    <bean name="xwork1"
+          type="com.opensymphony.xwork2.conversion.ObjectTypeDeterminer"
+          class="com.opensymphony.xwork2.conversion.impl.DefaultObjectTypeDeterminer"/>
+    <bean name="xwork1"
+          type="com.opensymphony.xwork2.conversion.impl.XWorkConverter"
+          class="com.opensymphony.xwork2.conversion.impl.XWorkConverter"/>
+    <bean type="com.opensymphony.xwork2.conversion.impl.XWorkConverter"
+          class="com.opensymphony.xwork2.conversion.impl.XWorkConverter"/>
+
+    <bean type="com.opensymphony.xwork2.util.ValueStackFactory" name="default"
+          class="com.opensymphony.xwork2.ognl.OgnlValueStackFactory" />
+    <bean class="com.opensymphony.xwork2.conversion.impl.XWorkConverter" static="true"/>    
+    <bean type="com.opensymphony.xwork2.util.reflection.ReflectionProvider" name="default" 
+          class="com.opensymphony.xwork2.ognl.OgnlReflectionProvider" />
+    <bean class="com.opensymphony.xwork2.ognl.OgnlUtil" />
+    <bean type="com.opensymphony.xwork2.util.reflection.ReflectionContextFactory" name="default"
+          class="com.opensymphony.xwork2.ognl.OgnlReflectionContextFactory" />
+    <bean class="com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter" />
+    <bean type="com.opensymphony.xwork2.validator.ActionValidatorManager" name="default"
+          class="com.opensymphony.xwork2.validator.AnnotationActionValidatorManager" />
+    <bean type="com.opensymphony.xwork2.validator.ActionValidatorManager" name="no-annotations"
+          class="com.opensymphony.xwork2.validator.DefaultActionValidatorManager" />
+    <bean type="com.opensymphony.xwork2.validator.ValidatorFactory"
+          class="com.opensymphony.xwork2.validator.DefaultValidatorFactory"/>
+    <bean type="com.opensymphony.xwork2.validator.ValidatorFileParser"
+          class="com.opensymphony.xwork2.validator.DefaultValidatorFileParser" />
+    <bean type="com.opensymphony.xwork2.TextProvider" name="system"
+          class="com.opensymphony.xwork2.DefaultTextProvider" />
+    <bean type="com.opensymphony.xwork2.TextProvider" name="xwork1"
+          class="com.opensymphony.xwork2.TextProviderSupport" scope="default" />
+    <bean type="ognl.PropertyAccessor" name="com.opensymphony.xwork2.util.CompoundRoot"
+          class="com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor" />
+    <bean type="ognl.MethodAccessor" name="com.opensymphony.xwork2.util.CompoundRoot"
+          class="com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor" />
+    <bean type="com.opensymphony.xwork2.util.PatternMatcher" name="default" 
+          class="com.opensymphony.xwork2.util.WildcardHelper" />
+    <bean type="com.opensymphony.xwork2.util.PatternMatcher" name="namedVariable"
+          class="com.opensymphony.xwork2.util.NamedVariablePatternMatcher"/>
+    <bean type="com.opensymphony.xwork2.UnknownHandlerManager"
+          class="com.opensymphony.xwork2.DefaultUnknownHandlerManager" name="default" />
+    
+    <constant name="devMode" value="false" />
+    
+	<include file="xwork-default.xml" />
+	<package name="default-hello-world" extends="xwork-default" namespace="/helloWorld">
+		<result-types>
+			<result-type name="printToConsole" class="com.opensymphony.xwork2.showcase.PrintToConsoleResult" />
+		</result-types>
+		
+		<action name="helloWorld" class="com.opensymphony.xwork2.showcase.helloworld.HelloWorldAction">
+			<result type="printToConsole">
+				<param name="param">${message}</param>
+			</result>
+		</action>
+	</package>
+</xwork>
+
+<!-- END SNIPPET: helloworld-xwork -->
+

showcase/src/resources/com/opensymphony/xwork2/showcase/interceptorExample/xwork-interceptor-example.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE xwork PUBLIC 
+	"-//OpenSymphony Group//XWork 1.1.1//EN"
+	"http://www.opensymphony.com/xwork/xwork-1.1.1.dtd">
+	
+<xwork>
+	<include file="xwork-default.xml" />
+	<package name="default-interceptor-example" namespace="/interceptorExample">
+		<result-types>
+			<result-type name="printToConsole" class="com.opensymphony.xwork2.showcase.PrintToConsoleResult" />
+		</result-types>
+	
+		<interceptors>
+			<interceptor name="interceptor1" class="interceptorExample.Interceptor1" >
+				<param name="param">paramValue1</param>
+			</interceptor>
+			<interceptor name="interceptor2" class="com.opensmyphony.xwork2.showcase.interceptorExample.Interceptor2">
+				<param name="param">paramValue2</param>
+			</interceptor>
+			<interceptor name="interceptor3" class="interceptorExample.Interceptor3">
+				<param name="param">paramValue2</param> 
+			</interceptor>
+			<interceptor-stack name="myInterceptorStack">
+				<interceptor-ref name="interceptor1" />
+				<interceptor-ref name="interceptor2" />
+				<interceptor-ref name="interceptor3" />
+			</interceptor-stack>
+		</interceptors>
+		
+		<action name="interceptorExampleAction1" 
+		class="interceptorExample.Action1"
+		>
+			<interceptor-ref name="interceptor1" />
+			<interceptor-ref name="interceptor2" />
+			<result type="printToConsole">InterceptorExample - Action1 - Result</result>
+		</action>
+		
+		<action name="interceptorExampleAction2" class="interceptorExample.Action2">
+			<interceptor-ref name="myInterceptorStack" />
+			<result type="printToConsole">InterceptorExample - Action2 - Result</result>
+		</action>
+		
+		<action name="interceptorExampleAction3" class="interceptorExample.Action3">
+			<interceptor-ref name="interceptor1">
+				<param name="param">new paramValue1</param>
+			</interceptor-ref>
+			<result type="printToConsole">InterceptorExample - Action3 - Result</result>
+		</action>
+		
+		<action name="interceptorExampleAction4" class="interceptorExample.Action4">
+			<interceptor-ref name="myInterceptorStack">
+				<param name="interceptor1.param">new paramValue1</param>
+			</interceptor-ref>
+			<result type="printToConsole">InterceptorExample - Action4 - Result</result>
+		</action>
+	</package>
+</xwork>		
+	
+	

showcase/src/resources/com/opensymphony/xwork2/showcase/validationExample/ValidationExampleAction-validation.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE validators PUBLIC 
+	"-//OpenSymphony Group//XWork Validator 1.0.2//EN" 
+	"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<!-- START SNIPPET: xwork-validation -->
+<validators>
+	<validator type="expression">
+		<param name="expression"><![CDATA[name != null && age != null]]></param>
+		<message>Both fields are required</message>
+	</validator>
+	<field name="name">
+		<field-validator type="requiredstring">
+			<message>Name is mandatory</message>
+		</field-validator>
+	</field>
+	<field name="age">
+		<field-validator type="requiredstring">
+			<message>Age is mandatory</message>
+		</field-validator>
+		<field-validator type="int">
+			<param name="min">20</param>
+			<param name="max">50</param>
+			<message>Age must be between 20 and 50</message>
+		</field-validator>
+	</field>
+</validators>
+<!-- END SNIPPET: xwork-validation -->
+

showcase/src/resources/log4j.properties

+log4j.rootLogger = WARN, stdout
+
+log4j.appender.stdout = org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Threshold = DEBUG
+log4j.appender.stdout.Target   = System.out
+log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern = %d{ISO8601} %-5p [%F:%L] : %m%n
+
+log4j.logger.com.opensymphony.xwork2=DEBUG
+log4j.logger.com.opensymphony.xwork2.showcase=DEBUG
+