mirror of
https://github.com/apache/struts.git
synced 2026-08-07 15:46:57 +00:00
WW-2926 Port rest-showcase to use convention plugin
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@727908 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -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>
|
||||
|
||||
+9
-3
@@ -2,19 +2,25 @@ package org.apache.struts2.rest.example;
|
||||
|
||||
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();
|
||||
|
||||
@@ -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>
|
||||
@@ -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 -->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user