mirror of
https://github.com/apache/struts.git
synced 2026-08-08 16:16:58 +00:00
Compare commits
130 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e5009a3420 | |||
| 19391d3b7f | |||
| b178a6a6d4 | |||
| bbfd03dfb5 | |||
| 61478a9537 | |||
| 6908bc8d0f | |||
| a15e99c68e | |||
| 0d5ae3294c | |||
| e6738c5e75 | |||
| 077bea8a6f | |||
| 380b6df4f7 | |||
| 6c004040ea | |||
| d0bdf09e7d | |||
| eb17fbb3a0 | |||
| 6aa0509b33 | |||
| 63e704201a | |||
| 04aa19c9e7 | |||
| 29aae5eb81 | |||
| d5cbcfeedc | |||
| a51b4eacb7 | |||
| bdc84d2fb1 | |||
| d34eb7adcb | |||
| 2f3a55d0d5 | |||
| bdb24d4eff | |||
| 1253cb074b | |||
| 9897d8ff19 | |||
| cf34593a8a | |||
| 83b281811d | |||
| fe190f950f | |||
| 7ddfe6bbda | |||
| c4d253688f | |||
| e1dcdf5a34 | |||
| 9085922cb7 | |||
| 07031875ea | |||
| 9c139c9288 | |||
| 74085f630e | |||
| 1dbe1093c2 | |||
| c36dfd6a26 | |||
| dcfae203cc | |||
| 6f3fa76e3f | |||
| 75b31dc959 | |||
| ef40344fd1 | |||
| 54c3d64d81 | |||
| 3acbfc584d | |||
| 08462f2c15 | |||
| bdf0f0da81 | |||
| 465d599054 | |||
| ad3aae6eba | |||
| 7e1b849155 | |||
| c035f4cb4a | |||
| 3343161e12 | |||
| 90f9e3a846 | |||
| f410fc0cbe | |||
| 127ed05ed6 | |||
| 8a9fa85766 | |||
| b4265d369d | |||
| 6137ac2293 | |||
| 5f54b8d087 | |||
| 481ef2feaf | |||
| 4621a4c1a5 | |||
| 1e0527777a | |||
| ac0679e3ed | |||
| f219d9e468 | |||
| 9e4347d896 | |||
| 4e06167fdb | |||
| efa15d578f | |||
| 9842ae0cd9 | |||
| b6cd7e4fde | |||
| be5efd99b6 | |||
| ce7c1c9144 | |||
| 48c14f46c8 | |||
| 664378b744 | |||
| 16cbf6299e | |||
| 191dc8589e | |||
| 19aa2c1ba6 | |||
| 2462d93e6e | |||
| 1e1705bb41 | |||
| a534481cf7 | |||
| 26f25f1d5a | |||
| a4772afb3c | |||
| 0b7e3768ac | |||
| ea2c03bd71 | |||
| 294d91b989 | |||
| 36d14eb401 | |||
| 1d962f9472 | |||
| f54afdc3f4 | |||
| 4227062548 | |||
| 8f4707d3be | |||
| e5fcc7b33e | |||
| 5e8080abe3 | |||
| c10a8b7f43 | |||
| 4d17f3c7ba | |||
| 36b92cea4a | |||
| 86bade8b22 | |||
| b1f6671c28 | |||
| 9972ef89ab | |||
| f3fdaa82dd | |||
| 9e35546504 | |||
| dcd9409764 | |||
| 511c943ed3 | |||
| 1337311088 | |||
| 05c581f530 | |||
| 62bc93b987 | |||
| cfa0c91b19 | |||
| 3d1120a607 | |||
| 0f2a57f94b | |||
| b40ef08d31 | |||
| bc0ac267f6 | |||
| bb5e30d47a | |||
| f2df9bbff6 | |||
| 21f731531a | |||
| b5d9530ee4 | |||
| db3cb1f3af | |||
| 1219e49516 | |||
| 1492f4f579 | |||
| 7aa552ff78 | |||
| eaa0a9ca6d | |||
| 3650863e0d | |||
| 19f61519f9 | |||
| 524aee3131 | |||
| 83d57e75c0 | |||
| 009e65e94f | |||
| 535bc0163d | |||
| 9e452375bf | |||
| 84c11ed257 | |||
| 72f8865629 | |||
| 5dad35e0a0 | |||
| cb9838871b | |||
| 786f6af96f | |||
| d915dfc33e |
+4
-4
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-blank</artifactId>
|
||||
@@ -34,9 +34,9 @@
|
||||
<name>Blank Webapp</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/apps/blank</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/apps/blank</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_2_2/apps/blank</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/apps/blank</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/apps/blank</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_1/apps/blank</url>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
"-//Apache Struts//XWork Validator 1.0.2//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="username">
|
||||
|
||||
@@ -26,12 +26,11 @@ import com.opensymphony.xwork2.config.RuntimeConfiguration;
|
||||
import com.opensymphony.xwork2.config.entities.ActionConfig;
|
||||
import com.opensymphony.xwork2.config.entities.ResultConfig;
|
||||
import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.struts2.StrutsTestCase;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ConfigTest extends StrutsTestCase {
|
||||
|
||||
protected void assertSuccess(String result) throws Exception {
|
||||
@@ -62,7 +61,7 @@ public class ConfigTest extends StrutsTestCase {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
XmlConfigurationProvider c = new XmlConfigurationProvider("struts.xml");
|
||||
configurationManager.addConfigurationProvider(c);
|
||||
configurationManager.addContainerProvider(c);
|
||||
configurationManager.reload();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-jboss-blank</artifactId>
|
||||
@@ -34,9 +34,9 @@
|
||||
<name>JBoss Blank Webapp</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/apps/jboss-blank</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/apps/jboss-blank</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_2_2/apps/jboss-blank</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/apps/jboss-blank</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/apps/jboss-blank</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_1/apps/jboss-blank</url>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
"-//Apache Struts//XWork Validator 1.0.2//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="username">
|
||||
|
||||
@@ -26,12 +26,11 @@ import com.opensymphony.xwork2.config.RuntimeConfiguration;
|
||||
import com.opensymphony.xwork2.config.entities.ActionConfig;
|
||||
import com.opensymphony.xwork2.config.entities.ResultConfig;
|
||||
import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.struts2.StrutsTestCase;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ConfigTest extends StrutsTestCase {
|
||||
|
||||
protected void assertSuccess(String result) throws Exception {
|
||||
@@ -62,7 +61,7 @@ public class ConfigTest extends StrutsTestCase {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
XmlConfigurationProvider c = new XmlConfigurationProvider("struts.xml");
|
||||
configurationManager.addConfigurationProvider(c);
|
||||
configurationManager.addContainerProvider(c);
|
||||
configurationManager.reload();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,17 +26,17 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-mailreader</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>Starter Webapp</name>
|
||||
<name>Mail Reader Webapp</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/apps/mailreader</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/apps/mailreader</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_2_2/apps/mailreader</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/apps/mailreader</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/apps/mailreader</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_1/apps/mailreader</url>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="username">
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
|
||||
|
||||
+4
-4
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
@@ -42,9 +42,9 @@
|
||||
</modules>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/apps</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/apps</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_2_2/apps</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/apps</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/apps</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_1/apps</url>
|
||||
</scm>
|
||||
|
||||
<profiles>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-portlet</artifactId>
|
||||
@@ -34,9 +34,9 @@
|
||||
<name>Portlet Webapp</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/apps/portlet</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/apps/portlet</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_2_2/apps/portlet</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/apps/portlet</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/apps/portlet</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_1/apps/portlet</url>
|
||||
</scm>
|
||||
|
||||
<profiles>
|
||||
@@ -93,8 +93,8 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>portlet-api</groupId>
|
||||
<artifactId>portlet-api</artifactId>
|
||||
<groupId>javax.portlet</groupId>
|
||||
<artifactId>portlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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.portlet.example.eventing;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.portlet.interceptor.PortletRequestAware;
|
||||
import org.apache.struts2.portlet.interceptor.PortletResponseAware;
|
||||
|
||||
import javax.portlet.EventRequest;
|
||||
import javax.portlet.EventResponse;
|
||||
import javax.portlet.PortletRequest;
|
||||
import javax.portlet.PortletResponse;
|
||||
|
||||
public class ProcessAction extends ActionSupport implements PortletRequestAware, PortletResponseAware {
|
||||
|
||||
private PortletRequest request;
|
||||
private PortletResponse response;
|
||||
private String name;
|
||||
|
||||
public String execute() throws Exception {
|
||||
|
||||
if (request instanceof EventRequest) {
|
||||
EventRequest req = (EventRequest) request;
|
||||
EventResponse res = (EventResponse) response;
|
||||
res.setRenderParameter("eventName", (String) req.getEvent().getValue());
|
||||
return "forward";
|
||||
} else {
|
||||
name = request.getParameter("eventName");
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
public void setPortletRequest(PortletRequest request) {
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
public void setPortletResponse(PortletResponse response) {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.portlet.example.eventing;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.portlet.interceptor.PortletResponseAware;
|
||||
|
||||
import javax.portlet.ActionResponse;
|
||||
import javax.portlet.PortletResponse;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
public class PublishAction extends ActionSupport implements PortletResponseAware {
|
||||
|
||||
private PortletResponse response;
|
||||
private String name;
|
||||
|
||||
public String execute() throws Exception {
|
||||
|
||||
if (name != null) {
|
||||
((ActionResponse) response).setEvent(new QName("http://org.apache.struts2.portlets/events", "name"), name);
|
||||
|
||||
addActionMessage("Publishing Event with Parameter name : " + name);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
public void setPortletResponse(PortletResponse response) {
|
||||
this.response = response;
|
||||
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
<validators>
|
||||
<field name="firstName">
|
||||
<field-validator type="requiredstring">
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
<validators>
|
||||
<field name="firstName">
|
||||
<field-validator type="requiredstring">
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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>
|
||||
<package name="eventing" extends="struts-portlet-default" namespace="/eventing">
|
||||
|
||||
<action name="publish" class="org.apache.struts2.portlet.example.eventing.PublishAction">
|
||||
<result name="success">/WEB-INF/eventing/index.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="process" class="org.apache.struts2.portlet.example.eventing.ProcessAction">
|
||||
<result name="success">/WEB-INF/eventing/process.jsp</result>
|
||||
<result name="forward" type="redirectAction">
|
||||
<param name="actionName">process</param>
|
||||
<param name="namespace">/eventing</param>
|
||||
</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
@@ -1,10 +1,11 @@
|
||||
<?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">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.0.dtd">
|
||||
|
||||
<struts>
|
||||
<include file="struts-view.xml"/>
|
||||
<include file="struts-edit.xml"/>
|
||||
<include file="struts-help.xml"/>
|
||||
<include file="struts-view.xml"/>
|
||||
<include file="struts-edit.xml"/>
|
||||
<include file="struts-help.xml"/>
|
||||
<include file="struts-eventing.xml"/>
|
||||
</struts>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator Config 1.0//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-config-1.0.dtd">
|
||||
"-//Apache Struts//XWork Validator Config 1.0//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-config-1.0.dtd">
|
||||
<validators>
|
||||
<validator name="required" class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/>
|
||||
<validator name="requiredstring" class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<h2>Input your name</h2>
|
||||
|
||||
<s:actionmessage/>
|
||||
|
||||
<s:form action="publish" method="POST">
|
||||
<s:textfield label="Please enter your name" name="name" value="%{name}"/>
|
||||
<s:submit value="Submit the form"/>
|
||||
</s:form>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<s:if test="%{name != null}">
|
||||
<h2>Welcome <s:property value="name"/></h2>
|
||||
</s:if>
|
||||
<s:else>
|
||||
<h2>Please insert a Name in the Publish Portlet Form</h2>
|
||||
</s:else>
|
||||
|
||||
<s:actionmessage/>
|
||||
|
||||
|
||||
@@ -1,78 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<portlet-app
|
||||
version="1.0"
|
||||
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
|
||||
id="struts-portlet">
|
||||
id="struts-portlet"
|
||||
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
version="2.0"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
|
||||
>
|
||||
|
||||
<portlet id="StrutsPortlet">
|
||||
<description xml:lang="EN">Struts Test Portlet</description>
|
||||
<portlet-name>StrutsPortlet</portlet-name>
|
||||
<display-name xml:lang="EN">Struts Test Portlet</display-name>
|
||||
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
|
||||
|
||||
<!-- The view mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>viewNamespace</name>
|
||||
<value>/view</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The default action to invoke in view mode. -->
|
||||
<init-param>
|
||||
<name>defaultViewAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The edit mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>editNamespace</name>
|
||||
<value>/edit</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The default action to invoke in edit mode. -->
|
||||
<init-param>
|
||||
<name>defaultEditAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The help mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>helpNamespace</name>
|
||||
<value>/help</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The default action to invoke in help mode. -->
|
||||
<init-param>
|
||||
<name>defaultHelpAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
|
||||
<expiration-cache>0</expiration-cache>
|
||||
|
||||
<supports>
|
||||
<mime-type>text/html</mime-type>
|
||||
<portlet-mode>view</portlet-mode>
|
||||
<portlet-mode>edit</portlet-mode>
|
||||
<portlet-mode>help</portlet-mode>
|
||||
</supports>
|
||||
|
||||
<supported-locale>en</supported-locale>
|
||||
|
||||
<portlet-info>
|
||||
<title>My StrutsPortlet portlet</title>
|
||||
<short-title>SP</short-title>
|
||||
<keywords>struts,portlet</keywords>
|
||||
</portlet-info>
|
||||
</portlet>
|
||||
|
||||
<portlet id="StrutsPortlet2">
|
||||
<description xml:lang="EN">Struts Test Portlet2</description>
|
||||
<portlet-name>StrutsPortlet2</portlet-name>
|
||||
<display-name xml:lang="EN">Struts Test Portlet2</display-name>
|
||||
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
|
||||
|
||||
<!-- The view mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
@@ -115,6 +55,7 @@
|
||||
|
||||
<supports>
|
||||
<mime-type>text/html</mime-type>
|
||||
<portlet-mode>view</portlet-mode>
|
||||
<portlet-mode>edit</portlet-mode>
|
||||
<portlet-mode>help</portlet-mode>
|
||||
</supports>
|
||||
@@ -122,10 +63,152 @@
|
||||
<supported-locale>en</supported-locale>
|
||||
|
||||
<portlet-info>
|
||||
<title>My StrutsPortlet portlet2</title>
|
||||
<title>My Struts2 Portlet</title>
|
||||
<short-title>SP2</short-title>
|
||||
<keywords>struts,portlet</keywords>
|
||||
</portlet-info>
|
||||
</portlet>
|
||||
|
||||
<portlet id="StrutsPortlet2">
|
||||
<description xml:lang="EN">Struts Test Portlet with JSR 286 Dispatcher</description>
|
||||
<portlet-name>StrutsPortlet2</portlet-name>
|
||||
<display-name xml:lang="EN">Struts Test Portlet with JSR 286 Dispatcher</display-name>
|
||||
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr286Dispatcher</portlet-class>
|
||||
|
||||
<!-- The view mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>viewNamespace</name>
|
||||
<value>/view</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The default action to invoke in view mode. -->
|
||||
<init-param>
|
||||
<name>defaultViewAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The edit mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>editNamespace</name>
|
||||
<value>/edit</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The default action to invoke in edit mode. -->
|
||||
<init-param>
|
||||
<name>defaultEditAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The help mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>helpNamespace</name>
|
||||
<value>/help</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The default action to invoke in help mode. -->
|
||||
<init-param>
|
||||
<name>defaultHelpAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
|
||||
<expiration-cache>0</expiration-cache>
|
||||
|
||||
<supports>
|
||||
<mime-type>text/html</mime-type>
|
||||
<portlet-mode>edit</portlet-mode>
|
||||
<portlet-mode>help</portlet-mode>
|
||||
</supports>
|
||||
|
||||
<supported-locale>en</supported-locale>
|
||||
|
||||
<portlet-info>
|
||||
<title>My Struts2 Portlet with JSR 286 Dispatcher</title>
|
||||
<short-title>SP2JSR286</short-title>
|
||||
<keywords>struts,portlet</keywords>
|
||||
</portlet-info>
|
||||
</portlet>
|
||||
|
||||
|
||||
<portlet id="Struts2PublishPortlet">
|
||||
<description xml:lang="EN">Struts2 Publish Portlet</description>
|
||||
<portlet-name>Struts2PublishPortlet</portlet-name>
|
||||
<display-name xml:lang="EN">Struts2 Publish Portlet</display-name>
|
||||
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr286Dispatcher</portlet-class>
|
||||
|
||||
<!-- The view mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>viewNamespace</name>
|
||||
<value>/eventing</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The default action to invoke in view mode. -->
|
||||
<init-param>
|
||||
<name>defaultViewAction</name>
|
||||
<value>publish</value>
|
||||
</init-param>
|
||||
|
||||
<expiration-cache>0</expiration-cache>
|
||||
|
||||
<supports>
|
||||
<mime-type>text/html</mime-type>
|
||||
</supports>
|
||||
|
||||
<supported-locale>en</supported-locale>
|
||||
|
||||
<portlet-info>
|
||||
<title>Struts2 Publish Portlet</title>
|
||||
<short-title>S2PUB</short-title>
|
||||
<keywords>struts,publish,portlet</keywords>
|
||||
</portlet-info>
|
||||
|
||||
<supported-publishing-event xmlns:x="http://org.apache.struts2.portlets/events">
|
||||
<qname>x:name</qname>
|
||||
</supported-publishing-event>
|
||||
</portlet>
|
||||
|
||||
<portlet id="Struts2ProcessPortlet">
|
||||
<description xml:lang="EN">Struts2 Process Portlet</description>
|
||||
<portlet-name>Struts2ProcessPortlet</portlet-name>
|
||||
<display-name xml:lang="EN">Struts2 Process Portlet</display-name>
|
||||
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr286Dispatcher</portlet-class>
|
||||
|
||||
<!-- The view mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>viewNamespace</name>
|
||||
<value>/eventing</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The default action to invoke in view mode. -->
|
||||
<init-param>
|
||||
<name>defaultViewAction</name>
|
||||
<value>process</value>
|
||||
</init-param>
|
||||
|
||||
<expiration-cache>0</expiration-cache>
|
||||
|
||||
<supports>
|
||||
<mime-type>text/html</mime-type>
|
||||
</supports>
|
||||
|
||||
<supported-locale>en</supported-locale>
|
||||
|
||||
<portlet-info>
|
||||
<title>Struts2 Process Portlet</title>
|
||||
<short-title>S2PRO</short-title>
|
||||
<keywords>struts,process,portlet</keywords>
|
||||
</portlet-info>
|
||||
|
||||
<supported-processing-event xmlns:x="http://org.apache.struts2.portlets/events">
|
||||
<qname>x:name</qname>
|
||||
</supported-processing-event>
|
||||
</portlet>
|
||||
|
||||
<event-definition>
|
||||
<qname xmlns:x="http://org.apache.struts2.portlets/events">x:name</qname>
|
||||
<value-type>java.lang.String</value-type>
|
||||
</event-definition>
|
||||
|
||||
</portlet-app>
|
||||
|
||||
@@ -8,11 +8,8 @@
|
||||
/WEB-INF/applicationContext*.xml
|
||||
</param-value>
|
||||
</context-param>
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<!-- Uncomment to use the dispatcher servlet -->
|
||||
<!--<servlet id="Struts2PortletDispatcherServlet">
|
||||
<servlet-name>Struts2PortletDispatcherServlet</servlet-name>
|
||||
<servlet-class>org.apache.struts2.portlet.dispatcher.DispatcherServlet</servlet-class>
|
||||
</servlet>-->
|
||||
|
||||
</web-app>
|
||||
|
||||
@@ -26,13 +26,13 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-rest-showcase</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
<name>Struts 2 Rest Showcase Example</name>
|
||||
<description>Struts 2 Rest Showcase Example</description>
|
||||
|
||||
|
||||
+11
-5
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-showcase</artifactId>
|
||||
@@ -34,9 +34,9 @@
|
||||
<name>Showcase Webapp</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/apps/showcase</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/apps/showcase</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_2_2/apps/showcase</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/apps/showcase</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/apps/showcase</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_1/apps/showcase</url>
|
||||
</scm>
|
||||
|
||||
|
||||
@@ -95,6 +95,12 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-json-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.tiles</groupId>
|
||||
<artifactId>tiles-jsp</artifactId>
|
||||
@@ -103,7 +109,7 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-codebehind-plugin</artifactId>
|
||||
<artifactId>struts2-convention-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
*/
|
||||
package org.apache.struts2.showcase;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import com.opensymphony.xwork2.Validateable;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -28,12 +33,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import com.opensymphony.xwork2.Validateable;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class UITagExample extends ActionSupport implements Validateable {
|
||||
@@ -47,6 +46,7 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
String bio;
|
||||
String favouriteColor;
|
||||
List friends;
|
||||
String bestFriend;
|
||||
boolean legalAge;
|
||||
String state;
|
||||
String region;
|
||||
@@ -185,6 +185,14 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
this.friends = friends;
|
||||
}
|
||||
|
||||
public String getBestFriend() {
|
||||
return bestFriend;
|
||||
}
|
||||
|
||||
public void setBestFriend(String bestFriend) {
|
||||
this.bestFriend = bestFriend;
|
||||
}
|
||||
|
||||
public boolean isLegalAge() {
|
||||
return legalAge;
|
||||
}
|
||||
|
||||
+7
-4
@@ -24,17 +24,20 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.struts2.config.Result;
|
||||
import org.apache.struts2.config.Results;
|
||||
import org.apache.struts2.dispatcher.ServletRedirectResult;
|
||||
import org.apache.struts2.convention.annotation.ParentPackage;
|
||||
import org.apache.struts2.convention.annotation.Result;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.convention.annotation.Results;
|
||||
|
||||
/**
|
||||
* <code>EditPerson</code>
|
||||
*
|
||||
*/
|
||||
@Result(name="list", value="listPeople.action", type=ServletRedirectResult.class)
|
||||
@Results({
|
||||
@Result(name="list", location="list-people.action", type="redirect"),
|
||||
@Result(name="input", location="new-person.ftl", type="freemarker")
|
||||
})
|
||||
public class EditPersonAction extends ActionSupport {
|
||||
|
||||
private static final long serialVersionUID = 7699491775215130850L;
|
||||
|
||||
+3
-3
@@ -23,11 +23,11 @@ package org.apache.struts2.showcase.person;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.struts2.config.Result;
|
||||
import org.apache.struts2.views.freemarker.FreemarkerResult;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.convention.annotation.ParentPackage;
|
||||
import org.apache.struts2.convention.annotation.Result;
|
||||
|
||||
@Result(location="list-people.ftl", type="freemarker")
|
||||
public class ListPeopleAction extends ActionSupport {
|
||||
|
||||
private static final long serialVersionUID = 3608017189783645371L;
|
||||
|
||||
@@ -20,16 +20,13 @@
|
||||
*/
|
||||
package org.apache.struts2.showcase.person;
|
||||
|
||||
import org.apache.struts2.config.ParentPackage;
|
||||
import org.apache.struts2.config.Result;
|
||||
import org.apache.struts2.config.Results;
|
||||
import org.apache.struts2.convention.annotation.ParentPackage;
|
||||
import org.apache.struts2.convention.annotation.Result;
|
||||
import org.apache.struts2.views.freemarker.FreemarkerResult;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ParentPackage("person")
|
||||
@Result(name="input", location="new-person.ftl", type="freemarker")
|
||||
public class NewPersonAction extends ActionSupport {
|
||||
|
||||
private static final long serialVersionUID = 200410824352645515L;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParentPackage("person")
|
||||
@Namespace("/person")
|
||||
package org.apache.struts2.showcase.person;
|
||||
|
||||
import org.apache.struts2.convention.annotation.Namespace;
|
||||
import org.apache.struts2.convention.annotation.ParentPackage;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
"-//Apache Struts//XWork Validator 1.0.2//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="description1">
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.dtd">
|
||||
<validators>
|
||||
<!-- Field-Validator Syntax -->
|
||||
<field name="currentEmployee.empId">
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.dtd">
|
||||
<validators>
|
||||
<!-- Field-Validator Syntax -->
|
||||
<field name="currentSkill.name">
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
"-//Apache Struts//XWork Validator 1.0//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="name">
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
"-//Apache Struts//XWork Validator 1.0.2//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="name">
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
"-//Apache Struts//XWork Validator 1.0.2//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="name">
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
"-//Apache Struts//XWork Validator 1.0.2//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="message">
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
"-//Apache Struts//XWork Validator 1.0.2//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="upload">
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.dtd">
|
||||
<validators>
|
||||
<field name="person">
|
||||
<field-validator type="visitor">
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.dtd">
|
||||
<validators>
|
||||
<field name="name">
|
||||
<field-validator type="requiredstring">
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
"-//Apache Struts//XWork Validator 1.0.2//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="value">
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
"-//Apache Struts//XWork Validator 1.0//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<!-- START SNIPPET: fieldValidatorsExample -->
|
||||
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
"-//Apache Struts//XWork Validator 1.0//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<!-- START SNIPPET: fieldValidatorsExample -->
|
||||
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
"-//Apache Struts//XWork Validator 1.0//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
|
||||
<!-- START SNIPPET: nonFieldValidatorsExample -->
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<!-- START SNIPPET: quizValidators -->
|
||||
<!--
|
||||
Add the following DOCTYPE declaration as first line of your XXX-validation.xml file:
|
||||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
-->
|
||||
<validators>
|
||||
<field name="name">
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
"-//Apache Struts//XWork Validator 1.0//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="name">
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
"-//Apache Struts//XWork Validator 1.0//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="name">
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
"-//Apache Struts//XWork Validator 1.0//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<!-- START SNIPPET: visitorValidatorsExample -->
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
</action>
|
||||
</package>
|
||||
|
||||
<package name="ajaxNoDecorate" namespace="/nodecorate" extends="struts-default">
|
||||
<package name="ajaxNoDecorate" namespace="/nodecorate" extends="json-default">
|
||||
<!-- example 4 -->
|
||||
<action name="panel1" class="org.apache.struts2.showcase.ajax.Example4ShowPanelAction" method="panel1">
|
||||
<result type="freemarker">/ajax/tabbedpanel/nodecorate/panel1.ftl</result>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"http://struts.apache.org/dtds/struts-2.0.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="validation" extends="struts-default" namespace="/validation">
|
||||
<package name="validation" extends="json-default" namespace="/validation">
|
||||
<action name="quizBasic" class="org.apache.struts2.showcase.validation.QuizAction">
|
||||
<result name="input">quiz-basic.jsp</result>
|
||||
<result>quiz-success.jsp</result>
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
<constant name="struts.custom.i18n.resources" value="globalMessages" />
|
||||
<constant name="struts.action.extension" value="action,," />
|
||||
|
||||
<constant name="struts.codebehind.defaultPackage" value="person" />
|
||||
<constant name="struts.convention.package.locators.basePackage" value="org.apache.struts2.showcase.person" />
|
||||
<constant name="struts.convention.result.path" value="/" />
|
||||
|
||||
<constant name="struts.freemarker.manager.classname" value="customFreemarkerManager" />
|
||||
<constant name="struts.serve.static" value="true" />
|
||||
<constant name="struts.serve.static.browserCache" value="false" />
|
||||
|
||||
<constant name="actionPackages" value="org.apache.struts2.showcase.person"/>
|
||||
|
||||
<include file="struts-chat.xml" />
|
||||
|
||||
<include file="struts-interactive.xml" />
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
<filter>
|
||||
<filter-name>struts-prepare</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>actionPackages</param-name>
|
||||
<param-value>org.apache.struts2.showcase.person</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
|
||||
+5
-3
@@ -6,7 +6,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<s:form action="editPerson" theme="simple" validate="false">
|
||||
<s:form action="edit-person" theme="simple" validate="false">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
@@ -33,8 +33,10 @@
|
||||
</s:form>
|
||||
|
||||
<ul>
|
||||
<li><a href="newPerson!input.action">Create</a> a new person</li>
|
||||
<li><a href="listPeople.action">List</a> all people</li>
|
||||
<s:url id="newpersonurl" action="new-person" method="input" />
|
||||
<li><s:a href="%{newpersonurl}">Create</s:a> a new person</li>
|
||||
<s:url id="listpeopleurl" action="list-people" />
|
||||
<li><s:a href="%{listpeopleurl}">List</s:a> all people</li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
@@ -1,3 +1,5 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Acme Corp</title>
|
||||
@@ -5,8 +7,10 @@
|
||||
|
||||
<body>
|
||||
<ul>
|
||||
<li><a href="newPerson!input.action">Create</a> a new person</li>
|
||||
<li><a href="listPeople.action">List</a> all people</li>
|
||||
<s:url id="newpersonurl" action="new-person" method="input" />
|
||||
<li><s:a href="%{newpersonurl}">Create</s:a> a new person</li>
|
||||
<s:url id="listpeopleurl" action="list-people" />
|
||||
<li><s:a href="%{listpeopleurl}">List</s:a> all people</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+4
-2
@@ -21,8 +21,10 @@ There are ${peopleCount} people...
|
||||
</table>
|
||||
|
||||
<ul>
|
||||
<li><a href="editPerson.action">Edit people</a></li>
|
||||
<li><a href="newPerson!input.action">Create</a> a new person</li>
|
||||
<@s.url id="editpersonurl" action="edit-person" />
|
||||
<li><@s.a href="%{editpersonurl}">Edit people</@s.a></li>
|
||||
<@s.url id="newpersonurl" action="new-person" method="input" />
|
||||
<li><@s.a href="%{newpersonurl}">Create</@s.a> a new person</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,21 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>New Person</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<@s.form action="new-person">
|
||||
<@s.textfield label="First Name" name="person.name"/>
|
||||
<@s.textfield label="Last Name" name="person.lastName"/>
|
||||
<@s.submit value="Create person"/>
|
||||
</@s.form>
|
||||
|
||||
<ul>
|
||||
<@s.url id="editpersonurl" action="edit-person" />
|
||||
<li><@s.a href="%{editpersonurl}">Edit people</@s.a></li>
|
||||
<@s.url id="listpeopleurl" action="list-people" />
|
||||
<li><@s.a href="%{listpeopleurl}">List</@s.a> all people</li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,19 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>New Person</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<@s.form action="newPerson">
|
||||
<@s.textfield label="First Name" name="person.name"/>
|
||||
<@s.textfield label="Last Name" name="person.lastName"/>
|
||||
<@s.submit value="Create person"/>
|
||||
</@s.form>
|
||||
|
||||
<ul>
|
||||
<li><a href="editPerson.action">Edit people</a></li>
|
||||
<li><a href="listPeople.action">List</a> all people</li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -62,9 +62,16 @@
|
||||
<s:checkboxlist
|
||||
tooltip="Choose your Friends"
|
||||
label="Friends"
|
||||
list="{'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}"
|
||||
list="{'Wes', 'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}"
|
||||
name="friends"/>
|
||||
|
||||
<s:radio
|
||||
tooltip="Choose your Best Friend"
|
||||
label="Best Friend"
|
||||
list="{'Wes', 'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}"
|
||||
name="bestFriend"
|
||||
cssErrorClass="foo" />
|
||||
|
||||
<s:checkbox
|
||||
tooltip="Confirmed that your are Over 18"
|
||||
label="Age 18+"
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
</tr>
|
||||
<s:label label="Biography" name="bio" />
|
||||
<s:label label="Favourite Color" name="favouriteColor" />
|
||||
<s:label label="Friends" name="friends" />
|
||||
<s:label label="Friends" name="friends" />
|
||||
<s:label label="Best Friend" name="bestFriend" />
|
||||
<s:label label="Legal Age" name="legalAge" />
|
||||
<s:label label="Region" name="region" />
|
||||
<s:label label="State" name="state" />
|
||||
|
||||
+4
-4
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
@@ -34,9 +34,9 @@
|
||||
<name>Struts 2 Maven Archetypes</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes</developerConnection>
|
||||
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes</developerConnection>
|
||||
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes</url>
|
||||
</scm>
|
||||
|
||||
<modules>
|
||||
|
||||
@@ -3,24 +3,36 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>struts2-archetype-blank</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
<name>Struts 2 Archetypes - Blank</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-blank</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-blank</developerConnection>
|
||||
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-blank</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-blank</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-blank</developerConnection>
|
||||
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-blank</url>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>**/pom.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
"-//Apache Struts//XWork Validator 1.0.2//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
<validators>
|
||||
<field name="username">
|
||||
<field-validator type="requiredstring">
|
||||
|
||||
@@ -2,24 +2,36 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>struts2-archetype-convention</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
<name>Struts 2 Archetypes - Blank Convention</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-convention</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-convention</developerConnection>
|
||||
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-convention</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-convention</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-convention</developerConnection>
|
||||
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-convention</url>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>**/pom.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
|
||||
@@ -1,25 +1,37 @@
|
||||
<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/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.2.2</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>struts2-archetype-dbportlet</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
<name>Struts 2 Archetypes - Database Portlet</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-dbportlet</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-dbportlet</developerConnection>
|
||||
<url>svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-dbportlet</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-dbportlet</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-dbportlet</developerConnection>
|
||||
<url>svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-dbportlet</url>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>**/pom.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
|
||||
+5
-5
@@ -59,7 +59,7 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
<version>2.5.6</version>
|
||||
<version>3.0.5.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Database driver (change for your specific database) -->
|
||||
@@ -85,9 +85,9 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>portlet-api</groupId>
|
||||
<groupId>javax.portlet</groupId>
|
||||
<artifactId>portlet-api</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -117,9 +117,9 @@
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>portlet-api</groupId>
|
||||
<groupId>javax.portlet</groupId>
|
||||
<artifactId>portlet-api</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http:
|
||||
<portlet-name>StrutsDBPortlet</portlet-name>
|
||||
<display-name xml:lang="EN">Struts Database Portlet</display-name>
|
||||
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr286Dispatcher</portlet-class>
|
||||
|
||||
<init-param>
|
||||
<name>actionPackages</name>
|
||||
|
||||
@@ -1,46 +1,58 @@
|
||||
<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/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.2.2</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>struts2-archetype-plugin</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Struts 2 Archetypes - Plugin</name>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>struts2-archetype-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Struts 2 Archetypes - Plugin</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-plugin</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-plugin</developerConnection>
|
||||
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-plugin</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-plugin</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-plugin</developerConnection>
|
||||
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-plugin</url>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>**/pom.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
@@ -2,25 +2,37 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>struts2-archetype-portlet</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Struts 2 Archetypes - Portlet</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-portlet</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-portlet</developerConnection>
|
||||
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-portlet</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-portlet</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-portlet</developerConnection>
|
||||
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-portlet</url>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>**/pom.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<dependency>
|
||||
<groupId>javax.portlet</groupId>
|
||||
<artifactId>portlet-api</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
<portlet-name>HelloPortlet</portlet-name>
|
||||
<display-name xml:lang="EN">${artifactId}</display-name>
|
||||
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr286Dispatcher</portlet-class>
|
||||
|
||||
<!-- The namespace for the actions configured for view mode -->
|
||||
<init-param>
|
||||
|
||||
@@ -1,49 +1,61 @@
|
||||
<?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/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.2.2</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-archetypes</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>struts2-archetype-starter</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Struts 2 Archetypes - Starter</name>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>struts2-archetype-starter</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Struts 2 Archetypes - Starter</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-starter</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-starter</developerConnection>
|
||||
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/archetypes/struts2-archetype-starter</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-starter</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-starter</developerConnection>
|
||||
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/archetypes/struts2-archetype-starter</url>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>**/pom.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
|
||||
+4
-4
@@ -11,13 +11,13 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/assembly</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/assembly</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_2_2/assembly</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/assembly</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/assembly</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_1/assembly</url>
|
||||
</scm>
|
||||
|
||||
<profiles>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-osgi-bundles</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-osgi-admin-bundle</artifactId>
|
||||
@@ -12,9 +12,9 @@
|
||||
<name>Struts 2 OSGi Admin Bundle</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/bundles/admin</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/bundles/admin</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_2_2/bundles/admin</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/bundles/admin</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/bundles/admin</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_1/bundles/admin</url>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-osgi-bundles</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-osgi-demo-bundle</artifactId>
|
||||
@@ -12,9 +12,9 @@
|
||||
<name>Struts 2 OSGi Demo Bundle</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/bundles/demo</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/bundles/demo</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_2_2/bundles/demo</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/bundles/demo</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/bundles/demo</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_1/bundles/demo</url>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
|
||||
+4
-4
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-osgi-bundles</artifactId>
|
||||
@@ -34,9 +34,9 @@
|
||||
<name>Struts OSGi Bundles</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/bundles</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/bundles</developerConnection>
|
||||
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/bundles</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/bundles</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/bundles</developerConnection>
|
||||
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/bundles</url>
|
||||
</scm>
|
||||
|
||||
<modules>
|
||||
|
||||
+5
-5
@@ -26,7 +26,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-core</artifactId>
|
||||
@@ -34,9 +34,9 @@
|
||||
<name>Struts 2 Core</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/core</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_2_2/core</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_2_2/core</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/core</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_1/core</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_1/core</url>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
@@ -315,7 +315,7 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring</artifactId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
@@ -167,7 +167,9 @@ public class ActionComponent extends ContextBean {
|
||||
try {
|
||||
writer.flush();
|
||||
} catch (IOException e) {
|
||||
LOG.warn("error while trying to flush writer ", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("error while trying to flush writer ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
executeAction();
|
||||
|
||||
@@ -141,7 +141,9 @@ public class AppendIterator extends ContextBean implements UnnamedParametric {
|
||||
|
||||
Object iteratorEntryObj = paramEntries.next();
|
||||
if (! MakeIterator.isIterable(iteratorEntryObj)) {
|
||||
LOG.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
appendIteratorFilter.setSource(MakeIterator.convert(iteratorEntryObj));
|
||||
|
||||
@@ -75,13 +75,17 @@ public class File extends UIBean {
|
||||
String encType = (String) form.getParameters().get("enctype");
|
||||
if (!"multipart/form-data".equals(encType)) {
|
||||
// uh oh, this isn't good! Let's warn the developer
|
||||
LOG.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to enctype 'multipart/form-data'. This is probably an error!");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to enctype 'multipart/form-data'. This is probably an error!");
|
||||
}
|
||||
}
|
||||
|
||||
String method = (String) form.getParameters().get("method");
|
||||
if (!"post".equalsIgnoreCase(method)) {
|
||||
// uh oh, this isn't good! Let's warn the developer
|
||||
LOG.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to method 'POST'. This is probably an error!");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to method 'POST'. This is probably an error!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
* <p>Include a servlet's output (result of servlet or a JSP page).</p>
|
||||
* <p>Note: Any additional params supplied to the included page are <b>not</b>
|
||||
* accessible within the rendered page through the <s:property...> tag
|
||||
* since no valuestack will be created. You can, however, access them in a
|
||||
* since no valuestack will be created. You can, however, access them in a
|
||||
* servlet via the HttpServletRequest object or from a JSP page via
|
||||
* a scriptlet.</p>
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
@@ -103,8 +103,7 @@ public class Include extends Component {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Include.class);
|
||||
|
||||
private static String encoding;
|
||||
private static boolean encodingDefined = true;
|
||||
private static String systemEncoding = System.getProperty("file.encoding");
|
||||
|
||||
protected String value;
|
||||
private HttpServletRequest req;
|
||||
@@ -151,7 +150,9 @@ public class Include extends Component {
|
||||
try {
|
||||
urlBuf.append(URLEncoder.encode(values.get(i).toString(), "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
LOG.warn("unable to url-encode "+values.get(i).toString()+", it will be ignored");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("unable to url-encode "+values.get(i).toString()+", it will be ignored");
|
||||
}
|
||||
}
|
||||
|
||||
concat = "&";
|
||||
@@ -163,9 +164,11 @@ public class Include extends Component {
|
||||
|
||||
// Include
|
||||
try {
|
||||
include(result, writer, req, res);
|
||||
include(result, writer, req, res, defaultEncoding);
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Exception thrown during include of " + result, e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Exception thrown during include of " + result, e);
|
||||
}
|
||||
}
|
||||
|
||||
return super.end(writer, body);
|
||||
@@ -240,8 +243,32 @@ public class Include extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
public static void include(String aResult, Writer writer, ServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
String resourcePath = getContextRelativePath(request, aResult);
|
||||
/**
|
||||
* @deprecated use {@link #include(String, java.io.Writer, javax.servlet.ServletRequest,
|
||||
* javax.servlet.http.HttpServletResponse, String)} instead with correct encoding specified
|
||||
*/
|
||||
public static void include( String relativePath, Writer writer, ServletRequest request,
|
||||
HttpServletResponse response ) throws ServletException, IOException {
|
||||
include(relativePath, writer, request, response, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Include a resource in a response.
|
||||
*
|
||||
* @param relativePath the relative path of the resource to include; resolves to {@link #getContextRelativePath(javax.servlet.ServletRequest,
|
||||
* String)}
|
||||
* @param writer the Writer to write output to
|
||||
* @param request the current request
|
||||
* @param response the response to write to
|
||||
* @param encoding the file encoding to use for including the resource; if <tt>null</tt>, it will default to the
|
||||
* platform encoding
|
||||
*
|
||||
* @throws ServletException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void include( String relativePath, Writer writer, ServletRequest request,
|
||||
HttpServletResponse response, String encoding ) throws ServletException, IOException {
|
||||
String resourcePath = getContextRelativePath(request, relativePath);
|
||||
RequestDispatcher rd = request.getRequestDispatcher(resourcePath);
|
||||
|
||||
if (rd == null) {
|
||||
@@ -251,50 +278,17 @@ public class Include extends Component {
|
||||
PageResponse pageResponse = new PageResponse(response);
|
||||
|
||||
// Include the resource
|
||||
rd.include((HttpServletRequest) request, pageResponse);
|
||||
|
||||
//write the response back to the JspWriter, using the correct encoding.
|
||||
String encoding = getEncoding();
|
||||
rd.include(request, pageResponse);
|
||||
|
||||
if (encoding != null) {
|
||||
//use the encoding specified in the property file
|
||||
// Use given encoding
|
||||
pageResponse.getContent().writeTo(writer, encoding);
|
||||
} else {
|
||||
//use the platform specific encoding
|
||||
pageResponse.getContent().writeTo(writer, null);
|
||||
pageResponse.getContent().writeTo(writer, systemEncoding);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the encoding specified by the property 'struts.i18n.encoding' in struts.properties,
|
||||
* or return the default platform encoding if not specified.
|
||||
* <p/>
|
||||
* Note that if the property is not initially defined, this will return the system default,
|
||||
* even if the property is later defined. This is mainly for performance reasons. Undefined
|
||||
* properties throw exceptions, which are a costly operation.
|
||||
* <p/>
|
||||
* If the property is initially defined, it is read every time, until is is undefined, and then
|
||||
* the system default is used.
|
||||
* <p/>
|
||||
* Why not cache it completely? Some applications will wish to be able to dynamically set the
|
||||
* encoding at runtime.
|
||||
*
|
||||
* @return The encoding to be used.
|
||||
*/
|
||||
private static String getEncoding() {
|
||||
if (encodingDefined) {
|
||||
try {
|
||||
encoding = defaultEncoding;
|
||||
} catch (IllegalArgumentException e) {
|
||||
encoding = System.getProperty("file.encoding");
|
||||
encodingDefined = false;
|
||||
}
|
||||
}
|
||||
|
||||
return encoding;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of ServletOutputStream that stores all data written
|
||||
* to it in a temporary buffer accessible from {@link #getBuffer()} .
|
||||
|
||||
@@ -201,7 +201,9 @@ public class InputTransferSelect extends ListUIBean {
|
||||
|
||||
}
|
||||
else {
|
||||
LOG.warn("form enclosing inputtransferselect "+this+" not found, auto select upon form submit of inputtransferselect will not work");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("form enclosing inputtransferselect "+this+" not found, auto select upon form submit of inputtransferselect will not work");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,9 @@ public class MergeIterator extends ContextBean implements UnnamedParametric {
|
||||
for (Iterator parametersIterator = _parameters.iterator(); parametersIterator.hasNext(); ) {
|
||||
Object iteratorEntryObj = parametersIterator.next();
|
||||
if (! MakeIterator.isIterable(iteratorEntryObj)) {
|
||||
LOG.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
mergeIteratorFilter.setSource(MakeIterator.convert(iteratorEntryObj));
|
||||
|
||||
@@ -332,7 +332,9 @@ public class OptionTransferSelect extends DoubleListUIBean {
|
||||
|
||||
}
|
||||
else {
|
||||
LOG.warn("form enclosing optiontransferselect "+this+" not found, auto select upon form submit of optiontransferselect will not work");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("form enclosing optiontransferselect "+this+" not found, auto select upon form submit of optiontransferselect will not work");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,9 @@ public class Property extends Component {
|
||||
writer.write(prepare(defaultValue));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.info("Could not print out value '" + value + "'", e);
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Could not print out value '" + value + "'", e);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -77,7 +77,8 @@ public class ServletUrlRenderer implements UrlRenderer {
|
||||
|
||||
final String action = ai.getProxy().getActionName();
|
||||
final String namespace = ai.getProxy().getNamespace();
|
||||
result = urlComponent.determineActionURL(action, namespace, urlComponent.getMethod(),urlComponent.getHttpServletRequest(), urlComponent.getHttpServletResponse(), urlComponent.getParameters(), scheme, urlComponent.isIncludeContext(), urlComponent.isEncode(), urlComponent.isForceAddSchemeHostAndPort(), urlComponent.isEscapeAmp());
|
||||
final String method = urlComponent.getMethod() != null || !ai.getProxy().isMethodSpecified() ? urlComponent.getMethod() : ai.getProxy().getMethod();
|
||||
result = urlComponent.determineActionURL(action, namespace, method, urlComponent.getHttpServletRequest(), urlComponent.getHttpServletResponse(), urlComponent.getParameters(), scheme, urlComponent.isIncludeContext(), urlComponent.isEncode(), urlComponent.isForceAddSchemeHostAndPort(), urlComponent.isEscapeAmp());
|
||||
} else {
|
||||
String _value = urlComponent.getValue();
|
||||
|
||||
@@ -182,7 +183,7 @@ public class ServletUrlRenderer implements UrlRenderer {
|
||||
|
||||
// Warn user that the specified namespace/action combo
|
||||
// was not found in the configuration.
|
||||
if (namespace != null) {
|
||||
if (namespace != null && LOG.isWarnEnabled()) {
|
||||
LOG.warn("No configuration found for the specified action: '" + actionName + "' in namespace: '" + namespace + "'. Form action defaulting to 'action' attribute's literal value.");
|
||||
}
|
||||
|
||||
@@ -246,10 +247,14 @@ public class ServletUrlRenderer implements UrlRenderer {
|
||||
includeGetParameters(urlComponent);
|
||||
includeExtraParameters(urlComponent);
|
||||
} else if (includeParams != null) {
|
||||
LOG.warn("Unknown value for includeParams parameter to URL tag: " + includeParams);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unknown value for includeParams parameter to URL tag: " + includeParams);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Unable to put request parameters (" + urlComponent.getHttpServletRequest().getQueryString() + ") into parameter map.", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unable to put request parameters (" + urlComponent.getHttpServletRequest().getQueryString() + ") into parameter map.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -817,7 +817,9 @@ public abstract class UIBean extends Component {
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG.warn("No ancestor Form found, javascript based tooltip will not work, however standard HTML tooltip using alt and title attribute will still work ");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("No ancestor Form found, javascript based tooltip will not work, however standard HTML tooltip using alt and title attribute will still work ");
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: this is to keep backward compatibility, remove once when tooltipConfig is dropped
|
||||
@@ -902,7 +904,9 @@ public abstract class UIBean extends Component {
|
||||
if (form != null) {
|
||||
form.addParameter("customOnsubmitEnabled", Boolean.TRUE);
|
||||
} else {
|
||||
LOG.warn("Cannot find an Ancestor form, custom onsubmit is NOT enabled");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Cannot find an Ancestor form, custom onsubmit is NOT enabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -932,7 +936,9 @@ public abstract class UIBean extends Component {
|
||||
tooltipConfig.put(key, value);
|
||||
}
|
||||
else {
|
||||
LOG.warn("component "+component+" tooltip config param "+key+" has no value defined, skipped");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("component "+component+" tooltip config param "+key+" has no value defined, skipped");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,9 @@ public class UpDownSelect extends Select {
|
||||
ancestorForm.getParameters().put("updownselectIds", m);
|
||||
}
|
||||
else {
|
||||
LOG.warn("no ancestor form found for updownselect "+this+", therefore autoselect of all elements upon form submission will not work ");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("no ancestor form found for updownselect "+this+", therefore autoselect of all elements upon form submission will not work ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,9 @@ public abstract class BaseTemplateEngine implements TemplateEngine {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException io) {
|
||||
LOG.warn("Unable to close input stream", io);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unable to close input stream", io);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +124,9 @@ public abstract class BaseTemplateEngine implements TemplateEngine {
|
||||
try {
|
||||
return createFileInputStream(propFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
LOG.warn("Unable to find file in filesystem [" + propFile.getAbsolutePath() + "]");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unable to find file in filesystem [" + propFile.getAbsolutePath() + "]");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,10 +23,13 @@ package org.apache.struts2.components.template;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.jsp.PageContext;
|
||||
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.components.Include;
|
||||
import org.apache.struts2.components.UIBean;
|
||||
|
||||
@@ -40,6 +43,13 @@ import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
public class JspTemplateEngine extends BaseTemplateEngine {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(JspTemplateEngine.class);
|
||||
|
||||
String encoding;
|
||||
|
||||
@Inject(StrutsConstants.STRUTS_I18N_ENCODING)
|
||||
public void setEncoding(String encoding) {
|
||||
this.encoding = encoding;
|
||||
}
|
||||
|
||||
public void renderTemplate(TemplateRenderingContext templateContext) throws Exception {
|
||||
Template template = templateContext.getTemplate();
|
||||
|
||||
@@ -56,7 +66,7 @@ public class JspTemplateEngine extends BaseTemplateEngine {
|
||||
for (Template t : templates) {
|
||||
try {
|
||||
Include.include(getFinalTemplateName(t), pageContext.getOut(),
|
||||
pageContext.getRequest(), (HttpServletResponse) pageContext.getResponse());
|
||||
pageContext.getRequest(), (HttpServletResponse) pageContext.getResponse(), encoding);
|
||||
success = true;
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -251,7 +251,9 @@ public class BeanSelectionProvider implements ConfigurationProvider {
|
||||
while (customBundles.hasMoreTokens()) {
|
||||
String name = customBundles.nextToken();
|
||||
try {
|
||||
LOG.info("Loading global messages from " + name);
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Loading global messages from " + name);
|
||||
}
|
||||
LocalizedTextUtil.addDefaultResourceBundle(name);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could not find messages file " + name + ".properties. Skipping");
|
||||
@@ -268,7 +270,7 @@ public class BeanSelectionProvider implements ConfigurationProvider {
|
||||
if (!builder.contains(type)) {
|
||||
String foundName = props.getProperty(key, DEFAULT_BEAN_NAME);
|
||||
if (builder.contains(type, foundName)) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Choosing bean ("+foundName+") for "+type);
|
||||
}
|
||||
builder.alias(type, foundName, Container.DEFAULT_NAME);
|
||||
@@ -296,7 +298,9 @@ public class BeanSelectionProvider implements ConfigurationProvider {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG.warn("Unable to alias bean type "+type+", default mapping already assigned.");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unable to alias bean type "+type+", default mapping already assigned.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -89,7 +89,9 @@ public class LegacyPropertiesConfigurationProvider implements ConfigurationProvi
|
||||
}
|
||||
locale = new Locale(lang, country);
|
||||
} else {
|
||||
LOG.info("No locale define, substituting the default VM locale");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("No locale define, substituting the default VM locale");
|
||||
}
|
||||
locale = Locale.getDefault();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,9 @@ class PropertiesSettings extends Settings {
|
||||
URL settingsUrl = ClassLoaderUtils.getResource(name + ".properties", getClass());
|
||||
|
||||
if (settingsUrl == null) {
|
||||
LOG.debug(name + ".properties missing");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(name + ".properties missing");
|
||||
}
|
||||
settings = new LocatableProperties();
|
||||
return;
|
||||
}
|
||||
@@ -76,7 +78,9 @@ class PropertiesSettings extends Settings {
|
||||
try {
|
||||
in.close();
|
||||
} catch(IOException io) {
|
||||
LOG.warn("Unable to close input stream", io);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unable to close input stream", io);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ public class StrutsXmlConfigurationProvider extends XmlConfigurationProvider {
|
||||
dtdMappings.put("-//Apache Software Foundation//DTD Struts Configuration 2.0//EN", "struts-2.0.dtd");
|
||||
dtdMappings.put("-//Apache Software Foundation//DTD Struts Configuration 2.1//EN", "struts-2.1.dtd");
|
||||
dtdMappings.put("-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN", "struts-2.1.7.dtd");
|
||||
dtdMappings.put("-//Apache Software Foundation//DTD Struts Configuration 2.3//EN", "struts-2.3.dtd");
|
||||
setDtdMappings(dtdMappings);
|
||||
File file = new File(filename);
|
||||
if (file.getParent() != null) {
|
||||
|
||||
@@ -20,6 +20,16 @@
|
||||
*/
|
||||
package org.apache.struts2.dispatcher;
|
||||
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.util.ClassLoaderUtil;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.dispatcher.ng.HostConfig;
|
||||
import org.apache.struts2.util.ClassLoaderUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@@ -31,18 +41,6 @@ import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.dispatcher.ng.HostConfig;
|
||||
import org.apache.struts2.util.ClassLoaderUtils;
|
||||
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.util.ClassLoaderUtil;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
public class DefaultStaticContentLoader implements StaticContentLoader {
|
||||
/**
|
||||
* Provide a logging instance.
|
||||
@@ -342,7 +340,7 @@ public class DefaultStaticContentLoader implements StaticContentLoader {
|
||||
}
|
||||
|
||||
public boolean canHandle(String resourcePath) {
|
||||
return serveStatic && (resourcePath.startsWith("/struts") || resourcePath.startsWith("/static"));
|
||||
return serveStatic && (resourcePath.startsWith("/struts/") || resourcePath.startsWith("/static/"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -258,14 +258,16 @@ public class Dispatcher {
|
||||
// clean up ObjectFactory
|
||||
ObjectFactory objectFactory = getContainer().getInstance(ObjectFactory.class);
|
||||
if (objectFactory == null) {
|
||||
LOG.warn("Object Factory is null, something is seriously wrong, no clean up will be performed");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Object Factory is null, something is seriously wrong, no clean up will be performed");
|
||||
}
|
||||
}
|
||||
if (objectFactory instanceof ObjectFactoryDestroyable) {
|
||||
try {
|
||||
((ObjectFactoryDestroyable)objectFactory).destroy();
|
||||
}
|
||||
catch(Exception e) {
|
||||
// catch any exception that may occured during destroy() and log it
|
||||
// catch any exception that may occurred during destroy() and log it
|
||||
LOG.error("exception occurred while destroying ObjectFactory ["+objectFactory+"]", e);
|
||||
}
|
||||
}
|
||||
@@ -305,11 +307,11 @@ public class Dispatcher {
|
||||
}
|
||||
|
||||
private void init_DefaultProperties() {
|
||||
configurationManager.addConfigurationProvider(new DefaultPropertiesProvider());
|
||||
configurationManager.addContainerProvider(new DefaultPropertiesProvider());
|
||||
}
|
||||
|
||||
private void init_LegacyStrutsProperties() {
|
||||
configurationManager.addConfigurationProvider(new LegacyPropertiesConfigurationProvider());
|
||||
configurationManager.addContainerProvider(new LegacyPropertiesConfigurationProvider());
|
||||
}
|
||||
|
||||
private void init_TraditionalXmlConfigurations() {
|
||||
@@ -321,9 +323,9 @@ public class Dispatcher {
|
||||
for (String file : files) {
|
||||
if (file.endsWith(".xml")) {
|
||||
if ("xwork.xml".equals(file)) {
|
||||
configurationManager.addConfigurationProvider(createXmlConfigurationProvider(file, false));
|
||||
configurationManager.addContainerProvider(createXmlConfigurationProvider(file, false));
|
||||
} else {
|
||||
configurationManager.addConfigurationProvider(createStrutsXmlConfigurationProvider(file, false, servletContext));
|
||||
configurationManager.addContainerProvider(createStrutsXmlConfigurationProvider(file, false, servletContext));
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invalid configuration file name");
|
||||
@@ -347,7 +349,7 @@ public class Dispatcher {
|
||||
try {
|
||||
Class cls = ClassLoaderUtils.loadClass(cname, this.getClass());
|
||||
ConfigurationProvider prov = (ConfigurationProvider)cls.newInstance();
|
||||
configurationManager.addConfigurationProvider(prov);
|
||||
configurationManager.addContainerProvider(prov);
|
||||
} catch (InstantiationException e) {
|
||||
throw new ConfigurationException("Unable to instantiate provider: "+cname, e);
|
||||
} catch (IllegalAccessException e) {
|
||||
@@ -360,11 +362,19 @@ public class Dispatcher {
|
||||
}
|
||||
|
||||
private void init_FilterInitParameters() {
|
||||
configurationManager.addConfigurationProvider(new ConfigurationProvider() {
|
||||
public void destroy() {}
|
||||
public void init(Configuration configuration) throws ConfigurationException {}
|
||||
public void loadPackages() throws ConfigurationException {}
|
||||
public boolean needsReload() { return false; }
|
||||
configurationManager.addContainerProvider(new ConfigurationProvider() {
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
public void init(Configuration configuration) throws ConfigurationException {
|
||||
}
|
||||
|
||||
public void loadPackages() throws ConfigurationException {
|
||||
}
|
||||
|
||||
public boolean needsReload() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void register(ContainerBuilder builder, LocatableProperties props) throws ConfigurationException {
|
||||
props.putAll(initParams);
|
||||
@@ -373,7 +383,7 @@ public class Dispatcher {
|
||||
}
|
||||
|
||||
private void init_AliasStandardObjects() {
|
||||
configurationManager.addConfigurationProvider(new BeanSelectionProvider());
|
||||
configurationManager.addContainerProvider(new BeanSelectionProvider());
|
||||
}
|
||||
|
||||
private Container init_PreloadConfiguration() {
|
||||
@@ -394,8 +404,10 @@ public class Dispatcher {
|
||||
private void init_CheckWebLogicWorkaround(Container container) {
|
||||
// test whether param-access workaround needs to be enabled
|
||||
if (servletContext != null && servletContext.getServerInfo() != null
|
||||
&& servletContext.getServerInfo().indexOf("WebLogic") >= 0) {
|
||||
LOG.info("WebLogic server detected. Enabling Struts parameter access work-around.");
|
||||
&& servletContext.getServerInfo().contains("WebLogic")) {
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("WebLogic server detected. Enabling Struts parameter access work-around.");
|
||||
}
|
||||
paramsWorkaroundEnabled = true;
|
||||
} else {
|
||||
paramsWorkaroundEnabled = "true".equals(container.getInstance(String.class,
|
||||
@@ -512,7 +524,9 @@ public class Dispatcher {
|
||||
LOG.error("Could not find action or result\n" + reqStr, e);
|
||||
}
|
||||
else {
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Could not find action or result", e);
|
||||
}
|
||||
}
|
||||
sendError(request, response, context, HttpServletResponse.SC_NOT_FOUND, e);
|
||||
} catch (Exception e) {
|
||||
@@ -616,7 +630,9 @@ public class Dispatcher {
|
||||
|
||||
if (saveDir.equals("")) {
|
||||
File tempdir = (File) servletContext.getAttribute("javax.servlet.context.tempdir");
|
||||
LOG.info("Unable to find 'struts.multipart.saveDir' property setting. Defaulting to javax.servlet.context.tempdir");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Unable to find 'struts.multipart.saveDir' property setting. Defaulting to javax.servlet.context.tempdir");
|
||||
}
|
||||
|
||||
if (tempdir != null) {
|
||||
saveDir = tempdir.toString();
|
||||
@@ -626,7 +642,7 @@ public class Dispatcher {
|
||||
File multipartSaveDir = new File(saveDir);
|
||||
|
||||
if (!multipartSaveDir.exists()) {
|
||||
if (multipartSaveDir.mkdir() == false) {
|
||||
if (!multipartSaveDir.mkdir()) {
|
||||
String logMessage;
|
||||
try {
|
||||
logMessage = "Could not find create multipart save directory '"+multipartSaveDir.getCanonicalPath()+"'.";
|
||||
@@ -637,7 +653,9 @@ public class Dispatcher {
|
||||
LOG.error(logMessage);
|
||||
}
|
||||
else {
|
||||
LOG.warn(logMessage);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn(logMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -705,7 +723,7 @@ public class Dispatcher {
|
||||
}
|
||||
|
||||
String content_type = request.getContentType();
|
||||
if (content_type != null && content_type.indexOf("multipart/form-data") != -1) {
|
||||
if (content_type != null && content_type.contains("multipart/form-data")) {
|
||||
MultiPartRequest mpr = null;
|
||||
//check for alternate implementations of MultiPartRequest
|
||||
Set<String> multiNames = getContainer().getInstanceNames(MultiPartRequest.class);
|
||||
@@ -754,7 +772,9 @@ public class Dispatcher {
|
||||
|
||||
if ((currentFile != null) && currentFile.isFile()) {
|
||||
if (!currentFile.delete()) {
|
||||
LOG.warn("Resource Leaking: Could not remove uploaded file '" + currentFile.getCanonicalPath() + "'.");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Resource Leaking: Could not remove uploaded file '" + currentFile.getCanonicalPath() + "'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -773,7 +793,7 @@ public class Dispatcher {
|
||||
public void sendError(HttpServletRequest request, HttpServletResponse response,
|
||||
ServletContext ctx, int code, Exception e) {
|
||||
Boolean devModeOverride = FilterDispatcher.getDevModeOverride();
|
||||
if (devModeOverride != null ? devModeOverride.booleanValue() : devMode) {
|
||||
if (devModeOverride != null ? devModeOverride : devMode) {
|
||||
response.setContentType("text/html");
|
||||
|
||||
try {
|
||||
|
||||
@@ -21,17 +21,17 @@
|
||||
|
||||
package org.apache.struts2.dispatcher;
|
||||
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: description -->
|
||||
*
|
||||
@@ -120,7 +120,9 @@ public class PlainTextResult extends StrutsResultSupport {
|
||||
charset = Charset.forName(charSet);
|
||||
}
|
||||
else {
|
||||
LOG.warn("charset ["+charSet+"] is not recognized ");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("charset ["+charSet+"] is not recognized ");
|
||||
}
|
||||
charset = null;
|
||||
}
|
||||
}
|
||||
@@ -141,24 +143,24 @@ public class PlainTextResult extends StrutsResultSupport {
|
||||
PrintWriter writer = response.getWriter();
|
||||
InputStreamReader reader = null;
|
||||
try {
|
||||
InputStream resourceAsStream = servletContext.getResourceAsStream(finalLocation);
|
||||
if (charset != null) {
|
||||
reader = new InputStreamReader(servletContext.getResourceAsStream(finalLocation), charset);
|
||||
reader = new InputStreamReader(resourceAsStream, charset);
|
||||
} else {
|
||||
reader = new InputStreamReader(resourceAsStream);
|
||||
}
|
||||
else {
|
||||
reader = new InputStreamReader(servletContext.getResourceAsStream(finalLocation));
|
||||
}
|
||||
if (reader == null) {
|
||||
LOG.warn("resource at location ["+finalLocation+"] cannot be obtained (return null) from ServletContext !!! ");
|
||||
}
|
||||
else {
|
||||
if (resourceAsStream == null) {
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("resource at location ["+finalLocation+"] cannot be obtained (return null) from ServletContext !!! ");
|
||||
}
|
||||
} else {
|
||||
char[] buffer = new char[BUFFER_SIZE];
|
||||
int charRead = 0;
|
||||
int charRead;
|
||||
while((charRead = reader.read(buffer)) != -1) {
|
||||
writer.write(buffer, 0, charRead);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (reader != null)
|
||||
reader.close();
|
||||
if (writer != null) {
|
||||
|
||||
@@ -21,51 +21,65 @@
|
||||
|
||||
package org.apache.struts2.dispatcher;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapper;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapping;
|
||||
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
import com.opensymphony.xwork2.util.reflection.ReflectionExceptionHandler;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapper;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapping;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: description -->
|
||||
*
|
||||
* This result uses the {@link ActionMapper} provided by the {@link ActionMapperFactory} to redirect the browser to a
|
||||
* URL that invokes the specified action and (optional) namespace. This is better than the {@link ServletRedirectResult}
|
||||
* because it does not require you to encode the URL patterns processed by the {@link ActionMapper} in to your struts.xml
|
||||
* configuration files. This means you can change your URL patterns at any point and your application will still work.
|
||||
* It is strongly recommended that if you are redirecting to another action, you use this result rather than the
|
||||
*
|
||||
* This result uses the {@link ActionMapper} provided by the
|
||||
* {@link ActionMapperFactory} to redirect the browser to a URL that invokes the
|
||||
* specified action and (optional) namespace. This is better than the
|
||||
* {@link ServletRedirectResult} because it does not require you to encode the
|
||||
* URL patterns processed by the {@link ActionMapper} in to your struts.xml
|
||||
* configuration files. This means you can change your URL patterns at any point
|
||||
* and your application will still work. It is strongly recommended that if you
|
||||
* are redirecting to another action, you use this result rather than the
|
||||
* standard redirect result.
|
||||
*
|
||||
* See examples below for an example of how request parameters could be passed in.
|
||||
*
|
||||
*
|
||||
* See examples below for an example of how request parameters could be passed
|
||||
* in.
|
||||
*
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
*
|
||||
* <b>This result type takes the following parameters:</b>
|
||||
*
|
||||
*
|
||||
* <!-- START SNIPPET: params -->
|
||||
*
|
||||
*
|
||||
* <ul>
|
||||
*
|
||||
* <li><b>actionName (default)</b> - The name of the action that will be
|
||||
* redirected to.</li>
|
||||
*
|
||||
* <li><b>namespace</b> - Used to determine which namespace the action is in
|
||||
* that we're redirecting to. If namespace is null, the default will be the
|
||||
* current namespace.</li>
|
||||
*
|
||||
* <li><b>suppressEmptyParameters</b> - Optional boolean (defaults to false) that
|
||||
* can prevent parameters with no values from being included in the redirect
|
||||
* URL.</li>
|
||||
*
|
||||
* <li><b>actionName (default)</b> - the name of the action that will be redirect to</li>
|
||||
*
|
||||
* <li><b>namespace</b> - used to determine which namespace the action is in that we're redirecting to . If namespace is
|
||||
* null, this defaults to the current namespace</li>
|
||||
*
|
||||
* <li><b>supressEmptyParameters</b> - optional boolean (defaults to false) that can prevent parameters with no values
|
||||
* from being included in the redirect URL.</li>
|
||||
* <li><b>parse</b> - Boolean, true by default. If set to false, the actionName
|
||||
* param will not be parsed for Ognl expressions.</li>
|
||||
*
|
||||
* <li><b>anchor</b> - Optional. Also known as "fragment" or colloquially as
|
||||
* "hash". You can specify an anchor for a result.</li>
|
||||
* </ul>
|
||||
*
|
||||
*
|
||||
* <!-- END SNIPPET: params -->
|
||||
*
|
||||
*
|
||||
* <b>Example:</b>
|
||||
*
|
||||
* <pre><!-- START SNIPPET: example -->
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
* <package name="public" extends="struts-default">
|
||||
* <action name="login" class="...">
|
||||
* <!-- Redirect to another namespace -->
|
||||
@@ -75,24 +89,24 @@ import java.util.List;
|
||||
* </result>
|
||||
* </action>
|
||||
* </package>
|
||||
*
|
||||
*
|
||||
* <package name="secure" extends="struts-default" namespace="/secure">
|
||||
* <-- Redirect to an action in the same namespace -->
|
||||
* <action name="dashboard" class="...">
|
||||
* <result>dashboard.jsp</result>
|
||||
* <result name="error" type="redirectAction">error</result>
|
||||
* </action>
|
||||
*
|
||||
*
|
||||
* <action name="error" class="...">
|
||||
* <result>error.jsp</result>
|
||||
* </action>
|
||||
* </package>
|
||||
*
|
||||
*
|
||||
* <package name="passingRequestParameters" extends="struts-default" namespace="/passingRequestParameters">
|
||||
* <-- Pass parameters (reportType, width and height) -->
|
||||
* <!-- Pass parameters (reportType, width and height) -->
|
||||
* <!--
|
||||
* The redirectAction url generated will be :
|
||||
* /genReport/generateReport.action?reportType=pie&width=100&height=100
|
||||
* /genReport/generateReport.action?reportType=pie&width=100&height=100#summary
|
||||
* -->
|
||||
* <action name="gatherReportInfo" class="...">
|
||||
* <result name="showReportResult" type="redirectAction">
|
||||
@@ -102,14 +116,16 @@ import java.util.List;
|
||||
* <param name="width">100</param>
|
||||
* <param name="height">100</param>
|
||||
* <param name="empty"></param>
|
||||
* <param name="supressEmptyParameters">true</param>
|
||||
* <param name="suppressEmptyParameters">true</param>
|
||||
* <param name="anchor">summary</param>
|
||||
* </result>
|
||||
* </action>
|
||||
* </package>
|
||||
*
|
||||
*
|
||||
* <!-- END SNIPPET: example --></pre>
|
||||
*
|
||||
*
|
||||
*
|
||||
* <!-- END SNIPPET: example -->
|
||||
* </pre>
|
||||
*
|
||||
* @see ActionMapper
|
||||
*/
|
||||
public class ServletActionRedirectResult extends ServletRedirectResult implements ReflectionExceptionHandler {
|
||||
@@ -119,8 +135,6 @@ public class ServletActionRedirectResult extends ServletRedirectResult implement
|
||||
/** The default parameter */
|
||||
public static final String DEFAULT_PARAM = "actionName";
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ServletActionRedirectResult.class);
|
||||
|
||||
protected String actionName;
|
||||
protected String namespace;
|
||||
protected String method;
|
||||
@@ -137,7 +151,6 @@ public class ServletActionRedirectResult extends ServletRedirectResult implement
|
||||
this(null, actionName, method, null);
|
||||
}
|
||||
|
||||
|
||||
public ServletActionRedirectResult(String namespace, String actionName, String method) {
|
||||
this(namespace, actionName, method, null);
|
||||
}
|
||||
@@ -149,21 +162,26 @@ public class ServletActionRedirectResult extends ServletRedirectResult implement
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see com.opensymphony.xwork2.Result#execute(com.opensymphony.xwork2.ActionInvocation)
|
||||
*/
|
||||
public void execute(ActionInvocation invocation) throws Exception {
|
||||
public void execute(ActionInvocation invocation) throws Exception
|
||||
{
|
||||
actionName = conditionalParse(actionName, invocation);
|
||||
if (namespace == null) {
|
||||
if (namespace == null)
|
||||
{
|
||||
namespace = invocation.getProxy().getNamespace();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
namespace = conditionalParse(namespace, invocation);
|
||||
}
|
||||
if (method == null) {
|
||||
if (method == null)
|
||||
{
|
||||
method = "";
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
method = conditionalParse(method, invocation);
|
||||
}
|
||||
|
||||
@@ -176,34 +194,39 @@ public class ServletActionRedirectResult extends ServletRedirectResult implement
|
||||
|
||||
/**
|
||||
* Sets the action name
|
||||
*
|
||||
* @param actionName The name
|
||||
*
|
||||
* @param actionName
|
||||
* The name
|
||||
*/
|
||||
public void setActionName(String actionName) {
|
||||
public void setActionName(String actionName)
|
||||
{
|
||||
this.actionName = actionName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the namespace
|
||||
*
|
||||
* @param namespace The namespace
|
||||
*
|
||||
* @param namespace
|
||||
* The namespace
|
||||
*/
|
||||
public void setNamespace(String namespace) {
|
||||
public void setNamespace(String namespace)
|
||||
{
|
||||
this.namespace = namespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the method
|
||||
*
|
||||
* @param method The method
|
||||
*
|
||||
* @param method
|
||||
* The method
|
||||
*/
|
||||
public void setMethod(String method) {
|
||||
public void setMethod(String method)
|
||||
{
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
protected List<String> getProhibitedResultParams() {
|
||||
return Arrays.asList(new String[]{
|
||||
DEFAULT_PARAM, "namespace", "method", "encode", "parse", "location",
|
||||
"prependServletContext", "supressEmptyParameters", "anchor"});
|
||||
protected List<String> getProhibitedResultParams()
|
||||
{
|
||||
return Arrays.asList(DEFAULT_PARAM, "namespace", "method", "encode", "parse", "location", "prependServletContext", "suppressEmptyParameters", "anchor");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,18 +37,13 @@ import org.apache.struts2.views.util.UrlHelper;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static javax.servlet.http.HttpServletResponse.SC_FOUND;
|
||||
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: description -->
|
||||
*
|
||||
*
|
||||
* Calls the {@link HttpServletResponse#sendRedirect(String) sendRedirect}
|
||||
* method to the location specified. The response is told to redirect the
|
||||
* browser to the specified location (a new request from the client). The
|
||||
@@ -57,40 +52,46 @@ import static javax.servlet.http.HttpServletResponse.SC_FOUND;
|
||||
* available. This is because actions are built on a single-thread model. The
|
||||
* only way to pass data is through the session or with web parameters
|
||||
* (url?name=value) which can be OGNL expressions.
|
||||
*
|
||||
*
|
||||
* <!-- END SNIPPET: description -->
|
||||
* <p/>
|
||||
* <b>This result type takes the following parameters:</b>
|
||||
*
|
||||
*
|
||||
* <!-- START SNIPPET: params -->
|
||||
*
|
||||
*
|
||||
* <ul>
|
||||
*
|
||||
*
|
||||
* <li><b>location (default)</b> - the location to go to after execution.</li>
|
||||
*
|
||||
*
|
||||
* <li><b>parse</b> - true by default. If set to false, the location param will
|
||||
* not be parsed for Ognl expressions.</li>
|
||||
*
|
||||
* <li><b>anchor</b> - optional, you can specify an anchor for result.</li>
|
||||
*
|
||||
*
|
||||
* <li><b>anchor</b> - Optional. Also known as "fragment" or colloquially as
|
||||
* "hash". You can specify an anchor for a result.</li>
|
||||
* </ul>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* This result follows the same rules from {@link StrutsResultSupport}.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <!-- END SNIPPET: params -->
|
||||
*
|
||||
*
|
||||
* <b>Example:</b>
|
||||
*
|
||||
* <pre><!-- START SNIPPET: example -->
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
* <!--
|
||||
* The redirect URL generated will be:
|
||||
* /foo.jsp#FRAGMENT
|
||||
* -->
|
||||
* <result name="success" type="redirect">
|
||||
* <param name="location">foo.jsp</param>
|
||||
* <param name="parse">false</param>
|
||||
* <param name="anchor">FRAGMENT</param>
|
||||
* </result>
|
||||
* <!-- END SNIPPET: example --></pre>
|
||||
*
|
||||
* <!-- END SNIPPET: example -->
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
public class ServletRedirectResult extends StrutsResultSupport implements ReflectionExceptionHandler {
|
||||
|
||||
@@ -104,10 +105,10 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec
|
||||
|
||||
protected int statusCode = SC_FOUND;
|
||||
|
||||
protected boolean supressEmptyParameters = false;
|
||||
protected boolean suppressEmptyParameters = false;
|
||||
|
||||
protected Map<String, String> requestParameters = new LinkedHashMap<String, String>();
|
||||
|
||||
|
||||
protected String anchor;
|
||||
|
||||
public ServletRedirectResult() {
|
||||
@@ -117,41 +118,50 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec
|
||||
public ServletRedirectResult(String location) {
|
||||
this(location, null);
|
||||
}
|
||||
|
||||
|
||||
public ServletRedirectResult(String location, String anchor) {
|
||||
super(location);
|
||||
this.anchor = anchor;
|
||||
}
|
||||
|
||||
|
||||
@Inject
|
||||
public void setActionMapper(ActionMapper mapper) {
|
||||
public void setActionMapper(ActionMapper mapper)
|
||||
{
|
||||
this.actionMapper = mapper;
|
||||
}
|
||||
|
||||
public void setStatusCode(int code) {
|
||||
public void setStatusCode(int code)
|
||||
{
|
||||
this.statusCode = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the optional anchor value.
|
||||
*
|
||||
* @param anchor
|
||||
*/
|
||||
public void setAnchor(String anchor) {
|
||||
public void setAnchor(String anchor)
|
||||
{
|
||||
this.anchor = anchor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether or not to prepend the servlet context path to the redirected URL.
|
||||
*
|
||||
* @param prependServletContext <tt>true</tt> to prepend the location with the servlet context path,
|
||||
* <tt>false</tt> otherwise.
|
||||
* Sets whether or not to prepend the servlet context path to the redirected
|
||||
* URL.
|
||||
*
|
||||
* @param prependServletContext
|
||||
* <tt>true</tt> to prepend the location with the servlet context
|
||||
* path, <tt>false</tt> otherwise.
|
||||
*/
|
||||
public void setPrependServletContext(boolean prependServletContext) {
|
||||
public void setPrependServletContext(boolean prependServletContext)
|
||||
{
|
||||
this.prependServletContext = prependServletContext;
|
||||
}
|
||||
|
||||
public void execute(ActionInvocation invocation) throws Exception {
|
||||
if (anchor != null) {
|
||||
|
||||
public void execute(ActionInvocation invocation) throws Exception
|
||||
{
|
||||
if (anchor != null)
|
||||
{
|
||||
anchor = conditionalParse(anchor, invocation);
|
||||
}
|
||||
|
||||
@@ -159,48 +169,62 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirects to the location specified by calling {@link HttpServletResponse#sendRedirect(String)}.
|
||||
*
|
||||
* @param finalLocation the location to redirect to.
|
||||
* @param invocation an encapsulation of the action execution state.
|
||||
* @throws Exception if an error occurs when redirecting.
|
||||
* Redirects to the location specified by calling
|
||||
* {@link HttpServletResponse#sendRedirect(String)}.
|
||||
*
|
||||
* @param finalLocation
|
||||
* the location to redirect to.
|
||||
* @param invocation
|
||||
* an encapsulation of the action execution state.
|
||||
* @throws Exception
|
||||
* if an error occurs when redirecting.
|
||||
*/
|
||||
protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception {
|
||||
protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception
|
||||
{
|
||||
ActionContext ctx = invocation.getInvocationContext();
|
||||
HttpServletRequest request = (HttpServletRequest) ctx.get(ServletActionContext.HTTP_REQUEST);
|
||||
HttpServletResponse response = (HttpServletResponse) ctx.get(ServletActionContext.HTTP_RESPONSE);
|
||||
|
||||
if (isPathUrl(finalLocation)) {
|
||||
if (!finalLocation.startsWith("/")) {
|
||||
ActionMapping mapping = actionMapper.getMapping(
|
||||
request, Dispatcher.getInstance().getConfigurationManager());
|
||||
if (isPathUrl(finalLocation))
|
||||
{
|
||||
if (!finalLocation.startsWith("/"))
|
||||
{
|
||||
ActionMapping mapping = actionMapper.getMapping(request, Dispatcher.getInstance().getConfigurationManager());
|
||||
String namespace = null;
|
||||
if (mapping != null) {
|
||||
if (mapping != null)
|
||||
{
|
||||
namespace = mapping.getNamespace();
|
||||
}
|
||||
|
||||
if ((namespace != null) && (namespace.length() > 0) && (!"/".equals(namespace))) {
|
||||
if ((namespace != null) && (namespace.length() > 0) && (!"/".equals(namespace)))
|
||||
{
|
||||
finalLocation = namespace + "/" + finalLocation;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
finalLocation = "/" + finalLocation;
|
||||
}
|
||||
}
|
||||
|
||||
// if the URL's are relative to the servlet context, append the servlet context path
|
||||
if (prependServletContext && (request.getContextPath() != null) && (request.getContextPath().length() > 0)) {
|
||||
if (prependServletContext && (request.getContextPath() != null) && (request.getContextPath().length() > 0))
|
||||
{
|
||||
finalLocation = request.getContextPath() + finalLocation;
|
||||
}
|
||||
|
||||
ResultConfig resultConfig = invocation.getProxy().getConfig().getResults().get(invocation.getResultCode());
|
||||
if (resultConfig != null ) {
|
||||
Map resultConfigParams = resultConfig.getParams();
|
||||
for (Iterator i = resultConfigParams.entrySet().iterator(); i.hasNext();) {
|
||||
Map.Entry e = (Map.Entry) i.next();
|
||||
if (resultConfig != null)
|
||||
{
|
||||
Map<String, String> resultConfigParams = resultConfig.getParams();
|
||||
|
||||
if (!getProhibitedResultParams().contains(e.getKey())) {
|
||||
String potentialValue = e.getValue() == null ? "" : conditionalParse(e.getValue().toString(), invocation);
|
||||
if (!supressEmptyParameters || ((potentialValue != null) && (potentialValue.length() > 0))) {
|
||||
requestParameters.put(e.getKey().toString(), potentialValue);
|
||||
for (Map.Entry<String, String> e : resultConfigParams.entrySet())
|
||||
{
|
||||
if (!getProhibitedResultParams().contains(e.getKey()))
|
||||
{
|
||||
String potentialValue = e.getValue() == null ? "" : conditionalParse(e.getValue(), invocation);
|
||||
if (!suppressEmptyParameters || ((potentialValue != null) && (potentialValue.length() > 0)))
|
||||
{
|
||||
requestParameters.put(e.getKey(), potentialValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -210,39 +234,45 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec
|
||||
UrlHelper.buildParametersString(requestParameters, tmpLocation, "&");
|
||||
|
||||
// add the anchor
|
||||
if (anchor != null) {
|
||||
if (anchor != null)
|
||||
{
|
||||
tmpLocation.append('#').append(anchor);
|
||||
}
|
||||
|
||||
finalLocation = response.encodeRedirectURL(tmpLocation.toString());
|
||||
}
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
if (LOG.isDebugEnabled())
|
||||
{
|
||||
LOG.debug("Redirecting to finalLocation " + finalLocation);
|
||||
}
|
||||
|
||||
sendRedirect(response, finalLocation);
|
||||
}
|
||||
|
||||
protected List<String> getProhibitedResultParams() {
|
||||
return Arrays.asList(new String[]{
|
||||
DEFAULT_PARAM, "namespace", "method", "encode", "parse", "location",
|
||||
"prependServletContext", "supressEmptyParameters", "anchor"});
|
||||
protected List<String> getProhibitedResultParams()
|
||||
{
|
||||
return Arrays.asList(DEFAULT_PARAM, "namespace", "method", "encode", "parse", "location", "prependServletContext", "suppressEmptyParameters", "anchor");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sends the redirection. Can be overridden to customize how the redirect is handled (i.e. to use a different
|
||||
* status code)
|
||||
*
|
||||
* @param response The response
|
||||
* @param finalLocation The location URI
|
||||
* Sends the redirection. Can be overridden to customize how the redirect is
|
||||
* handled (i.e. to use a different status code)
|
||||
*
|
||||
* @param response
|
||||
* The response
|
||||
* @param finalLocation
|
||||
* The location URI
|
||||
* @throws IOException
|
||||
*/
|
||||
protected void sendRedirect(HttpServletResponse response, String finalLocation) throws IOException {
|
||||
if (SC_FOUND == statusCode) {
|
||||
protected void sendRedirect(HttpServletResponse response, String finalLocation) throws IOException
|
||||
{
|
||||
if (SC_FOUND == statusCode)
|
||||
{
|
||||
response.sendRedirect(finalLocation);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(statusCode);
|
||||
response.setHeader("Location", finalLocation);
|
||||
response.getWriter().write(finalLocation);
|
||||
@@ -251,7 +281,8 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec
|
||||
|
||||
}
|
||||
|
||||
private static boolean isPathUrl(String url) {
|
||||
private static boolean isPathUrl(String url)
|
||||
{
|
||||
// filter out "http:", "https:", "mailto:", "file:", "ftp:"
|
||||
// since the only valid places for : in URL's is before the path specification
|
||||
// either before the port, or after the protocol
|
||||
@@ -259,26 +290,32 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the supressEmptyParameters option
|
||||
*
|
||||
* @param supressEmptyParameters The new value for this option
|
||||
* Sets the suppressEmptyParameters option
|
||||
*
|
||||
* @param suppressEmptyParameters
|
||||
* The new value for this option
|
||||
*/
|
||||
public void setSupressEmptyParameters(boolean supressEmptyParameters) {
|
||||
this.supressEmptyParameters = supressEmptyParameters;
|
||||
public void setSuppressEmptyParameters(boolean suppressEmptyParameters)
|
||||
{
|
||||
this.suppressEmptyParameters = suppressEmptyParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a request parameter to be added to the redirect url
|
||||
*
|
||||
* @param key The parameter name
|
||||
* @param value The parameter value
|
||||
*
|
||||
* @param key
|
||||
* The parameter name
|
||||
* @param value
|
||||
* The parameter value
|
||||
*/
|
||||
public ServletRedirectResult addParameter(String key, Object value) {
|
||||
public ServletRedirectResult addParameter(String key, Object value)
|
||||
{
|
||||
requestParameters.put(key, String.valueOf(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
public void handle(ReflectionException ex) {
|
||||
public void handle(ReflectionException ex)
|
||||
{
|
||||
// Only log as debug as they are probably parameters to be appended to the url
|
||||
LOG.debug(ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user