Author: musachy
Date: Thu Dec 18 19:15:23 2008
New Revision: 727908

URL: http://svn.apache.org/viewvc?rev=727908&view=rev
Log:
WW-2926 Port rest-showcase to use convention plugin

Added:
    struts/struts2/trunk/apps/rest-showcase/src/main/resources/struts.xml
    struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/
    
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-deleteConfirm.jsp
    
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-edit.jsp
    
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-editNew.jsp
    
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-index.jsp
    
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-show.jsp
Removed:
    
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/orders-deleteConfirm.jsp
    struts/struts2/trunk/apps/rest-showcase/src/main/webapp/orders-edit.jsp
    struts/struts2/trunk/apps/rest-showcase/src/main/webapp/orders-editNew.jsp
    struts/struts2/trunk/apps/rest-showcase/src/main/webapp/orders-index.jsp
    struts/struts2/trunk/apps/rest-showcase/src/main/webapp/orders-show.jsp
Modified:
    struts/struts2/trunk/apps/rest-showcase/pom.xml
    
struts/struts2/trunk/apps/rest-showcase/src/main/java/org/apache/struts2/rest/example/OrdersController.java
    struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/web.xml

Modified: struts/struts2/trunk/apps/rest-showcase/pom.xml
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/rest-showcase/pom.xml?rev=727908&r1=727907&r2=727908&view=diff
==============================================================================
--- struts/struts2/trunk/apps/rest-showcase/pom.xml (original)
+++ struts/struts2/trunk/apps/rest-showcase/pom.xml Thu Dec 18 19:15:23 2008
@@ -44,7 +44,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.struts</groupId>
-            <artifactId>struts2-codebehind-plugin</artifactId>
+            <artifactId>struts2-convention-plugin</artifactId>
             <version>${pom.version}</version>
         </dependency>
         <dependency>

Modified: 
struts/struts2/trunk/apps/rest-showcase/src/main/java/org/apache/struts2/rest/example/OrdersController.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/rest-showcase/src/main/java/org/apache/struts2/rest/example/OrdersController.java?rev=727908&r1=727907&r2=727908&view=diff
==============================================================================
--- 
struts/struts2/trunk/apps/rest-showcase/src/main/java/org/apache/struts2/rest/example/OrdersController.java
 (original)
+++ 
struts/struts2/trunk/apps/rest-showcase/src/main/java/org/apache/struts2/rest/example/OrdersController.java
 Thu Dec 18 19:15:23 2008
@@ -2,19 +2,25 @@
 
 import java.util.Collection;
 
-import org.apache.struts2.config.Result;
-import org.apache.struts2.config.Results;
 import org.apache.struts2.dispatcher.ServletActionRedirectResult;
 import org.apache.struts2.rest.DefaultHttpHeaders;
 import org.apache.struts2.rest.HttpHeaders;
+import org.apache.struts2.convention.annotation.Results;
+import org.apache.struts2.convention.annotation.Result;
+import org.apache.struts2.convention.annotation.ParentPackage;
+import org.apache.struts2.convention.annotation.Namespaces;
+import org.apache.struts2.convention.annotation.Namespace;
+import org.apache.struts2.convention.annotation.InterceptorRef;
 
 import com.opensymphony.xwork2.ModelDriven;
 import com.opensymphony.xwork2.Validateable;
 import com.opensymphony.xwork2.ValidationAwareSupport;
 
 @Results({
-    @Result(name="success", type=ServletActionRedirectResult.class, 
value="orders") 
+    @Result(name="success", type="redirectAction", params = {"actionName" , 
"orders"})
 })
+...@namespace("")
+...@interceptorref("restDefaultStack")
 public class OrdersController extends ValidationAwareSupport implements 
