Author: mrdon Date: Fri Jul 6 20:58:03 2007 New Revision: 554128 URL: http://svn.apache.org/viewvc?view=rev&rev=554128 Log: Adding a simple result to the archetype
Added: struts/maven/trunk/struts2-archetype-plugin/src/main/resources/archetype-resources/src/main/java/MyResult.java Removed: struts/maven/trunk/struts2-archetype-plugin/src/main/resources/archetype-resources/src/test/ Modified: struts/maven/trunk/struts2-archetype-plugin/src/main/resources/META-INF/archetype.xml struts/maven/trunk/struts2-archetype-plugin/src/main/resources/archetype-resources/pom.xml struts/maven/trunk/struts2-archetype-plugin/src/main/resources/archetype-resources/src/main/resources/struts-plugin.xml Modified: struts/maven/trunk/struts2-archetype-plugin/src/main/resources/META-INF/archetype.xml URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-plugin/src/main/resources/META-INF/archetype.xml?view=diff&rev=554128&r1=554127&r2=554128 ============================================================================== --- struts/maven/trunk/struts2-archetype-plugin/src/main/resources/META-INF/archetype.xml (original) +++ struts/maven/trunk/struts2-archetype-plugin/src/main/resources/META-INF/archetype.xml Fri Jul 6 20:58:03 2007 @@ -2,6 +2,9 @@ <archetype> <id>struts2-archetype-plugin</id> + <sources> + <source>src/main/java/MyResult.java</source> + </sources> <resources> <resource>src/main/resources/struts-plugin.xml</resource> <resource>LICENSE.txt</resource> Modified: struts/maven/trunk/struts2-archetype-plugin/src/main/resources/archetype-resources/pom.xml URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-plugin/src/main/resources/archetype-resources/pom.xml?view=diff&rev=554128&r1=554127&r2=554128 ============================================================================== --- struts/maven/trunk/struts2-archetype-plugin/src/main/resources/archetype-resources/pom.xml (original) +++ struts/maven/trunk/struts2-archetype-plugin/src/main/resources/archetype-resources/pom.xml Fri Jul 6 20:58:03 2007 @@ -11,18 +11,27 @@ <dependencies> <dependency> + <groupId>org.apache.struts</groupId> + <artifactId>struts2-core</artifactId> + <version>2.0.8</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.4</version> + <scope>provided</scope> + </dependency> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> - - <dependency> - <groupId>org.apache.struts</groupId> - <artifactId>struts2-core</artifactId> - <version>2.0.8</version> - </dependency> - + </dependencies> + + <build> + <defaultGoal>install</defaultGoal> + </build> </project> Added: struts/maven/trunk/struts2-archetype-plugin/src/main/resources/archetype-resources/src/main/java/MyResult.java URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-plugin/src/main/resources/archetype-resources/src/main/java/MyResult.java?view=auto&rev=554128 ============================================================================== --- struts/maven/trunk/struts2-archetype-plugin/src/main/resources/archetype-resources/src/main/java/MyResult.java (added) +++ struts/maven/trunk/struts2-archetype-plugin/src/main/resources/archetype-resources/src/main/java/MyResult.java Fri Jul 6 20:58:03 2007 @@ -0,0 +1,48 @@ +/* + * 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 $package; + +import org.apache.struts2.ServletActionContext; +import com.opensymphony.xwork2.ActionInvocation; +import com.opensymphony.xwork2.Result; + +import javax.servlet.http.HttpServletResponse; +import java.io.Writer; + + +/** + * An example result that simply returns "hello". + * + */ +public class MyResult implements Result { + + /** + * Executes the result. + * + * @param invocation an encapsulation of the action execution state. + * @throws Exception if an error occurs when writing the text to the servlet output stream. + */ + public void execute(ActionInvocation invocation) throws Exception { + + HttpServletResponse response = ServletActionContext.getResponse(); + Writer writer = response.getWriter(); + writer.write("Hello"); + writer.flush(); + } +} Modified: struts/maven/trunk/struts2-archetype-plugin/src/main/resources/archetype-resources/src/main/resources/struts-plugin.xml URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-plugin/src/main/resources/archetype-resources/src/main/resources/struts-plugin.xml?view=diff&rev=554128&r1=554127&r2=554128 ============================================================================== --- struts/maven/trunk/struts2-archetype-plugin/src/main/resources/archetype-resources/src/main/resources/struts-plugin.xml (original) +++ struts/maven/trunk/struts2-archetype-plugin/src/main/resources/archetype-resources/src/main/resources/struts-plugin.xml Fri Jul 6 20:58:03 2007 @@ -37,13 +37,12 @@ <!-- Finally, you can define your own interceptors, results, and action packages. - In this example, we create a package that defines an interceptor: + In this example, we create a package that defines a result: --> <package name="myPlugin-default"> - <interceptors> - <interceptor name="myInterceptor" class="com.mycompany.myapp.MyInterceptor"/> - </interceptors> + <results-types> + <result-type name="myResult" class="${package}.MyResult"/> + </results-types> </package> - --> </struts>