You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mr...@apache.org on 2007/07/17 14:56:21 UTC
svn commit: r556913 [1/2] - in /struts/sandbox/trunk/struts2-rest-plugin: ./
src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/struts2/ src/main/java/org/apache/struts2/rest/
src/main/java/org/apache/st...
Author: mrdon
Date: Tue Jul 17 05:56:15 2007
New Revision: 556913
URL: http://svn.apache.org/viewvc?view=rev&rev=556913
Log:
Initial import of struts 2 rest plugin
Added:
struts/sandbox/trunk/struts2-rest-plugin/
struts/sandbox/trunk/struts2-rest-plugin/.classpath
struts/sandbox/trunk/struts2-rest-plugin/.project
struts/sandbox/trunk/struts2-rest-plugin/LICENSE.txt
struts/sandbox/trunk/struts2-rest-plugin/NOTICE.txt
struts/sandbox/trunk/struts2-rest-plugin/README.txt
struts/sandbox/trunk/struts2-rest-plugin/pom.xml
struts/sandbox/trunk/struts2-rest-plugin/src/
struts/sandbox/trunk/struts2-rest-plugin/src/main/
struts/sandbox/trunk/struts2-rest-plugin/src/main/java/
struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/
struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/
struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/
struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/
struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/BasicRestful.java
struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionInvocation.java
struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionMapper.java
struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionProxy.java
struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionProxyFactory.java
struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/Restful.java
struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/
struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/HtmlHandler.java
struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/MimeTypeHandler.java
struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/XStreamJsonHandler.java
struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/
struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml
struts/sandbox/trunk/struts2-rest-plugin/src/test/
struts/sandbox/trunk/struts2-rest-plugin/src/test/java/
struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/
struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/
struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/struts2/
struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/struts2/rest/
struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/struts2/rest/RestActionInvoicationTest.java
struts/sandbox/trunk/struts2-rest-plugin/src/test/resources/
struts/sandbox/trunk/struts2-rest-plugin/target/
struts/sandbox/trunk/struts2-rest-plugin/target/classes/
struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/
struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/
struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/
struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/
struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/BasicRestful.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionInvocation$MethodMatch.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionInvocation.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionMapper.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionProxy.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionProxyFactory.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/Restful.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/
struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/HtmlHandler.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/MimeTypeHandler.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/XStreamHandler.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/XStreamJsonHandler.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/classes/struts-plugin.xml
struts/sandbox/trunk/struts2-rest-plugin/target/struts2-rest-plugin-1.0-SNAPSHOT.jar (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/surefire-reports/
struts/sandbox/trunk/struts2-rest-plugin/target/surefire-reports/TEST-org.apache.struts2.rest.RestActionInvoicationTest.xml
struts/sandbox/trunk/struts2-rest-plugin/target/surefire-reports/org.apache.struts2.rest.RestActionInvoicationTest.txt
struts/sandbox/trunk/struts2-rest-plugin/target/test-classes/
struts/sandbox/trunk/struts2-rest-plugin/target/test-classes/org/
struts/sandbox/trunk/struts2-rest-plugin/target/test-classes/org/apache/
struts/sandbox/trunk/struts2-rest-plugin/target/test-classes/org/apache/struts2/
struts/sandbox/trunk/struts2-rest-plugin/target/test-classes/org/apache/struts2/rest/
struts/sandbox/trunk/struts2-rest-plugin/target/test-classes/org/apache/struts2/rest/RestActionInvoicationTest$1.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/test-classes/org/apache/struts2/rest/RestActionInvoicationTest$2.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/test-classes/org/apache/struts2/rest/RestActionInvoicationTest$3.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/test-classes/org/apache/struts2/rest/RestActionInvoicationTest$4.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/test-classes/org/apache/struts2/rest/RestActionInvoicationTest$5.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/test-classes/org/apache/struts2/rest/RestActionInvoicationTest$6.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/test-classes/org/apache/struts2/rest/RestActionInvoicationTest$7.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/test-classes/org/apache/struts2/rest/RestActionInvoicationTest$FooAction.class (with props)
struts/sandbox/trunk/struts2-rest-plugin/target/test-classes/org/apache/struts2/rest/RestActionInvoicationTest.class (with props)
Added: struts/sandbox/trunk/struts2-rest-plugin/.classpath
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/.classpath?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/.classpath (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/.classpath Tue Jul 17 05:56:15 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar" sourcepath="M2_REPO/javax/servlet/servlet-api/2.4/servlet-api-2.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/opensymphony/ognl/2.6.11/ognl-2.6.11.jar" sourcepath="M2_REPO/opensymphony/ognl/2.6.11/ognl-2.6.11-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/freemarker/freemarker/2.3.8/freemarker-2.3.8.jar"/>
+ <classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
+ <classpathentry kind="lib" path="/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/lib/tools.jar"/>
+ <classpathentry kind="var" path="M2_REPO/com/thoughtworks/xstream/xstream/1.2.2/xstream-1.2.2.jar" sourcepath="M2_REPO/com/thoughtworks/xstream/xstream/1.2.2/xstream-1.2.2-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/mockobjects/mockobjects-core/0.09/mockobjects-core-0.09.jar" sourcepath="M2_REPO/mockobjects/mockobjects-core/0.09/mockobjects-core-0.09-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/codehaus/jettison/jettison/1.0-RC1/jettison-1.0-RC1.jar" sourcepath="M2_REPO/org/codehaus/jettison/jettison/1.0-RC1/jettison-1.0-RC1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xpp3/xpp3_min/1.1.3.4.O/xpp3_min-1.1.3.4.O.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/struts2-core"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/xwork"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: struts/sandbox/trunk/struts2-rest-plugin/.project
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/.project?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/.project (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/.project Tue Jul 17 05:56:15 2007
@@ -0,0 +1,14 @@
+<projectDescription>
+ <name>struts2-rest-plugin</name>
+ <comment/>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments/>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Added: struts/sandbox/trunk/struts2-rest-plugin/LICENSE.txt
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/LICENSE.txt?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/LICENSE.txt (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/LICENSE.txt Tue Jul 17 05:56:15 2007
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
Added: struts/sandbox/trunk/struts2-rest-plugin/NOTICE.txt
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/NOTICE.txt?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/NOTICE.txt (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/NOTICE.txt Tue Jul 17 05:56:15 2007
@@ -0,0 +1,6 @@
+Apache Struts
+
+Copyright 2006 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/
Added: struts/sandbox/trunk/struts2-rest-plugin/README.txt
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/README.txt?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/README.txt (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/README.txt Tue Jul 17 05:56:15 2007
@@ -0,0 +1,10 @@
+README.txt - plugin
+
+This is an "empty" Struts 2 plugin that you can use as the basis for a new
+plugin.
+
+For more on Struts plugins, see
+
+* http://struts.apache.org/2.x/docs/plugins.html
+
+----------------------------------------------------------------------------
Added: struts/sandbox/trunk/struts2-rest-plugin/pom.xml
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/pom.xml?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/pom.xml (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/pom.xml Tue Jul 17 05:56:15 2007
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.struts</groupId>
+ <artifactId>struts2-rest-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Struts 2 Plugin</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.struts</groupId>
+ <artifactId>struts2-core</artifactId>
+ <version>2.0.8</version>
+ </dependency>
+ <dependency>
+ <groupId>com.thoughtworks.xstream</groupId>
+ <artifactId>xstream</artifactId>
+ <version>1.2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ <version>1.0-RC1</version>
+ </dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</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>mockobjects</groupId>
+ <artifactId>mockobjects-core</artifactId>
+ <version>0.09</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+</project>
Added: struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/BasicRestful.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/BasicRestful.java?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/BasicRestful.java (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/BasicRestful.java Tue Jul 17 05:56:15 2007
@@ -0,0 +1,17 @@
+package org.apache.struts2.rest;
+
+import java.util.List;
+
+public interface BasicRestful<E, ID> {
+
+ public ID create(E object);
+
+ public void update(ID id, E object);
+
+ public void remove(ID id);
+
+ public E view(ID id);
+
+ public List<E> index();
+
+}
Added: struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionInvocation.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionInvocation.java?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionInvocation.java (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionInvocation.java Tue Jul 17 05:56:15 2007
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package org.apache.struts2.rest;
+
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionEventListener;
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.ActionProxy;
+import com.opensymphony.xwork2.DefaultActionInvocation;
+import com.opensymphony.xwork2.ObjectFactory;
+import com.opensymphony.xwork2.Result;
+import com.opensymphony.xwork2.UnknownHandler;
+import com.opensymphony.xwork2.config.ConfigurationException;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.config.entities.InterceptorMapping;
+import com.opensymphony.xwork2.config.entities.ResultConfig;
+import com.opensymphony.xwork2.inject.Container;
+import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.interceptor.PreResultListener;
+import com.opensymphony.xwork2.util.ValueStack;
+import com.opensymphony.xwork2.util.ValueStackFactory;
+import com.opensymphony.xwork2.util.XWorkConverter;
+import com.opensymphony.xwork2.util.profiling.UtilTimerStack;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.rest.handler.MimeTypeHandler;
+
+import java.io.ByteArrayOutputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+/**
+ * The Default ActionInvocation implementation
+ *
+ * @author Rainer Hermanns
+ * @author tmjee
+ *
+ * @version $Date: 2007-04-26 23:36:51 +1000 (Thu, 26 Apr 2007) $ $Id: DefaultActionInvocation.java 1499 2007-04-26 13:36:51Z mrdon $
+ *
+ * @see com.opensymphony.xwork2.DefaultActionProxy
+ */
+public class RestActionInvocation extends DefaultActionInvocation {
+
+ private final Log LOG = LogFactory.getLog(RestActionInvocation.class);
+
+ private XWorkConverter converter;
+ private Map<String,MimeTypeHandler> handlers = new HashMap<String,MimeTypeHandler>();
+ private String defaultHandlerName;
+
+ protected RestActionInvocation(ObjectFactory objectFactory, UnknownHandler handler, ActionProxy proxy, Map extraContext, boolean pushAction, ActionEventListener actionEventListener) throws Exception {
+ super(objectFactory, handler, proxy, extraContext, pushAction,
+ actionEventListener);
+ }
+
+ protected RestActionInvocation(ObjectFactory objectFactory, UnknownHandler handler, ActionProxy proxy, Map extraContext, boolean pushAction) throws Exception {
+ super(objectFactory, handler, proxy, extraContext, pushAction);
+ }
+
+ protected RestActionInvocation(ObjectFactory objectFactory, UnknownHandler handler, ActionProxy proxy, Map extraContext) throws Exception {
+ super(objectFactory, handler, proxy, extraContext);
+ }
+
+ public void setXWorkConverter(XWorkConverter conv) {
+ this.converter = conv;
+ }
+
+ public void setDefaultHandlerName(String name) {
+ this.defaultHandlerName = name;
+ }
+
+ public void addMimeTypeHandler(String name, MimeTypeHandler handler) {
+ this.handlers.put(name, handler);
+ }
+
+ protected String invokeAction(Object action, ActionConfig actionConfig) throws Exception {
+
+ HttpServletRequest req = ServletActionContext.getRequest();
+ String extension = findExtension(req.getRequestURI());
+ if (extension == null) {
+ extension = defaultHandlerName;
+ }
+ System.out.println("extension:"+extension);
+ MimeTypeHandler handler = handlers.get(extension);
+ if (handler != null && req.getContentLength() > 0) {
+ invocationContext.getParameters().put("body", handler.toObject(req.getInputStream()));
+ }
+
+ String methodName = proxy.getMethod();
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Executing action method = " + actionConfig.getMethodName());
+ }
+
+ String timerKey = "invokeAction: "+proxy.getActionName();
+ try {
+ UtilTimerStack.push(timerKey);
+
+ boolean methodCalled = false;
+ Object methodResult = null;
+ MethodMatch methodMatch = null;
+ try {
+ methodMatch = findMethod(action, methodName, invocationContext.getParameters());
+ } catch (NoSuchMethodException e) {
+ // hmm -- OK, try doXxx instead
+ try {
+ String altMethodName = "do" + methodName.substring(0, 1).toUpperCase() + methodName.substring(1);
+ methodMatch = findMethod(action, altMethodName, invocationContext.getParameters());
+ } catch (NoSuchMethodException e1) {
+ throw e;
+ }
+ }
+
+ if (!methodCalled) {
+ methodResult = callAction(action, methodMatch, invocationContext.getParameters());
+ }
+
+ if (methodResult instanceof Result) {
+ this.result = (Result) methodResult;
+ return null;
+ } else {
+ if (handler != null && methodResult != null) {
+ return handler.fromObject(methodResult, this);
+ } else {
+ // treat as normal result code
+ return (String) methodResult;
+ }
+ }
+ } catch (NoSuchMethodException e) {
+ throw new IllegalArgumentException("The " + methodName + "() is not defined in action " + getAction().getClass() + "", e);
+ } catch (InvocationTargetException e) {
+ // We try to return the source exception.
+ Throwable t = e.getTargetException();
+
+ if (actionEventListener != null) {
+ String result = actionEventListener.handleException(t, getStack());
+ if (result != null) {
+ return result;
+ }
+ }
+ if (t instanceof Exception) {
+ throw(Exception) t;
+ } else {
+ throw e;
+ }
+ } finally {
+ UtilTimerStack.pop(timerKey);
+ }
+ }
+
+ protected Object callAction(Object action, MethodMatch methodMatch, Map reqParams) throws IllegalAccessException, InvocationTargetException {
+ Object methodResult;
+ Class[] argTypes = methodMatch.method.getParameterTypes();
+ Object[] args = new Object[argTypes.length];
+
+ int x=0;
+ for (String name : methodMatch.params) {
+ args[x] = converter.convertValue(null, reqParams.get(name), argTypes[x]);
+ x++;
+ }
+
+ methodResult = methodMatch.method.invoke(action, args);
+ return methodResult;
+ }
+
+ protected MethodMatch findMethod(Object action, String actionName, Map<String,String> params) throws NoSuchMethodException {
+
+ // Short cut so that only restful actions get the full method scan treatment
+ if (action.getClass().getAnnotation(Restful.class) == null && !(action instanceof BasicRestful)) {
+ return new MethodMatch(action.getClass().getMethod(actionName, new Class[0]), Collections.EMPTY_LIST);
+ }
+ Set<String> paramsInReq = params.keySet();
+
+ int max = -1;
+ Method method = null;
+ List<String> nameParams = null;
+
+ for (Method m : action.getClass().getMethods()) {
+ String methodName = m.getName();
+ if (methodName.startsWith(actionName)) {
+ int count = 0;
+ List<String> paramsInName = findParamsInName(methodName);
+ for (String paramName : paramsInName) {
+ if (paramsInReq.contains(paramName)) {
+ count++;
+ } else {
+ count = -1;
+ break;
+ }
+ }
+
+ if (count > max) {
+ max = count;
+ method = m;
+ nameParams = paramsInName;
+ }
+ }
+ }
+
+ if (method == null) {
+ throw new NoSuchMethodException("Unable to find method for "+actionName+" with params "+params.keySet());
+ }
+ return new MethodMatch(method, nameParams);
+ }
+
+ protected List<String> findParamsInName(String name) {
+ List<String> list = new ArrayList<String>();
+ int withPos = name.indexOf("With");
+ if (withPos > -1) {
+ String[] params = name.substring(withPos+4).split("And");
+ for (int x=0; x<params.length; x++) {
+ list.add(params[x].toLowerCase());
+ }
+ }
+ return list;
+ }
+
+ protected String findExtension(String url) {
+ int dotPos = url.lastIndexOf('.');
+ int slashPos = url.lastIndexOf('/');
+ if (dotPos > slashPos && dotPos > -1) {
+ return url.substring(dotPos+1);
+ }
+ return null;
+ }
+
+ static class MethodMatch {
+ public Method method;
+ public List<String> params;
+ public MethodMatch(Method method, List<String> params) {
+ super();
+ this.method = method;
+ this.params = params;
+ }
+
+
+ }
+
+
+}
Added: struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionMapper.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionMapper.java?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionMapper.java (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionMapper.java Tue Jul 17 05:56:15 2007
@@ -0,0 +1,393 @@
+/*
+ * $Id: Restful2ActionMapper.java 540819 2007-05-23 02:48:36Z mrdon $
+ *
+ * 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 org.apache.struts2.rest;
+
+import com.opensymphony.xwork2.config.Configuration;
+import com.opensymphony.xwork2.config.ConfigurationManager;
+import com.opensymphony.xwork2.config.entities.PackageConfig;
+import com.opensymphony.xwork2.inject.Inject;
+
+import javax.servlet.http.HttpServletRequest;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.net.URLDecoder;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.RequestUtils;
+import org.apache.struts2.StrutsConstants;
+import org.apache.struts2.dispatcher.mapper.ActionMapping;
+import org.apache.struts2.dispatcher.mapper.DefaultActionMapper;
+
+/**
+ * <!-- START SNIPPET: description -->
+ *
+ * Improved restful action mapper that adds several ReST-style improvements to
+ * action mapping, but supports fully-customized URL's via XML. The two primary
+ * ReST enhancements are:
+ * <ul>
+ * <li>If the method is not specified (via '!' or 'method:' prefix), the method is
+ * "guessed" at using ReST-style conventions that examine the URL and the HTTP
+ * method.</li>
+ * <li>Parameters are extracted from the action name, if parameter name/value pairs
+ * are specified using PARAM_NAME/PARAM_VALUE syntax.
+ * </ul>
+ * <p>
+ * These two improvements allow a GET request for 'category/action/movie/Thrillers' to
+ * be mapped to the action name 'movie' with an id of 'Thrillers' with an extra parameter
+ * named 'category' with a value of 'action'. A single action mapping can then handle
+ * all CRUD operations using wildcards, e.g.
+ * </p>
+ * <pre>
+ * <action name="movie/*" className="app.MovieAction">
+ * <param name="id">{0}</param>
+ * ...
+ * </action>
+ * </pre>
+ * <p>
+ * This mapper supports the following parameters:
+ * </p>
+ * <ul>
+ * <li><code>struts.mapper.idParameterName</code> - If set, this value will be the name
+ * of the parameter under which the id is stored. The id will then be removed
+ * from the action name. This allows restful actions to not require wildcards.
+ * </li>
+ * </ul>
+ * <p>
+ * The following URL's will invoke its methods:
+ * </p>
+ * <ul>
+ * <li><code>GET: /movie/ => method="index"</code></li>
+ * <li><code>GET: /movie/Thrillers => method="view", id="Thrillers"</code></li>
+ * <li><code>GET: /movie/Thrillers!edit => method="edit", id="Thrillers"</code></li>
+ * <li><code>GET: /movie/new => method="editNew"</code></li>
+ * <li><code>POST: /movie/ => method="create"</code></li>
+ * <li><code>PUT: /movie/Thrillers => method="update", id="Thrillers"</code></li>
+ * <li><code>DELETE: /movie/Thrillers => method="remove", id="Thrillers"</code></li>
+ * </ul>
+ * <p>
+ * To simulate the HTTP methods PUT and DELETE, since they aren't supported by HTML,
+ * the HTTP parameter "__http_method" will be used.
+ * </p>
+ * <p>
+ * The syntax and design for this feature was inspired by the ReST support in Ruby on Rails.
+ * See <a href="http://ryandaigle.com/articles/2006/08/01/whats-new-in-edge-rails-simply-restful-support-and-how-to-use-it">
+ * http://ryandaigle.com/articles/2006/08/01/whats-new-in-edge-rails-simply-restful-support-and-how-to-use-it
+ * </a>
+ * </p>
+ *
+ * <!-- END SNIPPET: description -->
+ */
+public class RestActionMapper extends DefaultActionMapper {
+
+ protected static final Log LOG = LogFactory.getLog(RestActionMapper.class);
+ public static final String HTTP_METHOD_PARAM = "__http_method";
+ private String idParameterName = null;
+ private boolean allowDynamicMethodCalls;
+ private List<String> extensions;
+
+ public RestActionMapper() {
+ }
+
+ @Inject(StrutsConstants.STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION)
+ public void setAllowDynamicMethodCalls(String allow) {
+ allowDynamicMethodCalls = "true".equals(allow);
+ }
+
+ @Inject(StrutsConstants.STRUTS_ACTION_EXTENSION)
+ public void setExtensions(String extensions) {
+ if (!"".equals(extensions)) {
+ this.extensions = Arrays.asList(extensions.split(","));
+ } else {
+ this.extensions = null;
+ }
+ }
+
+
+ public ActionMapping getMapping(HttpServletRequest request,
+ ConfigurationManager configManager) {
+ ActionMapping mapping = new ActionMapping();
+ String uri = getUri(request);
+
+ uri = dropExtension(uri);
+ if (uri == null) {
+ return null;
+ }
+
+ String fullName = parseNameAndNamespace(uri, mapping, configManager);
+
+ handleSpecialParameters(request, mapping);
+
+ if (mapping.getName() == null) {
+ return null;
+ }
+
+ if (allowDynamicMethodCalls) {
+ // handle "name!method" convention.
+ String name = mapping.getName();
+ int exclamation = name.lastIndexOf("!");
+ if (exclamation != -1) {
+ mapping.setName(name.substring(0, exclamation));
+ mapping.setMethod(name.substring(exclamation + 1));
+ }
+ }
+
+ // Only try something if the action name is specified
+ if (fullName != null && fullName.length() > 0) {
+ int lastSlashPos = fullName.lastIndexOf('/');
+
+ // If a method hasn't been explicitly named, try to guess using ReST-style patterns
+ if (mapping.getMethod() == null) {
+
+ if (lastSlashPos == fullName.length() -1) {
+
+ // Index e.g. foo/
+ if (isGet(request)) {
+ mapping.setMethod("index");
+
+ // Creating a new entry on POST e.g. foo/
+ } else if (isPost(request)) {
+ mapping.setMethod("create");
+ }
+
+ } else if (lastSlashPos > -1) {
+ String id = fullName.substring(lastSlashPos+1);
+
+ // Viewing the form to create a new item e.g. foo/new
+ if (isGet(request) && "new".equals(id)) {
+ mapping.setMethod("editNew");
+
+ // Viewing an item e.g. foo/1
+ } else if (isGet(request)) {
+ mapping.setMethod("view");
+
+ // Removing an item e.g. foo/1
+ } else if (isDelete(request)) {
+ mapping.setMethod("remove");
+
+ // Updating an item e.g. foo/1
+ } else if (isPut(request)) {
+ mapping.setMethod("update");
+ }
+
+ if (idParameterName != null) {
+ if (mapping.getParams() == null) {
+ mapping.setParams(new HashMap());
+ }
+ mapping.getParams().put(idParameterName, id);
+ }
+ }
+
+ if (idParameterName != null && lastSlashPos > -1) {
+ fullName = fullName.substring(0, lastSlashPos);
+ }
+ }
+
+ // Try to determine parameters from the url before the action name
+ int actionSlashPos = fullName.lastIndexOf('/', lastSlashPos - 1);
+ if (actionSlashPos > 0 && actionSlashPos < lastSlashPos) {
+ String params = fullName.substring(0, actionSlashPos);
+ HashMap<String,String> parameters = new HashMap<String,String>();
+ try {
+ StringTokenizer st = new StringTokenizer(params, "/");
+ boolean isNameTok = true;
+ String paramName = null;
+ String paramValue;
+
+ while (st.hasMoreTokens()) {
+ if (isNameTok) {
+ paramName = URLDecoder.decode(st.nextToken(), "UTF-8");
+ isNameTok = false;
+ } else {
+ paramValue = URLDecoder.decode(st.nextToken(), "UTF-8");
+
+ if ((paramName != null) && (paramName.length() > 0)) {
+ parameters.put(paramName, paramValue);
+ }
+
+ isNameTok = true;
+ }
+ }
+ if (parameters.size() > 0) {
+ if (mapping.getParams() == null) {
+ mapping.setParams(new HashMap());
+ }
+ mapping.getParams().putAll(parameters);
+ }
+ } catch (Exception e) {
+ LOG.warn(e);
+ }
+ fullName = fullName.substring(actionSlashPos+1);
+ }
+ mapping.setName(fullName);
+ }
+
+ return mapping;
+ }
+
+ /**
+ * Gets the uri from the request
+ *
+ * @param request
+ * The request
+ * @return The uri
+ */
+ String getUri(HttpServletRequest request) {
+ // handle http dispatcher includes.
+ String uri = (String) request
+ .getAttribute("javax.servlet.include.servlet_path");
+ if (uri != null) {
+ return uri;
+ }
+
+ uri = RequestUtils.getServletPath(request);
+ if (uri != null && !"".equals(uri)) {
+ return uri;
+ }
+
+ uri = request.getRequestURI();
+ return uri.substring(request.getContextPath().length());
+ }
+
+ /**
+ * Parses the name and namespace from the uri
+ *
+ * @param uri
+ * The uri
+ * @param mapping
+ * The action mapping to populate
+ */
+ String parseNameAndNamespace(String uri, ActionMapping mapping,
+ ConfigurationManager configManager) {
+ String namespace, name;
+ int lastSlash = uri.lastIndexOf("/");
+ if (lastSlash == -1) {
+ namespace = "";
+ name = uri;
+ } else if (lastSlash == 0) {
+ // ww-1046, assume it is the root namespace, it will fallback to
+ // default
+ // namespace anyway if not found in root namespace.
+ namespace = "/";
+ name = uri.substring(lastSlash + 1);
+ } else {
+ // Try to find the namespace in those defined, defaulting to ""
+ Configuration config = configManager.getConfiguration();
+ String prefix = uri.substring(0, lastSlash);
+ namespace = "";
+ // Find the longest matching namespace, defaulting to the default
+ for (Iterator i = config.getPackageConfigs().values().iterator(); i
+ .hasNext();) {
+ String ns = ((PackageConfig) i.next()).getNamespace();
+ if (ns != null && prefix.startsWith(ns) && (prefix.length() == ns.length() || prefix.charAt(ns.length()) == '/')) {
+ if (ns.length() > namespace.length()) {
+ namespace = ns;
+ }
+ }
+ }
+
+ name = uri.substring(namespace.length() + 1);
+ }
+ String fullName = name;
+
+ if (name != null) {
+ int pos = name.lastIndexOf('/');
+ if (pos > -1 && pos < name.length() - 1) {
+ name = name.substring(pos + 1);
+ }
+ }
+
+ mapping.setNamespace(namespace);
+ mapping.setName(name);
+ return fullName;
+ }
+
+ /**
+ * Drops the extension from the action name
+ *
+ * @param name
+ * The action name
+ * @return The action name without its extension
+ */
+ String dropExtension(String name) {
+ if (name != null) {
+ int pos = name.lastIndexOf('.');
+ if (pos > -1) {
+ return name.substring(0, name.lastIndexOf('.'));
+ } else {
+ return name;
+ }
+
+ }
+ return null;
+ }
+
+ /**
+ * Returns null if no extension is specified.
+ */
+ String getDefaultExtension() {
+ if (extensions == null) {
+ return null;
+ } else {
+ return (String) extensions.get(0);
+ }
+ }
+
+ protected boolean isGet(HttpServletRequest request) {
+ return "get".equalsIgnoreCase(request.getMethod());
+ }
+
+ protected boolean isPost(HttpServletRequest request) {
+ return "post".equalsIgnoreCase(request.getMethod());
+ }
+
+ protected boolean isPut(HttpServletRequest request) {
+ if ("put".equalsIgnoreCase(request.getMethod())) {
+ return true;
+ } else {
+ return isPost(request) && "put".equalsIgnoreCase(request.getParameter(HTTP_METHOD_PARAM));
+ }
+ }
+
+ protected boolean isDelete(HttpServletRequest request) {
+ if ("delete".equalsIgnoreCase(request.getMethod())) {
+ return true;
+ } else {
+ return isPost(request) && "delete".equalsIgnoreCase(request.getParameter(HTTP_METHOD_PARAM));
+ }
+ }
+
+ public String getIdParameterName() {
+ return idParameterName;
+ }
+
+ @Inject(required=false,value=StrutsConstants.STRUTS_ID_PARAMETER_NAME)
+ public void setIdParameterName(String idParameterName) {
+ this.idParameterName = idParameterName;
+ }
+
+
+
+}
Added: struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionProxy.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionProxy.java?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionProxy.java (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionProxy.java Tue Jul 17 05:56:15 2007
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package org.apache.struts2.rest;
+
+import com.opensymphony.xwork2.DefaultActionProxy;
+import com.opensymphony.xwork2.XWorkMessages;
+import com.opensymphony.xwork2.util.TextUtils;
+import com.opensymphony.xwork2.util.XWorkConverter;
+import com.opensymphony.xwork2.config.Configuration;
+import com.opensymphony.xwork2.config.ConfigurationException;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.inject.Container;
+import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.util.LocalizedTextUtil;
+import com.opensymphony.xwork2.util.profiling.UtilTimerStack;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.rest.handler.MimeTypeHandler;
+
+import java.io.Serializable;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * The Default ActionProxy implementation
+ *
+ * @author Rainer Hermanns
+ * @author Revised by <a href="mailto:hu_pengfei@yahoo.com.cn">Henry Hu</a>
+ * @author tmjee
+ *
+ * @version $Date: 2007-04-01 02:33:23 +1000 (Sun, 01 Apr 2007) $ $Id: DefaultActionProxy.java 1415 2007-03-31 16:33:23Z rainerh $
+ * @since 2005-8-6
+ */
+public class RestActionProxy extends DefaultActionProxy {
+
+ private final Log LOG = LogFactory.getLog(RestActionProxy.class);
+ private XWorkConverter xworkConverter;
+ private String defaultHandlerName;
+ private Container container;
+
+ public RestActionProxy(String namespace, String actionName, Map extraContext, boolean executeResult, boolean cleanupContext) throws Exception {
+ super(namespace, actionName, extraContext, executeResult, cleanupContext);
+ }
+
+ @Inject
+ public void setXWorkConverter(XWorkConverter conv) {
+ this.xworkConverter = conv;
+ }
+
+ @Inject("struts.rest.defaultHandlerName")
+ public void setDefaultHandlerName(String name) {
+ this.defaultHandlerName = name;
+ }
+
+ @Inject
+ public void setContainer(Container cont) {
+ this.container = cont;
+ }
+
+ public void prepare() throws Exception {
+ String profileKey = "create RestActionProxy: ";
+ try {
+ UtilTimerStack.push(profileKey);
+ config = configuration.getRuntimeConfiguration().getActionConfig(namespace, actionName);
+
+ if (config == null && unknownHandler != null) {
+ config = unknownHandler.handleUnknownAction(namespace, actionName);
+ }
+ if (config == null) {
+ String message;
+
+ if ((namespace != null) && (namespace.trim().length() > 0)) {
+ message = LocalizedTextUtil.findDefaultText(XWorkMessages.MISSING_PACKAGE_ACTION_EXCEPTION, Locale.getDefault(), new String[]{
+ namespace, actionName
+ });
+ } else {
+ message = LocalizedTextUtil.findDefaultText(XWorkMessages.MISSING_ACTION_EXCEPTION, Locale.getDefault(), new String[]{
+ actionName
+ });
+ }
+ throw new ConfigurationException(message);
+ }
+
+ invocation = new RestActionInvocation(objectFactory, unknownHandler, this, extraContext, true, actionEventListener);
+ ((RestActionInvocation)invocation).setXWorkConverter(xworkConverter);
+ ((RestActionInvocation)invocation).setDefaultHandlerName(defaultHandlerName);
+ Set<String> names = container.getInstanceNames(MimeTypeHandler.class);
+ for (String name : names) {
+ ((RestActionInvocation)invocation).addMimeTypeHandler(name, container.getInstance(MimeTypeHandler.class, name));
+ }
+
+ resolveMethod();
+ } finally {
+ UtilTimerStack.pop(profileKey);
+ }
+ }
+
+ private void resolveMethod() {
+ // if the method is set to null, use the one from the configuration
+ // if the one from the configuration is also null, use "execute"
+ if (!TextUtils.stringSet(this.method)) {
+ this.method = config.getMethodName();
+ if (!TextUtils.stringSet(this.method)) {
+ this.method = "execute";
+ }
+ }
+ }
+
+ public String getDefaultHandlerName() {
+ return defaultHandlerName;
+ }
+
+ public XWorkConverter getXWorkConverter() {
+ return xworkConverter;
+ }
+
+
+}
Added: struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionProxyFactory.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionProxyFactory.java?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionProxyFactory.java (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestActionProxyFactory.java Tue Jul 17 05:56:15 2007
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2002-2007 by OpenSymphony
+ * All rights reserved.
+ */
+package org.apache.struts2.rest;
+
+import java.util.Map;
+
+import com.opensymphony.xwork2.ActionProxy;
+import com.opensymphony.xwork2.DefaultActionProxyFactory;
+import com.opensymphony.xwork2.inject.Container;
+import com.opensymphony.xwork2.inject.Inject;
+
+
+/**
+ *
+ */
+public class RestActionProxyFactory extends DefaultActionProxyFactory {
+
+ public ActionProxy createActionProxy(String namespace, String actionName, Map extraContext, boolean executeResult, boolean cleanupContext) throws Exception {
+ ActionProxy proxy = new RestActionProxy(namespace, actionName, extraContext, executeResult, cleanupContext);
+ container.inject(proxy);
+ proxy.prepare();
+ return proxy;
+ }
+
+}
Added: struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/Restful.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/Restful.java?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/Restful.java (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/Restful.java Tue Jul 17 05:56:15 2007
@@ -0,0 +1,9 @@
+package org.apache.struts2.rest;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Restful {
+
+}
Added: struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/HtmlHandler.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/HtmlHandler.java?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/HtmlHandler.java (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/HtmlHandler.java Tue Jul 17 05:56:15 2007
@@ -0,0 +1,21 @@
+package org.apache.struts2.rest.handler;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collections;
+
+import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ActionInvocation;
+
+public class HtmlHandler implements MimeTypeHandler {
+
+ public String fromObject(Object obj, ActionInvocation inv) throws IOException {
+ inv.getStack().push(Collections.singletonMap("body", obj));
+ return Action.SUCCESS;
+ }
+
+ public Object toObject(InputStream in) {
+ return null;
+ }
+
+}
Added: struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/MimeTypeHandler.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/MimeTypeHandler.java?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/MimeTypeHandler.java (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/MimeTypeHandler.java Tue Jul 17 05:56:15 2007
@@ -0,0 +1,13 @@
+package org.apache.struts2.rest.handler;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import com.opensymphony.xwork2.ActionInvocation;
+
+public interface MimeTypeHandler {
+ Object toObject(InputStream in);
+
+ String fromObject(Object obj, ActionInvocation inv) throws IOException;
+}
Added: struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java Tue Jul 17 05:56:15 2007
@@ -0,0 +1,41 @@
+package org.apache.struts2.rest.handler;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts2.ServletActionContext;
+
+import com.opensymphony.xwork2.ActionInvocation;
+import com.thoughtworks.xstream.XStream;
+
+public class XStreamHandler implements MimeTypeHandler {
+
+ public String fromObject(Object obj, ActionInvocation inv) throws IOException {
+ HttpServletResponse response = ServletActionContext.getResponse();
+ XStream xstream = createXStream();
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ xstream.toXML(obj, bout);
+ response.getOutputStream().write(bout.toByteArray());
+ response.setContentLength(bout.size());
+ response.setContentType(getContentType());
+ return null;
+ }
+
+ public Object toObject(InputStream in) {
+ XStream xstream = createXStream();
+ return xstream.fromXML(in);
+ }
+
+ protected XStream createXStream() {
+ return new XStream();
+ }
+
+ public String getContentType() {
+ return "text/xml";
+ }
+
+}
Added: struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/XStreamJsonHandler.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/XStreamJsonHandler.java?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/XStreamJsonHandler.java (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/XStreamJsonHandler.java Tue Jul 17 05:56:15 2007
@@ -0,0 +1,19 @@
+package org.apache.struts2.rest.handler;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
+
+public class XStreamJsonHandler extends XStreamHandler {
+
+ @Override
+ protected XStream createXStream() {
+ return new XStream(new JettisonMappedXmlDriver());
+ }
+
+ @Override
+ public String getContentType() {
+ return "text/javascript";
+ }
+
+
+}
Added: struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml Tue Jul 17 05:56:15 2007
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!DOCTYPE struts PUBLIC
+ "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+ "http://struts.apache.org/dtds/struts-2.0.dtd">
+
+<struts>
+
+ <bean type="com.opensymphony.xwork2.ActionProxyFactory" name="rest" class="org.apache.struts2.rest.RestActionProxyFactory" />
+ <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="rest" class="org.apache.struts2.rest.RestActionMapper" />
+
+ <bean type="org.apache.struts2.rest.handler.MimeTypeHandler" name="xml" class="org.apache.struts2.rest.handler.XStreamHandler" />
+ <bean type="org.apache.struts2.rest.handler.MimeTypeHandler" name="js" class="org.apache.struts2.rest.handler.XStreamJsonHandler" />
+ <bean type="org.apache.struts2.rest.handler.MimeTypeHandler" name="html" class="org.apache.struts2.rest.handler.HtmlHandler" />
+
+ <constant name="struts.actionProxyFactory" value="rest" />
+ <constant name="struts.rest.defaultHandlerName" value="xml" />
+ <constant name="struts.mapper.class" value="rest" />
+ <constant name="struts.mapper.idParameterName" value="id" />
+ <constant name="struts.action.extension" value="" />
+ <constant name="struts.configuration.classpath.defaultParentPackage" value="rest-default" />
+
+ <package name="rest-default" extends="struts-default">
+ <default-interceptor-ref name="basicStack"/>
+ </package>
+
+</struts>
Added: struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/struts2/rest/RestActionInvoicationTest.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/struts2/rest/RestActionInvoicationTest.java?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/struts2/rest/RestActionInvoicationTest.java (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/struts2/rest/RestActionInvoicationTest.java Tue Jul 17 05:56:15 2007
@@ -0,0 +1,169 @@
+package org.apache.struts2.rest;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import org.apache.struts2.StrutsTestCase;
+import org.apache.struts2.rest.RestActionInvocation.MethodMatch;
+
+import com.mockobjects.dynamic.Mock;
+import com.opensymphony.xwork2.ActionProxy;
+import com.opensymphony.xwork2.ObjectFactory;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.util.XWorkConverter;
+
+import junit.framework.TestCase;
+
+public class RestActionInvoicationTest extends StrutsTestCase {
+
+ RestActionInvocation inv;
+ Mock mockActionProxy;
+
+ protected void setUp() throws Exception {
+ //super.setUp();
+ mockActionProxy = new Mock(ActionProxy.class);
+ mockActionProxy.matchAndReturn("getActionName", "bob");
+ mockActionProxy.matchAndReturn("getNamespace", "foo");
+ mockActionProxy.matchAndReturn("getConfig", new ActionConfig());
+
+ ObjectFactory objFactory = new ObjectFactory() {
+ public Object buildAction(String action, String namespace, ActionConfig config, Map params) {
+ return new FooAction();
+ }
+ };
+ inv = new RestActionInvocation(objFactory,null, (ActionProxy) mockActionProxy.proxy(), null);
+ inv.setXWorkConverter(XWorkConverter.getInstance());
+ }
+
+ public void testFindParamsInName() throws Exception {
+ String[] params = new String[] {"foo", "bar"};
+ assertEquals(Arrays.asList(params), inv.findParamsInName("indexWithFooAndBar"));
+ }
+
+ public void testFindParamsInName_oneParam() throws Exception {
+ String[] params = new String[] {"foo"};
+ assertEquals(Arrays.asList(params), inv.findParamsInName("indexWithFoo"));
+ }
+
+ public void testFindParamsInName_noParams() throws Exception {
+ assertEquals(new ArrayList(), inv.findParamsInName("index"));
+ }
+
+ public void testFindMethod() throws Exception, NoSuchMethodException {
+
+ Map<String,String> params = new HashMap<String,String>() {{
+ put("foo", "sd");
+ put("bar", "3");
+ }};
+
+ Method found = inv.findMethod(new FooAction(), "index", params).method;
+ Method expected = FooAction.class.getDeclaredMethod("indexWithFooAndBar", new Class[]{String.class, int.class});
+ assertEquals(expected, found);
+ }
+
+ public void testFindMethod_missingParams() throws Exception, NoSuchMethodException {
+
+ Map<String,String> params = new HashMap<String,String>() {{
+ put("foo", "sd");
+ }};
+
+ try {
+ inv.findMethod(new FooAction(), "update", params);
+ fail("Should have thrown exception");
+ } catch (NoSuchMethodException ex) {
+ // success
+ }
+ }
+
+ public void testFindMethod_noParams() throws Exception, NoSuchMethodException {
+
+ Method found = inv.findMethod(new FooAction(), "noarg", new HashMap()).method;
+ Method expected = FooAction.class.getDeclaredMethod("noarg", new Class[]{});
+ assertEquals(expected, found);
+ }
+
+ public void testCallAction() throws Exception {
+ FooAction action = new FooAction();
+ Method method = FooAction.class.getDeclaredMethod("indexWithFooAndBar", new Class[]{String.class, int.class});
+ Map reqParams = new HashMap() {{
+ put("foo", "bar");
+ put("bar", "3");
+ }};
+ MethodMatch match = new MethodMatch(method, Arrays.asList("foo", "bar"));
+
+ String ret = (String) inv.callAction(action, match, reqParams);
+
+ assertEquals("index:bar:3", ret);
+ }
+
+ public void testCallAction_oneParam() throws Exception {
+ FooAction action = new FooAction();
+ Method method = FooAction.class.getDeclaredMethod("indexWithFoo", new Class[]{String.class});
+ Map reqParams = new HashMap() {{
+ put("foo", "bar");
+ put("bar", "3");
+ }};
+ MethodMatch match = new MethodMatch(method, Arrays.asList("foo"));
+
+ String ret = (String) inv.callAction(action, match, reqParams);
+
+ assertEquals("index:bar", ret);
+ }
+
+ public void testCallAction_noParam() throws Exception {
+ FooAction action = new FooAction();
+ Method method = FooAction.class.getDeclaredMethod("index", new Class[]{});
+ Map reqParams = new HashMap() {{
+ put("foo", "bar");
+ put("bar", "3");
+ }};
+ MethodMatch match = new MethodMatch(method, new ArrayList());
+
+ String ret = (String) inv.callAction(action, match, reqParams);
+
+ assertEquals("index", ret);
+ }
+
+ public void testCallAction_withBody() throws Exception {
+ FooAction action = new FooAction();
+ Method method = FooAction.class.getDeclaredMethod("createWithBody", new Class[]{String.class});
+ Map reqParams = new HashMap() {{
+ put("foo", "bar");
+ put("bar", "3");
+ put("body", "jim");
+ }};
+ MethodMatch match = new MethodMatch(method, Collections.singletonList("body"));
+
+ String ret = (String) inv.callAction(action, match, reqParams);
+
+ assertEquals("create:jim", ret);
+ }
+
+ @Restful
+ static class FooAction {
+ public String index() {
+ return "index";
+ }
+ public String indexWithFoo(String foo) {
+ return "index:"+foo;
+ }
+ public String indexWithFooAndBar(String foo, int bar) {
+ return "index:"+foo+":"+bar;
+ }
+
+ public void updateWithFooAndBar(String foo, int bar) {}
+
+ public String createWithBody(String data) {
+ return "create:"+data;
+ }
+
+ public void noarg() {}
+
+ }
+
+}
Added: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/BasicRestful.class
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/BasicRestful.class?view=auto&rev=556913
==============================================================================
Binary file - no diff available.
Propchange: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/BasicRestful.class
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionInvocation$MethodMatch.class
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionInvocation%24MethodMatch.class?view=auto&rev=556913
==============================================================================
Binary file - no diff available.
Propchange: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionInvocation$MethodMatch.class
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionInvocation.class
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionInvocation.class?view=auto&rev=556913
==============================================================================
Binary file - no diff available.
Propchange: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionInvocation.class
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionMapper.class
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionMapper.class?view=auto&rev=556913
==============================================================================
Binary file - no diff available.
Propchange: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionMapper.class
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionProxy.class
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionProxy.class?view=auto&rev=556913
==============================================================================
Binary file - no diff available.
Propchange: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionProxy.class
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionProxyFactory.class
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionProxyFactory.class?view=auto&rev=556913
==============================================================================
Binary file - no diff available.
Propchange: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/RestActionProxyFactory.class
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/Restful.class
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/Restful.class?view=auto&rev=556913
==============================================================================
Binary file - no diff available.
Propchange: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/Restful.class
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/HtmlHandler.class
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/HtmlHandler.class?view=auto&rev=556913
==============================================================================
Binary file - no diff available.
Propchange: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/HtmlHandler.class
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/MimeTypeHandler.class
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/MimeTypeHandler.class?view=auto&rev=556913
==============================================================================
Binary file - no diff available.
Propchange: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/MimeTypeHandler.class
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/XStreamHandler.class
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/XStreamHandler.class?view=auto&rev=556913
==============================================================================
Binary file - no diff available.
Propchange: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/XStreamHandler.class
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/XStreamJsonHandler.class
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/XStreamJsonHandler.class?view=auto&rev=556913
==============================================================================
Binary file - no diff available.
Propchange: struts/sandbox/trunk/struts2-rest-plugin/target/classes/org/apache/struts2/rest/handler/XStreamJsonHandler.class
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: struts/sandbox/trunk/struts2-rest-plugin/target/classes/struts-plugin.xml
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/target/classes/struts-plugin.xml?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/target/classes/struts-plugin.xml (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/target/classes/struts-plugin.xml Tue Jul 17 05:56:15 2007
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!DOCTYPE struts PUBLIC
+ "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+ "http://struts.apache.org/dtds/struts-2.0.dtd">
+
+<struts>
+
+ <bean type="com.opensymphony.xwork2.ActionProxyFactory" name="rest" class="org.apache.struts2.rest.RestActionProxyFactory" />
+ <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="rest" class="org.apache.struts2.rest.RestActionMapper" />
+
+ <bean type="org.apache.struts2.rest.handler.MimeTypeHandler" name="xml" class="org.apache.struts2.rest.handler.XStreamHandler" />
+ <bean type="org.apache.struts2.rest.handler.MimeTypeHandler" name="js" class="org.apache.struts2.rest.handler.XStreamJsonHandler" />
+ <bean type="org.apache.struts2.rest.handler.MimeTypeHandler" name="html" class="org.apache.struts2.rest.handler.HtmlHandler" />
+
+ <constant name="struts.actionProxyFactory" value="rest" />
+ <constant name="struts.rest.defaultHandlerName" value="xml" />
+ <constant name="struts.mapper.class" value="rest" />
+ <constant name="struts.mapper.idParameterName" value="id" />
+ <constant name="struts.action.extension" value="" />
+ <constant name="struts.configuration.classpath.defaultParentPackage" value="rest-default" />
+
+ <package name="rest-default" extends="struts-default">
+ <default-interceptor-ref name="basicStack"/>
+ </package>
+
+</struts>
Added: struts/sandbox/trunk/struts2-rest-plugin/target/struts2-rest-plugin-1.0-SNAPSHOT.jar
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/target/struts2-rest-plugin-1.0-SNAPSHOT.jar?view=auto&rev=556913
==============================================================================
Binary file - no diff available.
Propchange: struts/sandbox/trunk/struts2-rest-plugin/target/struts2-rest-plugin-1.0-SNAPSHOT.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: struts/sandbox/trunk/struts2-rest-plugin/target/surefire-reports/TEST-org.apache.struts2.rest.RestActionInvoicationTest.xml
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/target/surefire-reports/TEST-org.apache.struts2.rest.RestActionInvoicationTest.xml?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/target/surefire-reports/TEST-org.apache.struts2.rest.RestActionInvoicationTest.xml (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/target/surefire-reports/TEST-org.apache.struts2.rest.RestActionInvoicationTest.xml Tue Jul 17 05:56:15 2007
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuite errors="0" skipped="0" tests="10" time="0.174" failures="0" name="org.apache.struts2.rest.RestActionInvoicationTest">
+ <properties>
+ <property value="Java(TM) 2 Runtime Environment, Standard Edition" name="java.runtime.name"/>
+ <property value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/i386" name="sun.boot.library.path"/>
+ <property value="1.5.0_06-b05" name="java.vm.version"/>
+ <property value="Sun Microsystems Inc." name="java.vm.vendor"/>
+ <property value="http://java.sun.com/" name="java.vendor.url"/>
+ <property value=":" name="path.separator"/>
+ <property value="Java HotSpot(TM) Server VM" name="java.vm.name"/>
+ <property value="sun.io" name="file.encoding.pkg"/>
+ <property value="US" name="user.country"/>
+ <property value="unknown" name="sun.os.patch.level"/>
+ <property value="Java Virtual Machine Specification" name="java.vm.specification.name"/>
+ <property value="/home/mrdon/dev/struts/sandbox/struts2-rest-plugin" name="user.dir"/>
+ <property value="1.5.0_06-b05" name="java.runtime.version"/>
+ <property value="sun.awt.X11GraphicsEnvironment" name="java.awt.graphicsenv"/>
+ <property value="/home/mrdon/dev/struts/sandbox/struts2-rest-plugin" name="basedir"/>
+ <property value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/endorsed" name="java.endorsed.dirs"/>
+ <property value="i386" name="os.arch"/>
+ <property value="/tmp" name="java.io.tmpdir"/>
+ <property value="
+" name="line.separator"/>
+ <property value="Sun Microsystems Inc." name="java.vm.specification.vendor"/>
+ <property value="Linux" name="os.name"/>
+ <property value="ANSI_X3.4-1968" name="sun.jnu.encoding"/>
+ <property value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/i386/server:/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/i386:/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/../lib/i386" name="java.library.path"/>
+ <property value="Java Platform API Specification" name="java.specification.name"/>
+ <property value="49.0" name="java.class.version"/>
+ <property value="HotSpot Server Compiler" name="sun.management.compiler"/>
+ <property value="2.6.20-16-generic" name="os.version"/>
+ <property value="/home/mrdon" name="user.home"/>
+ <property value="GMT+10:00" name="user.timezone"/>
+ <property value="sun.print.PSPrinterJob" name="java.awt.printerjob"/>
+ <property value="ANSI_X3.4-1968" name="file.encoding"/>
+ <property value="1.5" name="java.specification.version"/>
+ <property value="mrdon" name="user.name"/>
+ <property value="/home/mrdon/.m2/repository/org/apache/maven/surefire/surefire-api/2.0/surefire-api-2.0.jar:/home/mrdon/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar:/home/mrdon/.m2/repository/org/apache/maven/surefire/surefire-booter/2.0/surefire-booter-2.0.jar" name="java.class.path"/>
+ <property value="1.0" name="java.vm.specification.version"/>
+ <property value="32" name="sun.arch.data.model"/>
+ <property value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre" name="java.home"/>
+ <property value="Sun Microsystems Inc." name="java.specification.vendor"/>
+ <property value="en" name="user.language"/>
+ <property value="mixed mode" name="java.vm.info"/>
+ <property value="1.5.0_06" name="java.version"/>
+ <property value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/ext" name="java.ext.dirs"/>
+ <property value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/rt.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/i18n.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/jsse.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/jce.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/charsets.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/classes" name="sun.boot.class.path"/>
+ <property value="Sun Microsystems Inc." name="java.vendor"/>
+ <property value="/home/mrdon/.m2/repository" name="localRepository"/>
+ <property value="/" name="file.separator"/>
+ <property value="http://java.sun.com/cgi-bin/bugreport.cgi" name="java.vendor.url.bug"/>
+ <property value="little" name="sun.cpu.endian"/>
+ <property value="UnicodeLittle" name="sun.io.unicode.encoding"/>
+ <property value="gnome" name="sun.desktop"/>
+ <property value="" name="sun.cpu.isalist"/>
+ </properties>
+ <testcase time="0.134" name="testFindParamsInName"/>
+ <testcase time="0" name="testFindParamsInName_oneParam"/>
+ <testcase time="0" name="testFindParamsInName_noParams"/>
+ <testcase time="0.016" name="testFindMethod"/>
+ <testcase time="0.001" name="testFindMethod_missingParams"/>
+ <testcase time="0.001" name="testFindMethod_noParams"/>
+ <testcase time="0.003" name="testCallAction"/>
+ <testcase time="0.001" name="testCallAction_oneParam"/>
+ <testcase time="0" name="testCallAction_noParam"/>
+ <testcase time="0.001" name="testCallAction_withBody"/>
+</testsuite>
\ No newline at end of file
Added: struts/sandbox/trunk/struts2-rest-plugin/target/surefire-reports/org.apache.struts2.rest.RestActionInvoicationTest.txt
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/target/surefire-reports/org.apache.struts2.rest.RestActionInvoicationTest.txt?view=auto&rev=556913
==============================================================================
--- struts/sandbox/trunk/struts2-rest-plugin/target/surefire-reports/org.apache.struts2.rest.RestActionInvoicationTest.txt (added)
+++ struts/sandbox/trunk/struts2-rest-plugin/target/surefire-reports/org.apache.struts2.rest.RestActionInvoicationTest.txt Tue Jul 17 05:56:15 2007
@@ -0,0 +1,4 @@
+-------------------------------------------------------------------------------
+Test set: org.apache.struts2.rest.RestActionInvoicationTest
+-------------------------------------------------------------------------------
+Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.18 sec
Added: struts/sandbox/trunk/struts2-rest-plugin/target/test-classes/org/apache/struts2/rest/RestActionInvoicationTest$1.class
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/target/test-classes/org/apache/struts2/rest/RestActionInvoicationTest%241.class?view=auto&rev=556913
==============================================================================
Binary file - no diff available.