ModelDriven<Object>, Validateable{
     
     private Order model = new Order();

Added: struts/struts2/trunk/apps/rest-showcase/src/main/resources/struts.xml
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/rest-showcase/src/main/resources/struts.xml?rev=727908&view=auto
==============================================================================
--- struts/struts2/trunk/apps/rest-showcase/src/main/resources/struts.xml 
(added)
+++ struts/struts2/trunk/apps/rest-showcase/src/main/resources/struts.xml Thu 
Dec 18 19:15:23 2008
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+/*
+ * $Id: struts-plugin.xml 722219 2008-12-01 20:41:26Z musachy $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+-->
+
+<!DOCTYPE struts PUBLIC
+        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+        "http://struts.apache.org/dtds/struts-2.0.dtd";>
+
+<struts>
+    <constant name="struts.convention.action.suffix" value="Controller"/>
+    <constant name="struts.convention.action.mapAllMatches" value="true"/>
+    <constant name="struts.convention.default.parent.package" 
value="rest-default"/>
+
+</struts>
\ No newline at end of file

Added: 
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-deleteConfirm.jsp
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-deleteConfirm.jsp?rev=727908&view=auto
==============================================================================
--- 
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-deleteConfirm.jsp
 (added)
+++ 
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-deleteConfirm.jsp
 Thu Dec 18 19:15:23 2008
@@ -0,0 +1,23 @@
+<!DOCTYPE html PUBLIC 
+       "-//W3C//DTD XHTML 1.1 Transitional//EN"
+       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+<head>
+       <title>Order ${id}</title>
+</head>
+<body>
+    <form action="../${id}?_method=DELETE" method="post">
+        <p>
+            Are you sure you want to delete order ${id}?
+        </p>
+        <div>
+            <input type="submit" value="Delete" />
+            <input type="button" value="Cancel" onclick="window.location.href 
= '../../orders'" />
+        </div>
+    </form>
+    <br />
+    <a href="../../orders">Back to Orders</a>
+</body>
+</html>
+       
\ No newline at end of file

Added: 
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-edit.jsp
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-edit.jsp?rev=727908&view=auto
==============================================================================
--- 
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-edit.jsp
 (added)
+++ 
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-edit.jsp
 Thu Dec 18 19:15:23 2008
@@ -0,0 +1,27 @@
+<!DOCTYPE html PUBLIC 
+       "-//W3C//DTD XHTML 1.1 Transitional//EN"
+       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+       
+<%...@taglib prefix="s" uri="/struts-tags" %>
+
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+<head>
+       <title>Order <s:property value="id" /></title>
+</head>
+<body>
+    <s:form method="post" action="%{#request.contextPath}/orders/%{id}">
+    <s:hidden name="_method" value="put" />
+    <table>
+        <s:textfield name="id" label="ID" disabled="true"/>
+        <s:textfield name="clientName" label="Client"/>
+        <s:textfield name="amount" label="Amount" />
+        <tr>
+            <td colspan="2">
+                <s:submit />
+            </td>
+    </table>
+    </s:form>          
+    <a href="<%=request.getContextPath() %>/orders">Back to Orders</a>
+</body>
+</html>
+       
\ No newline at end of file

Added: 
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-editNew.jsp
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-editNew.jsp?rev=727908&view=auto
==============================================================================
--- 
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-editNew.jsp
 (added)
+++ 
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-editNew.jsp
 Thu Dec 18 19:15:23 2008
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC 
+       "-//W3C//DTD XHTML 1.1 Transitional//EN"
+       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+       
+<%...@taglib prefix="s" uri="/struts-tags" %>
+
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+<head>
+       <title>New Order</title>
+</head>
+<body>
+    <s:form method="post" action="%{#request.contextPath}/orders">
+    <table>
+        <s:textfield name="clientName" label="Client"/>
+        <s:textfield name="amount" label="Amount" />
+        <tr>
+            <td colspan="2">
+                <s:submit />
+            </td>
+    </table>
+    </s:form>          
+    <a href="<%=request.getContextPath() %>/orders">Back to Orders</a>
+</body>
+</html>
+       
\ No newline at end of file

Added: 
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-index.jsp
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-index.jsp?rev=727908&view=auto
==============================================================================
--- 
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-index.jsp
 (added)
+++ 
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-index.jsp
 Thu Dec 18 19:15:23 2008
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC 
+       "-//W3C//DTD XHTML 1.1 Transitional//EN"
+       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+
+<%...@taglib prefix="s" uri="/struts-tags" %>
+
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+<head>
+       <title>Orders</title>
+</head>
+<body>
+    <s:actionmessage />
+    <table>
+        <tr>
+            <th>ID</th>
+            <th>Client</th>
+            <th>Amount</th>
+            <th>Actions</th>
+        </tr>
+        <s:iterator value="model">
+        <tr>
+            <td>${id}</td>
+            <td>${clientName}</td>
+            <td>${amount}</td>
+            <td><a href="orders/${id}">View</a> |
+                <a href="orders/${id}/edit">Edit</a> |
+                <a href="orders/${id}/deleteConfirm">Delete</a></td>
+        </tr>
+        </s:iterator>
+    </table>           
+    <a href="orders/new">Create a new order</a>
+</body>
+</html>
+       
\ No newline at end of file

Added: 
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-show.jsp
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-show.jsp?rev=727908&view=auto
==============================================================================
--- 
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-show.jsp
 (added)
+++ 
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/content/orders-show.jsp
 Thu Dec 18 19:15:23 2008
@@ -0,0 +1,27 @@
+<!DOCTYPE html PUBLIC 
+       "-//W3C//DTD XHTML 1.1 Transitional//EN"
+       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+       
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+<head>
+       <title>Order ${id}</title>
+</head>
+<body>
+    <table>
+        <tr>
+            <th>ID</th>
+            <td>${id}</td>
+        </tr>
+        <tr>
+            <th>Client</th>
+            <td>${clientName}</td>
+        </tr>
+        <tr>
+            <th>Amount</th>
+            <td>${amount}</td>
+        </tr>
+    </table>           
+    <a href="../orders">Back to Orders</a>
+</body>
+</html>
+       
\ No newline at end of file

Modified: 
struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/web.xml
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/web.xml?rev=727908&r1=727907&r2=727908&view=diff
==============================================================================
--- struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/web.xml 
(original)
+++ struts/struts2/trunk/apps/rest-showcase/src/main/webapp/WEB-INF/web.xml Thu 
Dec 18 19:15:23 2008
@@ -13,10 +13,6 @@
     <filter>
         <filter-name>action2</filter-name>
         
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
-        <init-param>
-          <param-name>actionPackages</param-name>
-          <param-value>org.apache.struts2.rest.example</param-value>
-        </init-param>
     </filter>
     <!-- END SNIPPET: filter -->
 


Reply via email to