Compare commits

..

1 Commits

Author SHA1 Message Date
Lukasz Lenart 28297863ae [maven-release-plugin] copy for tag STRUTS_2_3_7
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7@1406061 13f79535-47bb-0310-9956-ffa450edef68
2012-11-06 07:05:44 +00:00
490 changed files with 6303 additions and 13009 deletions
+11 -19
View File
@@ -26,17 +26,17 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-blank</artifactId>
<packaging>war</packaging>
<name>Blank Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/apps/blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/apps/blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_15/apps/blank</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/apps/blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/apps/blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_7/apps/blank</url>
</scm>
<dependencies>
@@ -53,19 +53,10 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>struts2-junit-plugin</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -74,14 +65,15 @@
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.0.1</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<scanIntervalSeconds>10</scanIntervalSeconds>
<scanTargets>
<scanTarget>src/main/webapp/WEB-INF</scanTarget>
<scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget>
<scanTarget>src/main/resources/struts.xml</scanTarget>
<scanTarget>src/main/resources/example.xml</scanTarget>
</scanTargets>
</configuration>
</plugin>
@@ -1,26 +0,0 @@
#
# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
#
# The five logging levels used by Log are (in order):
#
# 1. DEBUG (the least serious)
# 2. INFO
# 3. WARN
# 4. ERROR
# 5. FATAL (the most serious)
# Set root logger level to WARN and append to stdout
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
# Print only messages of level ERROR or above in the package noModule.
log4j.logger.noModule=FATAL
log4j.logger.com.opensymphony.xwork2=DEBUG
log4j.logger.org.apache.struts2=DEBUG
+1 -1
View File
@@ -6,7 +6,7 @@
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<constant name="struts.devMode" value="false" />
<package name="default" namespace="/" extends="struts-default">
-47
View File
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="reports"/>
</body>
</project>
+6 -5
View File
@@ -26,17 +26,17 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jboss-blank</artifactId>
<packaging>war</packaging>
<name>JBoss Blank Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/apps/jboss-blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/apps/jboss-blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_15/apps/jboss-blank</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/apps/jboss-blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/apps/jboss-blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_7/apps/jboss-blank</url>
</scm>
<dependencies>
@@ -57,6 +57,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>struts2-junit-plugin</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
-47
View File
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="reports"/>
</body>
</project>
+7 -31
View File
@@ -26,17 +26,17 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-mailreader</artifactId>
<packaging>war</packaging>
<name>Mail Reader Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/apps/mailreader</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/apps/mailreader</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_15/apps/mailreader</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/apps/mailreader</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/apps/mailreader</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_7/apps/mailreader</url>
</scm>
<dependencies>
@@ -68,35 +68,11 @@
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.0.1</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
<value>file:${basedir}/src/main/resources/log4j.properties</value>
</systemProperty>
<systemProperty>
<name>slf4j</name>
<value>false</value>
</systemProperty>
</systemProperties>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
<webAppConfig>
<contextPath>/struts2-mailreader</contextPath>
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webAppConfig>
</configuration>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
@@ -1,36 +0,0 @@
#
# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
#
# The five logging levels used by Log are (in order):
#
# 1. DEBUG (the least serious)
# 2. INFO
# 3. WARN
# 4. ERROR
# 5. FATAL (the most serious)
# Set root logger level to WARN and append to stdout
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
# Print only messages of level ERROR or above in the package noModule.
log4j.logger.noModule=FATAL
# OpenSymphony Stuff
log4j.logger.freemarker=INFO
log4j.logger.com.opensymphony=INFO
log4j.logger.com.opensymphony.xwork2.ognl=ERROR
log4j.logger.org.apache.struts2=WARN
log4j.logger.org.apache.struts2.components=WARN
log4j.logger.org.apache.struts2.dispatcher=WARN
log4j.logger.org.apache.struts2.convention=INFO
# Spring Stuff
log4j.logger.org.springframework=WARN
@@ -1,9 +1,13 @@
<?xml version='1.0'?>
<database>
<user username="user" fromAddress="John.User@somewhere.com" fullName="John Q. User" password="pass">
<subscription host="mail.yahoo.com" autoConnect="false" password="foo" type="imap" username="jquser">
</subscription>
<subscription host="mail.hotmail.com" autoConnect="false" password="bar" type="pop3" username="user1234">
</subscription>
</user>
<user username="user" fromAddress="John.User@somewhere.com"
fullName="John Q. User" password="pass">
<subscription host="mail.hotmail.com" autoConnect="false"
password="bar" type="pop3" username="user1234">
</subscription>
<subscription host="mail.yahoo.com" autoConnect="false" password="foo"
type="imap" username="jquser">
</subscription>
</user>
</database>
-47
View File
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="reports"/>
</body>
</project>
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.15</version>
<version>2.3.7</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_3_15/apps</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/apps</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_15/apps</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/apps</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/apps</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_7/apps</url>
</scm>
<profiles>
+20 -12
View File
@@ -26,17 +26,17 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-portlet</artifactId>
<packaging>war</packaging>
<name>Portlet Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/apps/portlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/apps/portlet</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_15/apps/portlet</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/apps/portlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/apps/portlet</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_7/apps/portlet</url>
</scm>
<profiles>
@@ -118,8 +118,22 @@
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId>
<version>1.3</version>
<exclusions>
<exclusion>
<groupId>velocity</groupId>
<artifactId>velocity</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>struts</groupId>
<artifactId>struts</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
@@ -179,12 +193,6 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
@@ -6,7 +6,6 @@
<validator name="required" class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/>
<validator name="requiredstring" class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/>
<validator name="int" class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/>
<validator name="short" class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/>
<validator name="double" class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/>
<validator name="date" class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/>
<validator name="expression" class="com.opensymphony.xwork2.validator.validators.ExpressionValidator"/>
-47
View File
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="reports"/>
</body>
</project>
+8 -10
View File
@@ -26,12 +26,13 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-rest-showcase</artifactId>
<packaging>war</packaging>
<version>2.3.15</version>
<version>2.3.7</version>
<name>Struts 2 Rest Showcase Example</name>
<description>Struts 2 Rest Showcase Example</description>
@@ -39,14 +40,12 @@
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-rest-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-convention-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-config-browser-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -67,6 +66,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.jwebunit</groupId>
<artifactId>jwebunit-htmlunit-plugin</artifactId>
@@ -96,10 +96,8 @@
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<version>8.0.0.M2</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
@@ -121,7 +119,7 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<version>1.2.16</version>
</dependency>
</dependencies>
</plugin>
-47
View File
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="reports"/>
</body>
</project>
+36 -9
View File
@@ -26,19 +26,20 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-showcase</artifactId>
<packaging>war</packaging>
<name>Showcase Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/apps/showcase</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/apps/showcase</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_15/apps/showcase</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/apps/showcase</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/apps/showcase</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_7/apps/showcase</url>
</scm>
<profiles>
<profile>
<id>hostedqa</id>
@@ -55,41 +56,49 @@
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-struts1-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-dojo-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jsf-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-config-browser-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-tiles-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-dwr-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-json-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -101,11 +110,13 @@
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-convention-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -123,19 +134,37 @@
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId>
<exclusions>
<exclusion>
<groupId>velocity</groupId>
<artifactId>velocity</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>struts</groupId>
<artifactId>struts</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>sitemesh</artifactId>
<version>2.4.2</version>
</dependency>
<dependency>
<groupId>uk.ltd.getahead</groupId>
<artifactId>dwr</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
@@ -190,10 +219,8 @@
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<version>8.0.0.M2</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
@@ -215,7 +242,7 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<version>1.2.16</version>
</dependency>
</dependencies>
</plugin>
@@ -44,19 +44,19 @@ public class Skill implements IdEntity {
}
public String getName() {
return StringEscapeUtils.escapeEcmaScript(StringEscapeUtils.escapeHtml4(name));
return name;
}
public void setName(String name) {
this.name = name;
this.name = StringEscapeUtils.escapeEcmaScript(StringEscapeUtils.escapeHtml4(name));
}
public String getDescription() {
return StringEscapeUtils.escapeEcmaScript(StringEscapeUtils.escapeHtml4(description));
return description;
}
public void setDescription(String description) {
this.description = description;
this.description = StringEscapeUtils.escapeEcmaScript(StringEscapeUtils.escapeHtml4(description));
}
public Serializable getId() {
@@ -11,7 +11,7 @@
# Set root logger level to WARN and append to stdout
log4j.rootLogger=INFO, stdout
log4j.rootLogger=DEBUG, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
@@ -20,14 +20,17 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
# Print only messages of level ERROR or above in the package noModule.
log4j.logger.noModule=INFO
log4j.logger.noModule=FATAL
# OpenSymphony Stuff
log4j.logger.freemarker=INFO
log4j.logger.com.opensymphony=INFO
log4j.logger.com.opensymphony.xwork2.ognl=INFO
log4j.logger.org.apache.struts2=INFO
log4j.logger.com.opensymphony.xwork2.ognl=ERROR
log4j.logger.org.apache.struts2=WARN
log4j.logger.org.apache.struts2.components=WARN
log4j.logger.org.apache.struts2.dispatcher=WARN
log4j.logger.org.apache.struts2.convention=INFO
# Spring Stuff
log4j.logger.org.springframework=INFO
log4j.logger.org.springframework=WARN
@@ -58,7 +58,7 @@
</field>
<field name="regexValidatorField">
<field-validator type="regex">
<param name="regex">.*\.txt</param>
<param name="expression">.*\.txt</param>
<message><![CDATA[ regexValidatorField must match a regexp (.*\.txt) if specified ]]></message>
</field-validator>
</field>
@@ -52,7 +52,7 @@
</field>
<field name="regexValidatorField">
<field-validator type="regex">
<param name="regex"><![CDATA[ [^<>]+ ]]></param>
<param name="expression">.*\.txt</param>
<message><![CDATA[ regexValidatorField must match a regexp (.*\.txt) if specified ]]></message>
</field-validator>
</field>
-47
View File
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="reports"/>
</body>
</project>
-48
View File
@@ -1,48 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="modules"/>
<menu ref="reports"/>
</body>
</project>
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.15</version>
<version>2.3.7</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_3_15/archetypes</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes</url>
</scm>
<modules>
-48
View File
@@ -1,48 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="modules"/>
<menu ref="reports"/>
</body>
</project>
+5 -5
View File
@@ -3,19 +3,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-blank</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
<packaging>jar</packaging>
<name>Struts 2 Archetypes - Blank</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes/struts2-archetype-blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes/struts2-archetype-blank</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes/struts2-archetype-blank</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-blank</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-blank</url>
</scm>
<properties>
@@ -1,68 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor name="struts2-archetype-blank">
<fileSets>
<fileSet filtered="true" packaged="true">
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSets>
<fileSet filtered="true" packaged="true">
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="true">
<directory>src/test/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="true">
<directory>src/main/resources</directory>
<includes>
<include>**/*package*.properties</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="true">
<directory>src/main/resources</directory>
<includes>
<include>**/*-validation.xml</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="false">
<directory>src/main/resources</directory>
<includes>
<include>**/struts.xml</include>
<include>**/example.xml</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="true">
<directory>src/test/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="true">
<directory>src/main/resources</directory>
<includes>
<include>**/*package*.properties</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/resources</directory>
<includes>
<include>log4j.properties</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="true">
<directory>src/main/resources</directory>
<includes>
<include>**/*-validation.xml</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="false">
<directory>src/main/resources</directory>
<includes>
<include>**/struts.xml</include>
<include>**/example.xml</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/webapp/example</directory>
<includes>
<include>**/*.jsp</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/webapp</directory>
<includes>
<include>**/index.html</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/webapp/WEB-INF</directory>
<includes>
<include>**/web.xml</include>
</includes>
</fileSet>
</fileSets>
<fileSet filtered="false" packaged="false">
<directory>src/main/webapp/example</directory>
<includes>
<include>**/*.jsp</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/webapp</directory>
<includes>
<include>**/index.html</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/webapp/WEB-INF</directory>
<includes>
<include>**/web.xml</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>
@@ -36,13 +36,7 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<version>1.1.1</version>
</dependency>
<dependency>
@@ -72,35 +66,17 @@
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.21</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
<value>file:\${basedir}/src/main/resources/log4j.properties</value>
</systemProperty>
<systemProperty>
<name>slf4j</name>
<value>false</value>
</systemProperty>
</systemProperties>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>\${basedir}/src/main/webapp/</webAppSourceDirectory>
<webAppConfig>
<contextPath>\${artifactId}</contextPath>
<descriptor>\${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webAppConfig>
<scanTargets>
<scanTarget>src/main/webapp/WEB-INF</scanTarget>
<scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget>
<scanTarget>src/main/resources/struts.xml</scanTarget>
<scanTarget>src/main/resources/example.xml</scanTarget>
</scanTargets>
</configuration>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
@@ -1,30 +1,27 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<!--
- This file is included by the struts.xml file as an example
- of how to break up the configuration file into multiple files.
-->
<struts>
<package name="example" namespace="/example" extends="struts-default">
<package name="example" namespace="/example" extends="struts-default">
<action name="HelloWorld" class="${package}.example.HelloWorld">
<result>/example/HelloWorld.jsp</result>
</action>
<default-action-ref name="HelloWorld" />
<action name="Login_*" method="{1}" class="${package}.example.Login">
<result name="input">/example/Login.jsp</result>
<result type="redirectAction">Menu</result>
</action>
<action name="HelloWorld" class="${package}.example.HelloWorld">
<result>/example/HelloWorld.jsp</result>
</action>
<action name="Login_*" method="{1}" class="${package}.example.Login">
<result name="input">/example/Login.jsp</result>
<result type="redirectAction">Menu</result>
</action>
<action name="*" class="${package}.example.ExampleSupport">
<result>/example/{1}.jsp</result>
</action>
<!-- Add additional "example" package actions here. -->
</package>
<action name="*" class="${package}.example.ExampleSupport">
<result>/example/{1}.jsp</result>
</action>
<!-- Add additional "example" package actions here. -->
</package>
</struts>
@@ -1,29 +0,0 @@
#
# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
#
# The five logging levels used by Log are (in order):
#
# 1. DEBUG (the least serious)
# 2. INFO
# 3. WARN
# 4. ERROR
# 5. FATAL (the most serious)
# Set root logger level to WARN and append to stdout
log4j.rootLogger=WARN, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
# Print only messages of level ERROR or above in the package noModule.
log4j.logger.noModule=ERROR
# OpenSymphony Stuff
log4j.logger.com.opensymphony=INFO
# Struts2 Stuff
log4j.logger.org.apache.struts2=INFO
@@ -1,25 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false"/>
<constant name="struts.devMode" value="true"/>
<include file="example.xml"/>
<package name="default" namespace="/" extends="struts-default">
<default-action-ref name="index"/>
<action name="index">
<result type="redirectAction">
<param name="actionName">HelloWorld</param>
<param name="namespace">/example</param>
</result>
</action>
</package>
<!-- Add addition packages and configuration here. -->
<constant name="struts.enable.DynamicMethodInvocation" value="false"/>
<constant name="struts.devMode" value="true"/>
<include file="example.xml"/>
<!-- Add addition packages and configuration here. -->
</struts>
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="reports"/>
</body>
</project>
@@ -2,19 +2,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-convention</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
<packaging>jar</packaging>
<name>Struts 2 Archetypes - Blank Convention</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes/struts2-archetype-convention</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes/struts2-archetype-convention</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes/struts2-archetype-convention</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-convention</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-convention</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-convention</url>
</scm>
<properties>
@@ -23,13 +23,6 @@
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/resources</directory>
<includes>
<include>log4j.properties</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/resources</directory>
<includes>
@@ -42,13 +42,7 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<version>1.1</version>
</dependency>
<dependency>
@@ -86,35 +80,16 @@
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.21</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
<value>file:\${basedir}/src/main/resources/log4j.properties</value>
</systemProperty>
<systemProperty>
<name>slf4j</name>
<value>false</value>
</systemProperty>
</systemProperties>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>\${basedir}/src/main/webapp/</webAppSourceDirectory>
<webAppConfig>
<contextPath>\${artifactId}</contextPath>
<descriptor>\${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webAppConfig>
<scanTargets>
<scanTarget>src/main/webapp/WEB-INF</scanTarget>
<scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget>
<scanTarget>src/main/resources/struts.xml</scanTarget>
</scanTargets>
</configuration>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
@@ -1,29 +0,0 @@
#
# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
#
# The five logging levels used by Log are (in order):
#
# 1. DEBUG (the least serious)
# 2. INFO
# 3. WARN
# 4. ERROR
# 5. FATAL (the most serious)
# Set root logger level to WARN and append to stdout
log4j.rootLogger=WARN, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
# Print only messages of level ERROR or above in the package noModule.
log4j.logger.noModule=ERROR
# OpenSymphony Stuff
log4j.logger.com.opensymphony=INFO
# Struts2 Stuff
log4j.logger.org.apache.struts2=INFO
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="reports"/>
</body>
</project>
@@ -2,19 +2,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-dbportlet</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
<packaging>jar</packaging>
<name>Struts 2 Archetypes - Database Portlet</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes/struts2-archetype-dbportlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes/struts2-archetype-dbportlet</developerConnection>
<url>svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes/struts2-archetype-dbportlet</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-dbportlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-dbportlet</developerConnection>
<url>svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-dbportlet</url>
</scm>
<properties>
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="reports"/>
</body>
</project>
+5 -5
View File
@@ -2,19 +2,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-plugin</artifactId>
<version>2.3.15</version>
<version>2.3.7</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_3_15/archetypes/struts2-archetype-plugin</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes/struts2-archetype-plugin</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes/struts2-archetype-plugin</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-plugin</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-plugin</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-plugin</url>
</scm>
<properties>
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="reports"/>
</body>
</project>
+29 -25
View File
@@ -1,38 +1,42 @@
INFORMATION
===========
- This is Struts 2's "Portlet" Maven Archetype
- To be used to create a simple portlet that can be deployed as JSR286 portlet.
- There is a maven profile in order to test this portlet on Pluto Portal.
- To be used to create a simple portlet that can be deployed as a webapp or JSR168 portlet.
USAGE
=====
1- Generate your archetype
- mvn archetype:generate -DartifactId=struts2-portlet-helloworld -DgroupId=com.mycompany.struts2.portlet -Dversion=1.0.0-SNAPSHOT -DarchetypeGroupId=org.apache.struts -DarchetypeArtifactId=struts2-archetype-portlet -DarchetypeVersion=2.3.8
- change directory to where the portlet template is to be created,
for example, a 'projects' directory (which you may need to create):
cd /home/tmjee/projects
- run the following command to generate the sample portlet template, assuming :-
- root java package -> com.myCompany.myPortlet
2- Build your portlet project for Pluto Portal
- cd struts2-portlet-helloworld
- mvn clean package -Ppluto-embedded
3- Download and install Pluto Portal
- cd ..
- curl -v -H "Accept-Encoding: gzip" "http://apache.opensourcemirror.com/portals/pluto/pluto-2.0.3-bundle.zip" > pluto-2.0.3.zip
- unzip pluto-2.0.3.zip -d .
4- Deploy your portlet app
- cp struts2-portlet-helloworld/target/struts2-portlet-helloworld-1.0.0-SNAPSHOT.war pluto-2.0.3/webapps
5- Start Pluto Portal and create a page for your portlet
- ./pluto-2.0.3/bin/startup.sh
- Go to http://localhost:8080/pluto/portal (login: pluto / pwd: pluto)
- Click on "Pluto Admin" (http://localhost:8080/pluto/portal/Pluto%20Admin)
- On "Portal Pages" section : Add page "Struts2"
- On "Portlet Applications" section : select "/struts2-portlet-helloworld" and "HelloPortlet" then click "Add Portlet"
6- Test your portlet app
- Go to your Struts2 page http://localhost:8080/pluto/portal/Struts2 and play with your portlet !!
- the portlet war name -> myWebApp
mvn archetype:create -DgroupId=com.myCompany.myPortlet \
-DartifactId=myWebApp \
-DarchetypeGroupId=org.apache.struts \
-DarchetypeArtifactId=struts2-archetype-portlet \
-DarchetypeVersion=2.0.9-SNAPSHOT \
-DremoteRepositories=http://people.apache.org/maven-snapshot-repository
- to compile, execute
mvn compile
- to run test cases execute
mvn test
- to clean execute
mvn clean
- to package execute
mvn package
- to start it with jetty execute as a servlet
mvn jetty:run
+12 -5
View File
@@ -2,19 +2,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-portlet</artifactId>
<version>2.3.15</version>
<version>2.3.7</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_3_15/archetypes/struts2-archetype-portlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes/struts2-archetype-portlet</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes/struts2-archetype-portlet</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-portlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-portlet</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-portlet</url>
</scm>
<properties>
@@ -25,6 +25,13 @@
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.*</include>
</includes>
</resource>
<resource>
<directory>src/main/resources/archetype-resources/src</directory>
<filtering>false</filtering>
<includes>
<include>**/*.*</include>
@@ -16,7 +16,7 @@
</includes>
</fileSet>
<fileSet filtered="true" packaged="false">
<fileSet filtered="false" packaged="false">
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
@@ -3,20 +3,14 @@
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
<groupId>\${groupId}</groupId>
<artifactId>\${artifactId}</artifactId>
<version>\${version}</version>
<packaging>war</packaging>
<name>${artifactId}</name>
<name>\${artifactId}</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<struts2.version>${project.version}</struts2.version>
<portlet.api.version>2.0</portlet.api.version>
<!-- plugins -->
<plugin.compiler.version>3.0</plugin.compiler.version>
<plugin.war.version>2.3</plugin.war.version>
<plugin.pluto.version>2.0.3</plugin.pluto.version>
</properties>
<dependencies>
@@ -25,67 +19,114 @@
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${struts2.version}</version>
<version>\${struts2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-portlet-plugin</artifactId>
<version>${struts2.version}</version>
<version>\${struts2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-config-browser-plugin</artifactId>
<version>\${struts2.version}</version>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>${portlet.api.version}</version>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.bekk.boss</groupId>
<artifactId>maven-jetty-pluto-embedded</artifactId>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>6.1.21</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-2.1</artifactId>
<version>6.1.14</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${plugin.compiler.version}</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>pluto-embedded</id>
<build>
<plugins>
<!-- configure maven-war-plugin to use updated web.xml -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${plugin.war.version}</version>
<configuration>
<webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
</configuration>
</plugin>
<!-- bind 'pluto2:assemble' goal to 'generate-resources' lifecycle -->
<plugin>
<groupId>org.apache.portals.pluto</groupId>
<artifactId>maven-pluto-plugin</artifactId>
<version>${plugin.pluto.version}</version>
<executions>
<execution>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<profiles>
<profile>
<id>pluto-embedded</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.pluto</groupId>
<artifactId>maven-pluto-plugin</artifactId>
<version>1.1.6</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.21</version>
<configuration>
<webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
<webAppConfig>
<contextPath>/${project.artifactId}</contextPath>
<defaultsDescriptor>/WEB-INF/jetty-pluto-web-default.xml</defaultsDescriptor>
</webAppConfig>
<systemProperties>
<systemProperty>
<name>org.apache.pluto.embedded.portletIds</name>
<value>HelloPortlet</value>
</systemProperty>
</systemProperties>
<scanIntervalSeconds>10</scanIntervalSeconds>
<scanTargets>
<scanTarget>src/main/webapp/WEB-INF</scanTarget>
<scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget>
<scanTarget>src/main/resources/struts.xml</scanTarget>
</scanTargets>
</configuration>
<dependencies>
<dependency>
<groupId>com.bekk.boss</groupId>
<artifactId>maven-jetty-pluto-embedded</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
@@ -1,10 +1,12 @@
package ${package};
package ${packageName};
import javax.portlet.PortletPreferences;
import org.apache.struts2.dispatcher.DefaultActionSupport;
import org.apache.struts2.portlet.interceptor.PortletPreferencesAware;
import com.opensymphony.xwork2.Preparable;
public class HelloAction extends DefaultActionSupport implements PortletPreferencesAware {
private static final long serialVersionUID = 1L;
@@ -1,4 +1,4 @@
package ${package};
package ${packageName};
import javax.portlet.PortletPreferences;
@@ -5,14 +5,14 @@
<struts>
<package name="default" extends="struts-portlet-default" namespace="/view">
<action name="index" class="${package}.HelloAction">
<action name="index" class="${packageName}.HelloAction">
<result>/WEB-INF/jsp/view/index.jsp</result>
</action>
</package>
<package name="edit" extends="struts-portlet-default" namespace="/edit">
<action name="index" class="${package}.UpdateNameAction">
<action name="index" class="${packageName}.UpdateNameAction">
<result type="redirectAction">
<param name="actionName">index</param>
<param name="portletMode">view</param>
@@ -1,23 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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"
id="\${artifactId}">
<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="${artifactId}">
<portlet id="HelloPortlet">
<description xml:lang="EN">Simple hello world portlet</description>
<portlet-name>HelloPortlet</portlet-name>
<display-name xml:lang="EN">\${artifactId}</display-name>
<display-name xml:lang="EN">${artifactId}</display-name>
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr286Dispatcher</portlet-class>
<init-param>
<name>actionPackages</name>
<value>${package}</value>
</init-param>
<!-- The namespace for the actions configured for view mode -->
<init-param>
<name>viewNamespace</name>
@@ -1,21 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="\${artifactId}">
<display-name>Struts2 Hello World Portlet</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<web-app id="${artifactId}">
<!-- Empty -->
</web-app>
@@ -0,0 +1,21 @@
package ${packageName};
import org.apache.pluto.core.PortletServlet;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.ServletHolder;
import org.mortbay.jetty.webapp.WebAppContext;
public class JettyPlutoLauncher {
public static void main(String[] args) throws Exception {
System.setProperty("org.apache.pluto.embedded.portletIds", "HelloPortlet");
Server server = new Server(8080);
WebAppContext webapp = new WebAppContext("src/main/webapp", "/${artifactId}");
webapp.setDefaultsDescriptor("/WEB-INF/jetty-pluto-web-default.xml");
ServletHolder portletServlet = new ServletHolder(new PortletServlet());
portletServlet.setInitParameter("portlet-name", "HelloPortlet");
portletServlet.setInitOrder(1);
webapp.addServlet(portletServlet, "/PlutoInvoker/HelloPortlet");
server.addHandler(webapp);
server.start();
}
}
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="reports"/>
</body>
</project>
+5 -5
View File
@@ -4,19 +4,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-starter</artifactId>
<version>2.3.15</version>
<version>2.3.7</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_3_15/archetypes/struts2-archetype-starter</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes/struts2-archetype-starter</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/archetypes/struts2-archetype-starter</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-starter</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-starter</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/archetypes/struts2-archetype-starter</url>
</scm>
<properties>
@@ -66,21 +66,9 @@
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3</version>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- Dwr -->
<dependency>
<groupId>uk.ltd.getahead</groupId>
@@ -100,37 +88,19 @@
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.21</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
<value>file:\${basedir}/src/main/resources/log4j.properties</value>
</systemProperty>
<systemProperty>
<name>slf4j</name>
<value>false</value>
</systemProperty>
</systemProperties>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>\${basedir}/src/main/webapp/</webAppSourceDirectory>
<webAppConfig>
<contextPath>\${artifactId}</contextPath>
<descriptor>\${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webAppConfig>
<scanTargets>
<scanTarget>src/main/webapp/WEB-INF</scanTarget>
<scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget>
<scanTarget>src/main/resources/struts.xml</scanTarget>
<scanTarget>src/main/resources/applicationContext.xml</scanTarget>
</scanTargets>
</configuration>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</plugin>
</plugin>
</plugins>
</build>
</project>
@@ -1,25 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false"/>
<package name="myPackage" extends="struts-default">
<default-action-ref name="index" />
<action name="index" class="${package}.IndexAction">
<result>/jsp/index.jsp</result>
</action>
<action name="helloWorld" class="helloWorldAction">
<result name="input">/jsp/index.jsp</result>
<result>/jsp/helloWorld.jsp</result>
</action>
</package>
<package name="myPackage" extends="struts-default">
<action name="index" class="${package}.IndexAction">
<result>/jsp/index.jsp</result>
</action>
<action name="helloWorld" class="helloWorldAction">
<result name="input">/jsp/index.jsp</result>
<result>/jsp/helloWorld.jsp</result>
</action>
</package>
</struts>
@@ -14,20 +14,20 @@
<!-- Filters -->
<filter>
<filter-name>struts2-prepare</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
<filter-name>action2-cleanup</filter-name>
<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
</filter>
<filter>
<filter-name>struts2-execute</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
<filter-name>action2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2-prepare</filter-name>
<filter-name>action2-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
@@ -35,7 +35,7 @@
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2-execute</filter-name>
<filter-name>action2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="reports"/>
</body>
</project>
+222 -22
View File
@@ -1,31 +1,207 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.15</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-assembly</artifactId>
<packaging>pom</packaging>
<name>Struts 2 Assembly</name>
<description>
Struts 2 Assembly
</description>
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.7</version>
</parent>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/assembly</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/assembly</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_15/assembly</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/assembly</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/assembly</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_7/assembly</url>
</scm>
<profiles>
<profile>
<id>j4</id>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>src/main/assembly/all.xml</descriptor>
<descriptor>src/main/assembly/lib.xml</descriptor>
<descriptor>src/main/assembly/lib-jdk14.xml</descriptor>
<descriptor>src/main/assembly/apps.xml</descriptor>
<descriptor>src/main/assembly/src.xml</descriptor>
<descriptor>src/main/assembly/docs.xml</descriptor>
</descriptors>
<finalName>struts-${project.version}</finalName>
<outputDirectory>target/assembly/out</outputDirectory>
<workDirectory>target/assembly/work</workDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Backported JDK 1.4 jars -->
<dependency>
<groupId>net.sf.retrotranslator</groupId>
<artifactId>retrotranslator-runtime</artifactId>
<version>1.2.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>backport-util-concurrent</groupId>
<artifactId>backport-util-concurrent</artifactId>
<version>3.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.struts.xwork</groupId>
<artifactId>xwork-core</artifactId>
<version>${project.version}</version>
<type>jar</type>
<classifier>jdk14</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-config-browser-plugin</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jasperreports-plugin</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jfreechart-plugin</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jsf-plugin</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-pell-multipart-plugin</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plexus-plugin</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitegraph-plugin</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh-plugin</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-struts1-plugin</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-tiles-plugin</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-rest-plugin</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-oval-plugin</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-plugin</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-json-plugin</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-embeddedjsp-plugin</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-gxp-plugin</artifactId>
<version>${project.version}</version>
<classifier>jdk14</classifier>
</dependency>
</dependencies>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<configuration>
<generateReports>false</generateReports>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dependency-maven-plugin</artifactId>
@@ -115,6 +291,7 @@
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>make-assembly</id>
@@ -145,142 +322,165 @@
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-codebehind-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-convention-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-javatemplates-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-config-browser-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-dojo-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-dwr-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jasperreports-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jfreechart-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jsf-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-junit-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-pell-multipart-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plexus-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-portlet-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-rest-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitegraph-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-struts1-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-testng-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-tiles-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-tiles3-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-oval-plugin</artifactId>
<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.struts</groupId>
<artifactId>struts2-embeddedjsp-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-gxp-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-admin-bundle</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-demo-bundle</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
+3 -1
View File
@@ -31,8 +31,10 @@
<outputDirectory>lib</outputDirectory>
<scope>runtime</scope>
<excludes>
<exclude>net.sf.retrotranslator:retrotranslator-runtime</exclude>
<exclude>backport-util-concurrent:backport-util-concurrent</exclude>
<exclude>junit:junit</exclude>
<exclude>org.testng:testng</exclude>
<exclude>*:jdk14</exclude>
</excludes>
</dependencySet>
</dependencySets>
+58
View File
@@ -0,0 +1,58 @@
<!--
/*
* $Id$
*
* 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.
*/
-->
<assembly>
<id>lib-jdk14</id>
<formats>
<format>zip</format>
</formats>
<dependencySets>
<dependencySet useTransitiveFiltering="true">
<outputDirectory>jdk14</outputDirectory>
<outputFileNameMapping>${artifactId}-${version}.${extension}</outputFileNameMapping>
<includes>
<include>net.sf.retrotranslator:retrotranslator-runtime</include>
<include>backport-util-concurrent:backport-util-concurrent</include>
</includes>
</dependencySet>
<dependencySet>
<useTransitiveFiltering>true</useTransitiveFiltering>
<outputDirectory>jdk14</outputDirectory>
<outputFileNameMapping>${artifactId}-${version}-jdk14.${extension}</outputFileNameMapping>
<includes>
<include>org.apache.struts:*:jar:jdk14</include>
<include>com.opensymphony:xwork:jar:jdk14</include>
</includes>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>src/main/resources/backport</directory>
<outputDirectory></outputDirectory>
<includes>
<include>*LICENSE*</include>
<include>NOTICE*</include>
</includes>
</fileSet>
</fileSets>
</assembly>
+3 -1
View File
@@ -31,8 +31,10 @@
<outputDirectory>lib</outputDirectory>
<scope>runtime</scope>
<excludes>
<exclude>net.sf.retrotranslator:retrotranslator-runtime</exclude>
<exclude>backport-util-concurrent:backport-util-concurrent</exclude>
<exclude>junit:junit</exclude>
<exclude>org.testng:testng</exclude>
<exclude>*:jdk14</exclude>
</excludes>
</dependencySet>
</dependencySets>
+9 -7
View File
@@ -4,24 +4,25 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-bundles</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
</parent>
<artifactId>struts2-osgi-admin-bundle</artifactId>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-admin-bundle</artifactId>
<packaging>bundle</packaging>
<name>Struts 2 OSGi Admin Bundle</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/bundles/admin</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/bundles/admin</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_15/bundles/admin</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/bundles/admin</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/bundles/admin</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_7/bundles/admin</url>
</scm>
<dependencies>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-plugin</artifactId>
</dependency>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
@@ -30,6 +31,7 @@
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<version>2.1.0</version>
<configuration>
<instructions>
<manifestLocation>META-INF</manifestLocation>
@@ -26,8 +26,9 @@ import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.entities.PackageConfig;
import com.opensymphony.xwork2.inject.Inject;
import org.apache.struts2.osgi.BundleAccessor;
import org.apache.struts2.osgi.host.OsgiHost;
import org.apache.struts2.osgi.OsgiHost;
import org.apache.struts2.osgi.StrutsOsgiListener;
import org.apache.struts2.osgi.OsgiConfigurationProvider;
import org.apache.struts2.util.ServletContextAware;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -39,6 +40,10 @@ import java.util.Collection;
import java.util.List;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.HashMap;
import java.util.Enumeration;
import java.util.Dictionary;
public class BundlesAction extends ActionSupport implements ServletContextAware {
-47
View File
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="reports"/>
</body>
</project>
+19 -5
View File
@@ -4,17 +4,17 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-bundles</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-demo-bundle</artifactId>
<packaging>bundle</packaging>
<name>Struts 2 OSGi Demo Bundle</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/bundles/demo</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/bundles/demo</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_15/bundles/demo</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/bundles/demo</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/bundles/demo</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_7/bundles/demo</url>
</scm>
<dependencies>
@@ -28,6 +28,12 @@
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>velocity</groupId>
<artifactId>velocity</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
@@ -35,14 +41,22 @@
<artifactId>commons-digester</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-convention-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-plugin</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
-47
View File
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="reports"/>
</body>
</project>
+6 -5
View File
@@ -26,17 +26,17 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-bundles</artifactId>
<packaging>pom</packaging>
<name>Struts OSGi Bundles</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/bundles</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/bundles</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/bundles</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/bundles</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/bundles</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/bundles</url>
</scm>
<modules>
@@ -49,6 +49,7 @@
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Test dependencies -->
-48
View File
@@ -1,48 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* $Id: site.xml 1082279 2011-03-16 19:43:51Z lukaszlenart $
*
* 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.
*/
-->
<project name="Struts 2">
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/images/struts.gif</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<body>
<links>
<item name="Apache"
href="http://www.apache.org/"/>
<item name="Struts"
href="http://struts.apache.org/index.html"/>
</links>
<menu ref="parent"/>
<menu ref="modules"/>
<menu ref="reports"/>
</body>
</project>
+7 -4
View File
@@ -26,16 +26,17 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.15</version>
<version>2.3.7</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<packaging>jar</packaging>
<name>Struts 2 Core</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/core</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15/core</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_15/core</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/core</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_7/core</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_7/core</url>
</scm>
<properties>
@@ -86,6 +87,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rat-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<configuration>
<includes>
<include>pom.xml</include>
@@ -110,6 +112,7 @@
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>attach-source</id>
@@ -125,6 +125,11 @@ public final class StrutsConstants {
/** The directory to use for storing uploaded files */
public static final String STRUTS_MULTIPART_SAVEDIR = "struts.multipart.saveDir";
/**
* The name of the bean that will handle multipart requests
*/
public static final String STRUTS_MULTIPART_HANDLER = "struts.multipart.handler";
/**
* The org.apache.struts2.dispatcher.multipart.MultiPartRequest parser implementation
* for a multipart request (file upload)
@@ -228,12 +233,6 @@ public final class StrutsConstants {
/** Enables caching of parsed OGNL expressions **/
public static final String STRUTS_ENABLE_OGNL_EXPRESSION_CACHE = "struts.ognl.enableExpressionCache";
/** Enables evaluation of OGNL expressions **/
public static final String STRUTS_ENABLE_OGNL_EVAL_EXPRESSION = "struts.ognl.enableOGNLEvalExpression";
/** Disables {@link org.apache.struts2.dispatcher.StrutsRequestWrapper} request attribute value stack lookup (JSTL accessibility) **/
public static final String STRUTS_DISABLE_REQUEST_ATTRIBUTE_VALUE_STACK_LOOKUP = "struts.disableRequestAttributeValueStackLookup";
/** The{@link org.apache.struts2.views.util.UrlHelper} implementation class **/
public static final String STRUTS_URL_HELPER = "struts.view.urlHelper";
@@ -247,15 +246,4 @@ public final class StrutsConstants {
/** Enable handling exceptions by Dispatcher - true by default **/
public static final String STRUTS_HANDLE_EXCEPTION = "struts.handle.exception";
public static final String STRUTS_CONVERTER_PROPERTIES_PROCESSOR = "struts.converter.properties.processor";
public static final String STRUTS_CONVERTER_FILE_PROCESSOR = "struts.converter.file.processor";
public static final String STRUTS_CONVERTER_ANNOTATION_PROCESSOR = "struts.converter.annotation.processor";
public static final String STRUTS_CONVERTER_CREATOR = "struts.converter.creator";
public static final String STRUTS_CONVERTER_HOLDER = "struts..converter.holder";
public static final String STRUTS_EXPRESSION_PARSER = "struts.expression.parser";
/** actions names' whitelist **/
public static final String STRUTS_ALLOWED_ACTION_NAMES = "struts.allowed.action.names";
}
@@ -21,14 +21,16 @@
package org.apache.struts2.components;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import java.io.Writer;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.Writer;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
/**
* ClosingUIBean is the standard superclass for UI components such as div etc.
@@ -57,6 +59,7 @@ public abstract class ClosingUIBean extends UIBean {
mergeTemplate(writer, buildTemplateName(openTemplate, getDefaultOpenTemplate()));
} catch (Exception e) {
LOG.error("Could not open template", e);
e.printStackTrace();
}
return result;
@@ -53,7 +53,7 @@ public class Component {
public static final String COMPONENT_STACK = "__component_stack";
protected ValueStack stack;
protected Map<String, Object> parameters;
protected Map parameters;
protected ActionMapper actionMapper;
protected boolean throwExceptionOnELFailure;
private UrlHelper urlHelper;
@@ -65,7 +65,7 @@ public class Component {
*/
public Component(ValueStack stack) {
this.stack = stack;
this.parameters = new LinkedHashMap<String, Object>();
this.parameters = new LinkedHashMap();
getComponentStack().push(this);
}
@@ -107,10 +107,10 @@ public class Component {
* Gets the component stack of this component.
* @return the component stack of this component, never <tt>null</tt>.
*/
public Stack<Component> getComponentStack() {
Stack<Component> componentStack = (Stack<Component>) stack.getContext().get(COMPONENT_STACK);
public Stack getComponentStack() {
Stack componentStack = (Stack) stack.getContext().get(COMPONENT_STACK);
if (componentStack == null) {
componentStack = new Stack<Component>();
componentStack = new Stack();
stack.getContext().put(COMPONENT_STACK, componentStack);
}
return componentStack;
@@ -449,7 +449,7 @@ public class Component {
* Gets the parameters.
* @return the parameters. Is never <tt>null</tt>.
*/
public Map<String, Object> getParameters() {
public Map getParameters() {
return parameters;
}
@@ -457,7 +457,7 @@ public class Component {
* Adds all the given parameters to this component's own parameters.
* @param params the parameters to add.
*/
public void addAllParameters(Map<String, Object> params) {
public void addAllParameters(Map params) {
parameters.putAll(params);
}
@@ -472,7 +472,7 @@ public class Component {
*/
public void addParameter(String key, Object value) {
if (key != null) {
Map<String, Object> params = getParameters();
Map params = getParameters();
if (value == null) {
params.remove(key);
@@ -275,19 +275,21 @@ public class Date extends ContextBean {
}
public boolean end(Writer writer, String body) {
String msg;
String msg = null;
java.util.Date date = null;
// find the name on the valueStack
try {
//suport Calendar also
Object dateObject = findValue(name);
if (dateObject instanceof java.util.Date) {
if (dateObject instanceof java.util.Date)
date = (java.util.Date) dateObject;
} else if(dateObject instanceof Calendar){
else if(dateObject instanceof Calendar)
date = ((Calendar) dateObject).getTime();
}
} catch (Exception e) {
LOG.error("Could not convert object with key '#0' to a java.util.Date instance", name);
LOG.error("Could not convert object with key '" + name
+ "' to a java.util.Date instance");
// bad date, return a blank instead ?
msg = "";
}
//try to find the format on the stack
@@ -31,22 +31,16 @@ import com.opensymphony.xwork2.interceptor.MethodFilterInterceptorUtil;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.validator.ActionValidatorManager;
import com.opensymphony.xwork2.validator.FieldValidator;
import com.opensymphony.xwork2.validator.ValidationException;
import com.opensymphony.xwork2.validator.ValidationInterceptor;
import com.opensymphony.xwork2.validator.Validator;
import com.opensymphony.xwork2.validator.ValidatorContext;
import com.opensymphony.xwork2.validator.validators.VisitorFieldValidator;
import org.apache.commons.lang3.StringUtils;
import org.apache.struts2.dispatcher.mapper.ActionMapping;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.*;
import java.util.Set;
/**
@@ -122,17 +116,14 @@ public class Form extends ClosingUIBean {
super(stack, request, response);
}
@Override
protected boolean evaluateNameValue() {
return false;
}
@Override
public String getDefaultOpenTemplate() {
return OPEN_TEMPLATE;
}
@Override
protected String getDefaultTemplate() {
return TEMPLATE;
}
@@ -162,7 +153,6 @@ public class Form extends ClosingUIBean {
* Revised for Portlet actionURL as form action, and add wwAction as hidden
* field. Refer to template.simple/form.vm
*/
@Override
protected void evaluateExtraParams() {
super.evaluateExtraParams();
if (validate != null) {
@@ -220,7 +210,6 @@ public class Form extends ClosingUIBean {
* <li>if an 'action' attribute is specified, it will be used as the id.</li>
* </ol>
*/
@Override
protected void populateComponentHtmlId(Form form) {
if (id != null) {
addParameter("id", escape(id));
@@ -273,144 +262,20 @@ public class Form extends ClosingUIBean {
return Collections.EMPTY_LIST;
}
String formActionValue = findString(action);
ActionMapping mapping = actionMapper.getMappingFromActionName(formActionValue);
String actionName = mapping.getName();
String methodName = mapping.getMethod();
List<Validator> actionValidators = actionValidatorManager.getValidators(actionClass, actionName, methodName);
List<Validator> all = actionValidatorManager.getValidators(actionClass, (String) getParameters().get("actionName"));
List<Validator> validators = new ArrayList<Validator>();
findFieldValidators(name, actionClass, actionName, actionValidators, validators, "");
return validators;
}
private void findFieldValidators(String name, Class actionClass, String actionName,
List<Validator> validatorList, List<Validator> retultValidators, String prefix) {
for (Validator validator : validatorList) {
for (Validator validator : all) {
if (validator instanceof FieldValidator) {
FieldValidator fieldValidator = (FieldValidator) validator;
if (validator instanceof VisitorFieldValidator) {
VisitorFieldValidator vfValidator = (VisitorFieldValidator) fieldValidator;
Class clazz = getVisitorReturnType(actionClass, vfValidator.getFieldName());
if (clazz == null) {
continue;
}
List<Validator> visitorValidators = actionValidatorManager.getValidators(clazz, actionName);
String vPrefix = prefix + (vfValidator.isAppendPrefix() ? vfValidator.getFieldName() + "." : "");
findFieldValidators(name, clazz, actionName, visitorValidators, retultValidators, vPrefix);
} else if ((prefix + fieldValidator.getFieldName()).equals(name)) {
if (StringUtils.isNotBlank(prefix)) {
//fixing field name for js side
FieldVisitorValidatorWrapper wrap = new FieldVisitorValidatorWrapper(fieldValidator, prefix);
retultValidators.add(wrap);
} else {
retultValidators.add(fieldValidator);
}
if (fieldValidator.getFieldName().equals(name)) {
validators.add(fieldValidator);
}
}
}
}
/**
* Wrap field validator, add visitor's field prefix to the field name.
* Javascript side is not aware of the visitor validators
* and does not know how to prefix the fields.
*/
/*
* Class is public because Freemarker has problems accessing properties.
*/
public static class FieldVisitorValidatorWrapper implements FieldValidator {
private FieldValidator fieldValidator;
private String namePrefix;
public FieldVisitorValidatorWrapper(FieldValidator fv, String namePrefix) {
this.fieldValidator = fv;
this.namePrefix = namePrefix;
}
public String getValidatorType() {
return "field-visitor";
}
public String getFieldName() {
return namePrefix + fieldValidator.getFieldName();
}
public FieldValidator getFieldValidator() {
return fieldValidator;
}
public void setFieldValidator(FieldValidator fieldValidator) {
this.fieldValidator = fieldValidator;
}
public String getDefaultMessage() {
return fieldValidator.getDefaultMessage();
}
public String getMessage(Object object) {
return fieldValidator.getMessage(object);
}
public String getMessageKey() {
return fieldValidator.getMessageKey();
}
public String[] getMessageParameters() {
return fieldValidator.getMessageParameters();
}
public ValidatorContext getValidatorContext() {
return fieldValidator.getValidatorContext();
}
public void setDefaultMessage(String message) {
fieldValidator.setDefaultMessage(message);
}
public void setFieldName(String fieldName) {
fieldValidator.setFieldName(fieldName);
}
public void setMessageKey(String key) {
fieldValidator.setMessageKey(key);
}
public void setMessageParameters(String[] messageParameters) {
fieldValidator.setMessageParameters(messageParameters);
}
public void setValidatorContext(ValidatorContext validatorContext) {
fieldValidator.setValidatorContext(validatorContext);
}
public void setValidatorType(String type) {
fieldValidator.setValidatorType(type);
}
public void setValueStack(ValueStack stack) {
fieldValidator.setValueStack(stack);
}
public void validate(Object object) throws ValidationException {
fieldValidator.validate(object);
}
public String getNamePrefix() {
return namePrefix;
}
public void setNamePrefix(String namePrefix) {
this.namePrefix = namePrefix;
}
return validators;
}
/**
* Return type of visited object.
* @param actionClass
* @param visitorFieldName
* @return
*/
@SuppressWarnings("unchecked")
protected Class getVisitorReturnType(Class actionClass, String visitorFieldName) {
if (visitorFieldName == null) {
return null;
}
String methodName = "get" + org.apache.commons.lang.StringUtils.capitalize(visitorFieldName);
try {
Method method = actionClass.getMethod(methodName, new Class[0]);
return method.getReturnType();
} catch (NoSuchMethodException e) {
return null;
}
}
/**
* Get a incrementing sequence unique to this <code>Form</code> component.
* It is used by <code>Form</code> component's child that might need a
@@ -21,18 +21,19 @@
package org.apache.struts2.components;
import java.io.Writer;
import java.util.Iterator;
import java.util.List;
import java.util.Arrays;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import org.apache.struts2.util.MakeIterator;
import org.apache.struts2.views.jsp.IteratorStatus;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.util.MakeIterator;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import org.apache.struts2.views.jsp.IteratorStatus;
import java.io.Writer;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* <!-- START SNIPPET: javadoc -->
@@ -356,7 +357,7 @@ public class IteratorComponent extends ContextBean {
}
}
static class CounterIterator implements Iterator<Object> {
class CounterIterator implements Iterator<Object> {
private int step;
private int end;
private int currentIndex;
@@ -379,7 +380,7 @@ public class IteratorComponent extends ContextBean {
if (hasNext()) {
int nextIndex = peekNextIndex();
currentIndex += step;
return values != null ? values.get(nextIndex) : nextIndex;
return value != null ? values.get(nextIndex) : nextIndex;
} else {
throw new IndexOutOfBoundsException("Index " + ( currentIndex + step) + " must be less than or equal to " + end);
}
@@ -33,6 +33,7 @@ import org.apache.struts2.views.annotations.StrutsTagAttribute;
import java.io.IOException;
import java.io.Writer;
import java.math.RoundingMode;
import java.text.NumberFormat;
import java.util.Currency;
@@ -211,8 +212,6 @@ public class Number extends ContextBean {
}
private void setRoundingMode(NumberFormat format) {
/*
TODO lukaszlenart: enable when switched to Java 1.6
if (roundingMode != null) {
roundingMode = findString(roundingMode);
if ("ceiling".equals(roundingMode)) {
@@ -235,7 +234,6 @@ public class Number extends ContextBean {
LOG.error("Could not recognise a roundingMode of [" + roundingMode + "]");
}
}
*/
}
private NumberFormat getNumberFormat() {
@@ -398,7 +396,7 @@ public class Number extends ContextBean {
/**
* @param roundingMode the roundingMode to set
*/
@StrutsTagAttribute(description = "The rounding mode to use - not implemented yet as this required Java 1.6", type = "String")
@StrutsTagAttribute(description = "The rounding mode to use", type = "String")
public void setRoundingMode(String roundingMode) {
this.roundingMode = roundingMode;
}
@@ -35,7 +35,7 @@ import com.opensymphony.xwork2.util.ValueStack;
* useful in both cases: when the complex expression takes time (performance improvement) or is hard to read (code
* readability improvement).</p>
* <p>If the tag is used with body content, the evaluation of the value parameter is omitted. Instead, the String to
* which the body evaluates is set as value for the scoped variable.</p>
* which the body eveluates is set as value for the scoped variable.</p>
*
* The scopes available are as follows :-
* <ul>
@@ -72,11 +72,8 @@ import com.opensymphony.xwork2.util.ValueStack;
*
* <pre>
* <!-- START SNIPPET: example -->
* &lt;s:set var="personName" value="person.name"/&gt;
* Hello, &lt;s:property value="#personName"/&gt;
*
* &lt;s:set var="janesName"&gt;Jane Doe&lt;/s:set&gt;
* &lt;s:property value="#janesName"/&gt;
* &lt;s:set name="personName" value="person.name"/&gt;
* Hello, &lt;s:property value="#personName"/&gt;. How are you?
* <!-- END SNIPPET: example -->
* </pre>
*
@@ -43,15 +43,15 @@ import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
* UIBean is the standard superclass of all Struts UI components.
* UIBean is the standard superclass of all Struts UI componentns.
* It defines common Struts and html properties all UI components should present for usage.
*
* <!-- START SNIPPET: templateRelatedAttributes -->
@@ -152,16 +152,10 @@ import java.util.concurrent.ConcurrentMap;
* <td>define label position of form element (top/left), default to left</td>
* </tr>
* <tr>
* <td>requiredPosition</td>
* <td>requiredposition</td>
* <td>xhtml</td>
* <td>String</td>
* <td>define required label position of form element (left/right), default to right</td>
* </tr>
* <tr>
* <td>errorPosition</td>
* <td>xhtml</td>
* <td>String</td>
* <td>define error position of form element (top|bottom), default to top</td>
* </tr>
* <tr>
* <td>name</td>
@@ -459,10 +453,9 @@ public abstract class UIBean extends Component {
protected String label;
protected String labelPosition;
protected String labelSeparator;
protected String requiredPosition;
protected String errorPosition;
protected String requiredposition;
protected String name;
protected String requiredLabel;
protected String required;
protected String tabindex;
protected String value;
protected String title;
@@ -502,7 +495,7 @@ public abstract class UIBean extends Component {
protected TemplateEngineManager templateEngineManager;
// dynamic attributes support for tags used with FreeMarker templates
protected static ConcurrentMap<Class, Set<String>> standardAttributesMap = new ConcurrentHashMap<Class, Set<String>>();
protected static Map<Class, Set<String>> standardAttributesMap = new ConcurrentHashMap<Class, Set<String>>();
@Inject(StrutsConstants.STRUTS_UI_TEMPLATEDIR)
public void setDefaultTemplateDir(String dir) {
@@ -669,16 +662,12 @@ public abstract class UIBean extends Component {
addParameter("labelposition", findString(labelPosition));
}
if (requiredPosition != null) {
addParameter("requiredPosition", findString(requiredPosition));
if (requiredposition != null) {
addParameter("requiredposition", findString(requiredposition));
}
if (errorPosition != null) {
addParameter("errorposition", findString(errorPosition));
}
if (requiredLabel != null) {
addParameter("required", findValue(requiredLabel, Boolean.class));
if (required != null) {
addParameter("required", findValue(required, Boolean.class));
}
if (disabled != null) {
@@ -805,7 +794,7 @@ public abstract class UIBean extends Component {
if ( name != null ) {
// list should have been created by the form component
List<String> tags = (List<String>) form.getParameters().get("tagNames");
List tags = (List) form.getParameters().get("tagNames");
tags.add(name);
}
}
@@ -828,8 +817,8 @@ public abstract class UIBean extends Component {
Map overallTooltipConfigMap = getTooltipConfig(form);
overallTooltipConfigMap.putAll(tooltipConfigMap); // override parent form's tooltip config
for (Object o : overallTooltipConfigMap.entrySet()) {
Map.Entry entry = (Map.Entry) o;
for (Iterator i = overallTooltipConfigMap.entrySet().iterator(); i.hasNext(); ) {
Map.Entry entry = (Map.Entry) i.next();
addParameter((String) entry.getKey(), entry.getValue());
}
}
@@ -880,7 +869,7 @@ public abstract class UIBean extends Component {
if (name != null) {
return name.replaceAll("[\\/\\.\\[\\]]", "_");
} else {
return null;
return "";
}
}
@@ -894,7 +883,7 @@ public abstract class UIBean extends Component {
if (val != null) {
return val.replaceAll("\"", "&#34;");
} else {
return null;
return "";
}
}
@@ -929,14 +918,14 @@ public abstract class UIBean extends Component {
protected Map getTooltipConfig(UIBean component) {
Object tooltipConfigObj = component.getParameters().get("tooltipConfig");
Map<String, String> tooltipConfig = new LinkedHashMap<String, String>();
Map tooltipConfig = new LinkedHashMap();
if (tooltipConfigObj instanceof Map) {
// we get this if its configured using
// 1] UI component's tooltipConfig attribute OR
// 2] <param name="tooltip" value="" /> param tag value attribute
tooltipConfig = new LinkedHashMap<String, String>((Map)tooltipConfigObj);
tooltipConfig = new LinkedHashMap((Map)tooltipConfigObj);
} else if (tooltipConfigObj instanceof String) {
// we get this if its configured using
@@ -944,16 +933,17 @@ public abstract class UIBean extends Component {
String tooltipConfigStr = (String) tooltipConfigObj;
String[] tooltipConfigArray = tooltipConfigStr.split("\\|");
for (String aTooltipConfigArray : tooltipConfigArray) {
String[] configEntry = aTooltipConfigArray.trim().split("=");
for (int a=0; a<tooltipConfigArray.length; a++) {
String[] configEntry = ((String)tooltipConfigArray[a].trim()).split("=");
String key = configEntry[0].trim();
String value;
String value = null;
if (configEntry.length > 1) {
value = configEntry[1].trim();
tooltipConfig.put(key, value);
} else {
}
else {
if (LOG.isWarnEnabled()) {
LOG.warn("component " + component + " tooltip config param " + key + " has no value defined, skipped");
LOG.warn("component "+component+" tooltip config param "+key+" has no value defined, skipped");
}
}
}
@@ -968,7 +958,7 @@ public abstract class UIBean extends Component {
}
/**
* Create HTML id element for the component and populate this component parameter
* Create HTML id element for the component and populate this component parmaeter
* map. Additionally, a parameter named escapedId is populated which contains the found id value filtered by
* {@link #escape(String)}, needed eg. for naming Javascript identifiers based on the id value.
*
@@ -979,23 +969,18 @@ public abstract class UIBean extends Component {
* <li>[this_component_name]</li>
* </ol>
*
* @param form enclosing form tag
* @param form
*/
protected void populateComponentHtmlId(Form form) {
String tryId;
String generatedId;
if (id != null) {
// this check is needed for backwards compatibility with 2.1.x
tryId = findStringIfAltSyntax(id);
} else if (null == (generatedId = escape(name != null ? findString(name) : null))) {
if (LOG.isDebugEnabled()) {
LOG.debug("Cannot determine id attribute for [#0], consider defining id, name or key attribute!", this);
}
tryId = null;
} else if (form != null) {
tryId = form.getParameters().get("id") + "_" + generatedId;
tryId = form.getParameters().get("id") + "_"
+ escape(name != null ? findString(name) : null);
} else {
tryId = generatedId;
tryId = escape(name != null ? findString(name) : null);
}
addParameter("id", tryId);
addParameter("escapedId", escape(tryId));
@@ -1081,23 +1066,18 @@ public abstract class UIBean extends Component {
}
@StrutsTagAttribute(description="Define required position of required form element (left|right)")
public void setRequiredPosition(String requiredPosition) {
this.requiredPosition = requiredPosition;
public void setRequiredposition(String requiredposition) {
this.requiredposition = requiredposition;
}
@StrutsTagAttribute(description="Define error position of form element (top|bottom)")
public void setErrorPosition(String errorPosition) {
this.errorPosition = errorPosition;
}
@StrutsTagAttribute(description="The name to set for element")
public void setName(String name) {
this.name = name;
}
@StrutsTagAttribute(description="If set to true, the rendered element will indicate that input is required", type="Boolean", defaultValue="false")
public void setRequiredLabel(String requiredLabel) {
this.requiredLabel = requiredLabel;
public void setRequired(String required) {
this.required = required;
}
@StrutsTagAttribute(description="Set the html tabindex attribute on rendered html element")
@@ -1247,6 +1227,7 @@ public abstract class UIBean extends Component {
Set<String> standardAttributes = standardAttributesMap.get(clz);
if (standardAttributes == null) {
standardAttributes = new HashSet<String>();
standardAttributesMap.put(clz, standardAttributes);
while (clz != null) {
for (Field f : clz.getDeclaredFields()) {
if (Modifier.isProtected(f.getModifiers())
@@ -1260,9 +1241,8 @@ public abstract class UIBean extends Component {
clz = clz.getSuperclass();
}
}
standardAttributesMap.putIfAbsent(clz, standardAttributes);
}
return standardAttributes;
}
}
}
@@ -21,17 +21,19 @@
package org.apache.struts2.components;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import java.io.Writer;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.Writer;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
/**
* <!-- START SNIPPET: javadoc -->
@@ -62,15 +64,15 @@ import java.io.Writer;
* <!-- START SNIPPET: params -->
*
* <ul>
* <li>action (String) - (value or action choose either one, if both exist value takes precedence) action's name (alias) </li>
* <li>action (String) - (value or action choose either one, if both exist value takes precedence) action's name (alias) <li>
* <li>value (String) - (value or action choose either one, if both exist value takes precedence) the url itself</li>
* <li>scheme (String) - http scheme (http, https) defaults to the scheme this request is in</li>
* <li>namespace - action's namespace</li>
* <li>method (String) - action's method name, defaults to 'execute'</li>
* <li>encode (Boolean) - url encode the generated url. Defaults to 'true'.</li>
* <li>includeParams (String) - The includeParams attribute may have the value 'none', 'get' or 'all'. Defaults to 'none'.
* none - include no parameters in the URL (default)
* get - include only GET parameters in the URL
* <li>includeParams (String) - The includeParams attribute may have the value 'none', 'get' or 'all'. Defaults to 'get'.
* none - include no parameters in the URL
* get - include only GET parameters in the URL (default)
* all - include both GET and POST parameters in the URL
* </li>
* <li>includeContext (Boolean) - Specifies whether to include the web app context path. Defaults to 'true'.</li>
@@ -32,12 +32,7 @@ import com.opensymphony.xwork2.XWorkConstants;
import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.config.ConfigurationProvider;
import com.opensymphony.xwork2.conversion.ConversionAnnotationProcessor;
import com.opensymphony.xwork2.conversion.ConversionFileProcessor;
import com.opensymphony.xwork2.conversion.ConversionPropertiesProcessor;
import com.opensymphony.xwork2.conversion.ObjectTypeDeterminer;
import com.opensymphony.xwork2.conversion.TypeConverterCreator;
import com.opensymphony.xwork2.conversion.TypeConverterHolder;
import com.opensymphony.xwork2.conversion.impl.ArrayConverter;
import com.opensymphony.xwork2.conversion.impl.CollectionConverter;
import com.opensymphony.xwork2.conversion.impl.DateConverter;
@@ -49,7 +44,10 @@ import com.opensymphony.xwork2.inject.ContainerBuilder;
import com.opensymphony.xwork2.inject.Context;
import com.opensymphony.xwork2.inject.Factory;
import com.opensymphony.xwork2.inject.Scope;
import com.opensymphony.xwork2.util.*;
import com.opensymphony.xwork2.util.ClassLoaderUtil;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
import com.opensymphony.xwork2.util.PatternMatcher;
import com.opensymphony.xwork2.util.ValueStackFactory;
import com.opensymphony.xwork2.util.location.LocatableProperties;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
@@ -243,43 +241,6 @@ import java.util.StringTokenizer;
* <td>singleton</td>
* <td>Converter used to convert any object to String and back</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.conversion.ConversionPropertiesProcessor</td>
* <td>struts.conversion.properties.processor</td>
* <td>singleton</td>
* <td>Process Properties to create converters</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.conversion.ConversionPropertiesProcessor</td>
* <td>struts.converter.file.processor</td>
* <td>singleton</td>
* <td>Process <class>-conversion.properties file create converters</class></td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.conversion.ConversionAnnotationProcessor</td>
* <td>struts.converter.annotation.processor</td>
* <td>singleton</td>
* <td>Process TypeConversion annotation to create converters</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.conversion.TypeConverterCreator</td>
* <td>struts.converter.creator</td>
* <td>singleton</td>
* <td>Creates user converters</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.conversion.TypeConverterHolder</td>
* <td>struts.converter.holder</td>
* <td>singleton</td>
* <td>Holds user converters' instances</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.util.TextParser</td>
* <td>struts.expression.parser</td>
* <td>singleton</td>
* <td>Used to parse expressions like ${foo.bar} or %{bar.foo} but it is up tp the TextParser's
* implementation what kind of opening char to use (#, $, %, etc)</td>
* </tr>
* </table>
*
* <!-- END SNIPPET: extensionPoints -->
@@ -326,22 +287,8 @@ public class BeanSelectionProvider implements ConfigurationProvider {
public void register(ContainerBuilder builder, LocatableProperties props) {
alias(ObjectFactory.class, StrutsConstants.STRUTS_OBJECTFACTORY, builder, props);
alias(FileManagerFactory.class, StrutsConstants.STRUTS_FILE_MANAGER_FACTORY, builder, props, Scope.SINGLETON);
alias(XWorkConverter.class, StrutsConstants.STRUTS_XWORKCONVERTER, builder, props);
alias(CollectionConverter.class, StrutsConstants.STRUTS_CONVERTER_COLLECTION, builder, props);
alias(ArrayConverter.class, StrutsConstants.STRUTS_CONVERTER_ARRAY, builder, props);
alias(DateConverter.class, StrutsConstants.STRUTS_CONVERTER_DATE, builder, props);
alias(NumberConverter.class, StrutsConstants.STRUTS_CONVERTER_NUMBER, builder, props);
alias(StringConverter.class, StrutsConstants.STRUTS_CONVERTER_STRING, builder, props);
alias(ConversionPropertiesProcessor.class, StrutsConstants.STRUTS_CONVERTER_PROPERTIES_PROCESSOR, builder, props);
alias(ConversionFileProcessor.class, StrutsConstants.STRUTS_CONVERTER_FILE_PROCESSOR, builder, props);
alias(ConversionAnnotationProcessor.class, StrutsConstants.STRUTS_CONVERTER_ANNOTATION_PROCESSOR, builder, props);
alias(TypeConverterCreator.class, StrutsConstants.STRUTS_CONVERTER_CREATOR, builder, props);
alias(TypeConverterHolder.class, StrutsConstants.STRUTS_CONVERTER_HOLDER, builder, props);
alias(TextProvider.class, StrutsConstants.STRUTS_XWORKTEXTPROVIDER, builder, props, Scope.DEFAULT);
alias(LocaleProvider.class, StrutsConstants.STRUTS_LOCALE_PROVIDER, builder, props);
alias(ActionProxyFactory.class, StrutsConstants.STRUTS_ACTIONPROXYFACTORY, builder, props);
alias(ObjectTypeDeterminer.class, StrutsConstants.STRUTS_OBJECTTYPEDETERMINER, builder, props);
@@ -359,7 +306,11 @@ public class BeanSelectionProvider implements ConfigurationProvider {
alias(UnknownHandlerManager.class, StrutsConstants.STRUTS_UNKNOWN_HANDLER_MANAGER, builder, props);
alias(UrlHelper.class, StrutsConstants.STRUTS_URL_HELPER, builder, props);
alias(TextParser.class, StrutsConstants.STRUTS_EXPRESSION_PARSER, builder, props);
alias(CollectionConverter.class, StrutsConstants.STRUTS_CONVERTER_COLLECTION, builder, props);
alias(ArrayConverter.class, StrutsConstants.STRUTS_CONVERTER_ARRAY, builder, props);
alias(DateConverter.class, StrutsConstants.STRUTS_CONVERTER_DATE, builder, props);
alias(NumberConverter.class, StrutsConstants.STRUTS_CONVERTER_NUMBER, builder, props);
alias(StringConverter.class, StrutsConstants.STRUTS_CONVERTER_STRING, builder, props);
if ("true".equalsIgnoreCase(props.getProperty(StrutsConstants.STRUTS_DEVMODE))) {
props.setProperty(StrutsConstants.STRUTS_I18N_RELOAD, "true");
@@ -375,7 +326,6 @@ public class BeanSelectionProvider implements ConfigurationProvider {
// Convert Struts properties into XWork properties
convertIfExist(props, StrutsConstants.STRUTS_LOG_MISSING_PROPERTIES, XWorkConstants.LOG_MISSING_PROPERTIES);
convertIfExist(props, StrutsConstants.STRUTS_ENABLE_OGNL_EXPRESSION_CACHE, XWorkConstants.ENABLE_OGNL_EXPRESSION_CACHE);
convertIfExist(props, StrutsConstants.STRUTS_ENABLE_OGNL_EVAL_EXPRESSION, XWorkConstants.ENABLE_OGNL_EVAL_EXPRESSION);
convertIfExist(props, StrutsConstants.STRUTS_ALLOW_STATIC_METHOD_ACCESS, XWorkConstants.ALLOW_STATIC_METHOD_ACCESS);
convertIfExist(props, StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD, XWorkConstants.RELOAD_XML_CONFIGURATION);
@@ -398,11 +348,11 @@ public class BeanSelectionProvider implements ConfigurationProvider {
String name = customBundles.nextToken();
try {
if (LOG.isInfoEnabled()) {
LOG.info("Loading global messages from [#0]", name);
LOG.info("Loading global messages from " + name);
}
LocalizedTextUtil.addDefaultResourceBundle(name);
} catch (Exception e) {
LOG.error("Could not find messages file #0.properties. Skipping", name);
LOG.error("Could not find messages file " + name + ".properties. Skipping");
}
}
}
@@ -21,21 +21,22 @@
package org.apache.struts2.config;
import java.util.Iterator;
import java.util.Locale;
import java.util.StringTokenizer;
import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.config.ConfigurationProvider;
import com.opensymphony.xwork2.inject.ContainerBuilder;
import com.opensymphony.xwork2.inject.Context;
import com.opensymphony.xwork2.inject.Factory;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.location.LocatableProperties;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.StrutsConstants;
import java.util.Iterator;
import java.util.Locale;
import java.util.StringTokenizer;
public class LegacyPropertiesConfigurationProvider implements ConfigurationProvider {
/**
@@ -68,10 +69,10 @@ public class LegacyPropertiesConfigurationProvider implements ConfigurationProvi
loadSettings(props, settings);
// Set default locale by lazily resolving the locale property as needed into a Locale object
builder.factory(Locale.class, new Factory<Locale>() {
builder.factory(Locale.class, new Factory() {
private Locale locale;
public synchronized Locale create(Context context) throws Exception {
public synchronized Object create(Context context) throws Exception {
if (locale == null) {
String loc = context.getContainer().getInstance(String.class, StrutsConstants.STRUTS_LOCALE);
if (loc != null) {
@@ -21,14 +21,16 @@
package org.apache.struts2.config;
import java.util.Iterator;
import java.util.Locale;
import java.util.StringTokenizer;
import org.apache.struts2.StrutsConstants;
import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.util.location.Location;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.StrutsConstants;
import java.util.Iterator;
import java.util.Locale;
/**
@@ -72,11 +74,6 @@ class Settings {
*/
static Settings defaultImpl;
/**
* Guard used to protect the defaultImpl initialisation.
*/
private static final Object DEFAULT_LOCK = new Object();
/**
* An instance of the default locale as specified by the <code>struts.locale</code> setting.
*
@@ -270,27 +267,23 @@ class Settings {
*/
private static Settings getDefaultInstance() {
if (defaultImpl == null) {
synchronized (DEFAULT_LOCK) {
if (defaultImpl == null) {
// Create bootstrap implementation
defaultImpl = new DefaultSettings();
// Create bootstrap implementation
defaultImpl = new DefaultSettings();
// Create default implementation
// Create default implementation
try {
String className = get(StrutsConstants.STRUTS_CONFIGURATION);
if (!className.equals(defaultImpl.getClass().getName())) {
try {
String className = get(StrutsConstants.STRUTS_CONFIGURATION);
if (!className.equals(defaultImpl.getClass().getName())) {
try {
// singleton instances shouldn't be built accessing request or session-specific context data
defaultImpl = (Settings) ObjectFactory.getObjectFactory().buildBean(Thread.currentThread().getContextClassLoader().loadClass(className), null);
} catch (Exception e) {
LOG.error("Settings: Could not instantiate the struts.configuration object, substituting the default implementation.", e);
}
}
} catch (IllegalArgumentException ex) {
// ignore
// singleton instances shouldn't be built accessing request or session-specific context data
defaultImpl = (Settings) ObjectFactory.getObjectFactory().buildBean(Thread.currentThread().getContextClassLoader().loadClass(className), null);
} catch (Exception e) {
LOG.error("Settings: Could not instantiate the struts.configuration object, substituting the default implementation.", e);
}
}
} catch (IllegalArgumentException ex) {
// ignore
}
}
@@ -301,10 +294,7 @@ class Settings {
* Resets the default and any plugin Setting instance to null.
*/
public static void reset() {
synchronized (DEFAULT_LOCK) {
defaultImpl = null;
}
defaultImpl = null;
settingsImpl = null;
}
}
@@ -21,10 +21,7 @@
package org.apache.struts2.dispatcher;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import com.opensymphony.xwork2.util.profiling.UtilTimerStack;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
@@ -34,7 +31,11 @@ import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import com.opensymphony.xwork2.util.profiling.UtilTimerStack;
/**
* <!-- SNIPPET START: description -->
@@ -79,8 +80,6 @@ public class ActionContextCleanUp implements Filter {
*/
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
showDeprecatedWarning();
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
@@ -138,22 +137,4 @@ public class ActionContextCleanUp implements Filter {
public void init(FilterConfig arg0) throws ServletException {
}
private void showDeprecatedWarning() {
String msg =
"\n\n" +
"***************************************************************************\n" +
"* WARNING!!! *\n" +
"* *\n" +
"* >>> ActionContextCleanUp <<< is deprecated! Please use the new filters! *\n" +
"* *\n" +
"* This can be a source of unpredictable problems! *\n" +
"* *\n" +
"* Please refer to the docs for more details! *\n" +
"* http://struts.apache.org/2.x/docs/webxml.html *\n" +
"* *\n" +
"***************************************************************************\n\n";
System.out.println(msg);
}
}
@@ -1,33 +0,0 @@
package org.apache.struts2.dispatcher;
import com.opensymphony.xwork2.inject.Container;
import org.apache.struts2.StrutsConstants;
/**
* Simple class to hold Container instance per thread to minimise number of attempts
* to read configuration and build each time a new configuration.
*
* Thus depends on {@link StrutsConstants#STRUTS_CONFIGURATION_XML_RELOAD} flag,
* if set to false just use stored container, configuration will do not change.
*/
class ContainerHolder {
private static ThreadLocal<Container> instance = new ThreadLocal<Container>();
public static void store(Container instance) {
boolean reloadConfigs = Boolean.valueOf(instance.getInstance(String.class, StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD));
if (!reloadConfigs) {
// reloadConfigs is false, configuration will do not change, just keep it
ContainerHolder.instance.set(instance);
}
}
public static Container get() {
return ContainerHolder.instance.get();
}
public static void clear() {
ContainerHolder.instance.remove();
}
}
@@ -37,41 +37,19 @@ import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;
/**
* <b>Default implementation to server static content</b>
* <p/>
* This class is used to serve common static content needed when using various parts of Struts, such as JavaScript
* files, CSS files, etc. It works by looking for requests to /struts/* (or /static/*), and then mapping the value after "/struts/"
* to common packages in Struts and, optionally, in your class path. By default, the following packages are
* automatically searched:
* <ul>
* <li>org.apache.struts2.static</li>
* <li>template</li>
* <li>static</li>
* </ul>
* <p/> This means that you can simply request /struts/xhtml/styles.css and the XHTML UI theme's default stylesheet
* will be returned. Likewise, many of the AJAX UI components require various JavaScript files, which are found in the
* org.apache.struts2.static package. If you wish to add additional packages to be searched, you can add a comma
* separated (space, tab and new line will do as well) list in the filter init parameter named "packages". <b>Be
* careful</b>, however, to expose any packages that may have sensitive information, such as properties file with
* database access credentials.
* <p/>
*/
public class DefaultStaticContentLoader implements StaticContentLoader {
/**
* Provide a logging instance.
*/
private Logger LOG = LoggerFactory.getLogger(DefaultStaticContentLoader.class);
private Logger log;
/**
* Store set of path prefixes to use with static resources.
*/
protected List<String> pathPrefixes;
protected String[] pathPrefixes;
/**
* Store state of StrutsConstants.STRUTS_SERVE_STATIC_CONTENT setting.
@@ -138,6 +116,7 @@ public class DefaultStaticContentLoader implements StaticContentLoader {
packages = param + " " + packages;
}
this.pathPrefixes = parse(packages);
initLogging(filterConfig);
}
protected String getAdditionalPackages() {
@@ -151,9 +130,9 @@ public class DefaultStaticContentLoader implements StaticContentLoader {
* A comma-delimited String listing packages
* @return A string array of packages
*/
protected List<String> parse(String packages) {
protected String[] parse(String packages) {
if (packages == null) {
return Collections.emptyList();
return null;
}
List<String> pathPrefixes = new ArrayList<String>();
@@ -166,7 +145,7 @@ public class DefaultStaticContentLoader implements StaticContentLoader {
pathPrefixes.add(pathPrefix);
}
return pathPrefixes;
return pathPrefixes.toArray(new String[pathPrefixes.size()]);
}
/*
@@ -213,9 +192,8 @@ public class DefaultStaticContentLoader implements StaticContentLoader {
try {
ifModifiedSince = request.getDateHeader("If-Modified-Since");
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Invalid If-Modified-Since header value: '#0', ignoring", request.getHeader("If-Modified-Since"));
}
log.warn("Invalid If-Modified-Since header value: '"
+ request.getHeader("If-Modified-Since") + "', ignoring");
}
long lastModifiedMillis = lastModifiedCal.getTimeInMillis();
long now = cal.getTimeInMillis();
@@ -255,9 +233,33 @@ public class DefaultStaticContentLoader implements StaticContentLoader {
} finally {
is.close();
}
return;
}
}
private void initLogging(HostConfig filterConfig) {
String factoryName = filterConfig.getInitParameter("loggerFactory");
if (factoryName != null) {
try {
Class cls = ClassLoaderUtil.loadClass(factoryName, this.getClass());
LoggerFactory fac = (LoggerFactory)cls.newInstance();
LoggerFactory.setLoggerFactory(fac);
} catch (InstantiationException e) {
System.err.println("Unable to instantiate logger factory: "+factoryName+", using default");
e.printStackTrace();
} catch (IllegalAccessException e) {
System.err.println("Unable to access logger factory: "+factoryName+", using default");
e.printStackTrace();
} catch (ClassNotFoundException e) {
System.err.println("Unable to locate logger factory class: "+factoryName+", using default");
e.printStackTrace();
}
}
log = LoggerFactory.getLogger(FilterDispatcher.class);
}
/**
* Look for a static resource in the classpath.
*
@@ -274,6 +276,7 @@ public class DefaultStaticContentLoader implements StaticContentLoader {
* @param packagePrefix The package prefix to use to locate the resource
* @return full path
* @throws UnsupportedEncodingException
* @throws IOException
*/
protected String buildPath(String name, String packagePrefix) throws UnsupportedEncodingException {
String resourcePath;
@@ -119,15 +119,10 @@ public class Dispatcher {
private ConfigurationManager configurationManager;
/**
* Store state of StrutsConstants.STRUTS_DEVMODE setting.
* Store state of StrutsConstants.STRUTS_DEVMODE setting.
*/
private boolean devMode;
/**
* Store state of StrutsConstants.DISABLE_REQUEST_ATTRIBUTE_VALUE_STACK_LOOKUP setting.
*/
private boolean disableRequestAttributeValueStackLookup;
/**
* Store state of StrutsConstants.STRUTS_I18N_ENCODING setting.
*/
@@ -230,15 +225,6 @@ public class Dispatcher {
devMode = "true".equals(mode);
}
/**
* Modify state of StrutsConstants.DISABLE_REQUEST_ATTRIBUTE_VALUE_STACK_LOOKUP setting.
* @param disableRequestAttributeValueStackLookup New setting
*/
@Inject(value=StrutsConstants.STRUTS_DISABLE_REQUEST_ATTRIBUTE_VALUE_STACK_LOOKUP, required=false)
public void setDisableRequestAttributeValueStackLookup(String disableRequestAttributeValueStackLookup) {
this.disableRequestAttributeValueStackLookup = "true".equalsIgnoreCase(disableRequestAttributeValueStackLookup);
}
/**
* Modify state of StrutsConstants.STRUTS_LOCALE setting.
* @param val New setting
@@ -266,7 +252,7 @@ public class Dispatcher {
multipartSaveDir = val;
}
@Inject(StrutsConstants.STRUTS_MULTIPART_PARSER)
@Inject(StrutsConstants.STRUTS_MULTIPART_HANDLER)
public void setMultipartHandler(String val) {
multipartHandlerName = val;
}
@@ -299,7 +285,7 @@ public class Dispatcher {
}
catch(Exception e) {
// catch any exception that may occurred during destroy() and log it
LOG.error("exception occurred while destroying ObjectFactory [#0]", e, objectFactory.toString());
LOG.error("exception occurred while destroying ObjectFactory ["+objectFactory+"]", e);
}
}
@@ -329,9 +315,6 @@ public class Dispatcher {
interceptor.destroy();
}
// Clear container holder when application is unloaded / server shutdown
ContainerHolder.clear();
//cleanup action context
ActionContext.setContext(null);
@@ -449,8 +432,6 @@ public class Dispatcher {
boolean reloadi18n = Boolean.valueOf(container.getInstance(String.class, StrutsConstants.STRUTS_I18N_RELOAD));
LocalizedTextUtil.setReloadBundles(reloadi18n);
ContainerHolder.store(container);
return container;
}
@@ -698,20 +679,21 @@ public class Dispatcher {
File multipartSaveDir = new File(saveDir);
if (!multipartSaveDir.exists()) {
if (!multipartSaveDir.mkdirs()) {
if (!multipartSaveDir.mkdir()) {
String logMessage;
try {
logMessage = "Could not find create multipart save directory '" + multipartSaveDir.getCanonicalPath() + "'.";
} catch (IOException e) {
logMessage = "Could not find create multipart save directory '" + multipartSaveDir.toString() + "'.";
}
if (devMode) {
try {
logMessage = "Could not find create multipart save directory '"+multipartSaveDir.getCanonicalPath()+"'.";
} catch (IOException e) {
logMessage = "Could not find create multipart save directory '"+multipartSaveDir.toString()+"'.";
}
if(devMode) {
LOG.error(logMessage);
} else {
}
else {
if (LOG.isWarnEnabled()) {
LOG.warn(logMessage);
}
}
}
}
}
}
@@ -791,37 +773,26 @@ public class Dispatcher {
String content_type = request.getContentType();
if (content_type != null && content_type.contains("multipart/form-data")) {
MultiPartRequest mpr = getMultiPartRequest();
MultiPartRequest mpr = null;
//check for alternate implementations of MultiPartRequest
Set<String> multiNames = getContainer().getInstanceNames(MultiPartRequest.class);
for (String multiName : multiNames) {
if (multiName.equals(multipartHandlerName)) {
mpr = getContainer().getInstance(MultiPartRequest.class, multiName);
}
}
if (mpr == null ) {
mpr = getContainer().getInstance(MultiPartRequest.class);
}
LocaleProvider provider = getContainer().getInstance(LocaleProvider.class);
request = new MultiPartRequestWrapper(mpr, request, getSaveDir(servletContext), provider);
} else {
request = new StrutsRequestWrapper(request, disableRequestAttributeValueStackLookup);
request = new StrutsRequestWrapper(request);
}
return request;
}
/**
* On each request it must return a new instance as implementation could be not thread safe
* and thus ensure of resource clean up
*
* @return
*/
protected MultiPartRequest getMultiPartRequest() {
MultiPartRequest mpr = null;
//check for alternate implementations of MultiPartRequest
Set<String> multiNames = getContainer().getInstanceNames(MultiPartRequest.class);
for (String multiName : multiNames) {
if (multiName.equals(multipartHandlerName)) {
mpr = getContainer().getInstance(MultiPartRequest.class, multiName);
}
}
if (mpr == null ) {
mpr = getContainer().getInstance(MultiPartRequest.class);
}
return mpr;
}
/**
* Removes all the files created by MultiPartRequestWrapper.
*
@@ -829,7 +800,6 @@ public class Dispatcher {
* @see org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper
*/
public void cleanUpRequest(HttpServletRequest request) {
ContainerHolder.clear();
if (!(request instanceof MultiPartRequestWrapper)) {
return;
}
@@ -910,15 +880,7 @@ public class Dispatcher {
}
}
/**
* Cleanup any resources used to initialise Dispatcher
*/
public void cleanUpAfterInit() {
if (LOG.isDebugEnabled()) {
LOG.debug("Cleaning up resources used to init Dispatcher");
}
ContainerHolder.clear();
}
/**
* Provide an accessor class for static XWork utility.
@@ -946,10 +908,8 @@ public class Dispatcher {
* Modify the ConfigurationManager instance
*
* @param mgr The configuration manager
* @deprecated should be removed as is used only in tests
*/
public void setConfigurationManager(ConfigurationManager mgr) {
ContainerHolder.clear();
this.configurationManager = mgr;
}
@@ -958,9 +918,6 @@ public class Dispatcher {
* @return Our dependency injection container
*/
public Container getContainer() {
if (ContainerHolder.get() != null) {
return ContainerHolder.get();
}
ConfigurationManager mgr = getConfigurationManager();
if (mgr == null) {
throw new IllegalStateException("The configuration manager shouldn't be null");
@@ -969,11 +926,8 @@ public class Dispatcher {
if (config == null) {
throw new IllegalStateException("Unable to load configuration");
} else {
Container container = config.getContainer();
ContainerHolder.store(container);
return container;
return config.getContainer();
}
}
}
}
@@ -26,8 +26,6 @@ import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.Result;
import com.opensymphony.xwork2.util.TextParseUtil;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.ServletActionContext;
import javax.servlet.http.HttpServletResponse;
@@ -37,65 +35,64 @@ import java.util.Map;
/**
* <!-- START SNIPPET: description -->
* <p/>
*
* A custom Result type for setting HTTP headers and status by optionally evaluating against the ValueStack.
* This result can also be used to send and error to the client. All the parameters can be evaluated against the ValueStack.
* <p/>
* This result can also be used to send and error to the client.
*
* <!-- END SNIPPET: description -->
* <p/>
* <b>This result type takes the following parameters:</b>
* <p/>
*
* <!-- START SNIPPET: params -->
* <p/>
*
* <ul>
* <p/>
*
* <li><b>status</b> - the http servlet response status code that should be set on a response.</li>
* <p/>
*
* <li><b>parse</b> - true by default. If set to false, the headers param will not be parsed for Ognl expressions.</li>
* <p/>
*
* <li><b>headers</b> - header values.</li>
* <p/>
*
* <li><b>error</b> - the http servlet response error code that should be set on a response.</li>
* <p/>
*
* <li><b>errorMessage</b> - error message to be set on response if 'error' is set.</li>
* </ul>
* <p/>
*
* <!-- END SNIPPET: params -->
* <p/>
*
* <b>Example:</b>
* <p/>
*
* <pre><!-- START SNIPPET: example -->
* &lt;result name="success" type="httpheader"&gt;
* &lt;param name="status"&gt;204&lt;/param&gt;
* &lt;param name="headers.a"&gt;a custom header value&lt;/param&gt;
* &lt;param name="headers.b"&gt;another custom header value&lt;/param&gt;
* &lt;/result&gt;
* <p/>
*
* &lt;result name="proxyRequired" type="httpheader"&gt;
* &lt;param name="error"&gt;305&lt;/param&gt;
* &lt;param name="errorMessage"&gt;this action must be accessed through a prozy&lt;/param&gt;
* &lt;/result&gt;
* <!-- END SNIPPET: example --></pre>
*
*/
public class HttpHeaderResult implements Result {
private static final long serialVersionUID = 195648957144219214L;
private static final Logger LOG = LoggerFactory.getLogger(HttpHeaderResult.class);
/**
* This result type doesn't have a default param, null is ok to reduce noice in logs
*/
public static final String DEFAULT_PARAM = null;
/** The default parameter */
public static final String DEFAULT_PARAM = "status";
private boolean parse = true;
private Map<String, String> headers;
private Map<String,String> headers;
private int status = -1;
private String error = null;
private int error = -1;
private String errorMessage;
public HttpHeaderResult() {
super();
headers = new HashMap<String, String>();
headers = new HashMap<String,String>();
}
public HttpHeaderResult(int status) {
@@ -104,19 +101,20 @@ public class HttpHeaderResult implements Result {
this.parse = false;
}
/**
* Sets the http servlet error code that should be set on the response
*
* Sets the http servlet error code that should be set on the reponse
*
* @param error the Http error code
* @see javax.servlet.http.HttpServletResponse#sendError(int)
*/
public void setError(String error) {
public void setError(int error) {
this.error = error;
}
/**
* Sets the error message that should be set on the reponse
*
*
* @param errorMessage error message send to the client
* @see javax.servlet.http.HttpServletResponse#sendError(int, String)
*/
@@ -136,7 +134,7 @@ public class HttpHeaderResult implements Result {
/**
* Sets whether or not the HTTP header values should be evaluated against the ValueStack (by default they are).
*
* @param parse <tt>true</tt> if HTTP header values should be evaluated against the ValueStack, <tt>false</tt>
* @param parse <tt>true</tt> if HTTP header values should be evaluated agains the ValueStack, <tt>false</tt>
* otherwise.
*/
public void setParse(boolean parse) {
@@ -159,8 +157,7 @@ public class HttpHeaderResult implements Result {
/**
* Adds an HTTP header to the response
*
* @param name header name
* @param name header name
* @param value header value
*/
public void addHeader(String name, String value) {
@@ -177,35 +174,24 @@ public class HttpHeaderResult implements Result {
public void execute(ActionInvocation invocation) throws Exception {
HttpServletResponse response = ServletActionContext.getResponse();
ValueStack stack = ActionContext.getContext().getValueStack();
if (status != -1) {
response.setStatus(status);
} else if (error != -1) {
if (errorMessage != null) {
String finalMessage = parse ? TextParseUtil.translateVariables(
errorMessage, stack) : errorMessage;
response.sendError(error, finalMessage);
} else
response.sendError(error);
}
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
String value = entry.getValue();
for (Map.Entry<String, String> stringStringEntry : headers.entrySet()) {
Map.Entry entry = (Map.Entry) stringStringEntry;
String value = (String) entry.getValue();
String finalValue = parse ? TextParseUtil.translateVariables(value, stack) : value;
response.addHeader(entry.getKey(), finalValue);
}
}
if (status == -1 && error != null) {
int errorCode = -1;
try {
errorCode = Integer.parseInt(parse ? TextParseUtil.translateVariables(error, stack) : error);
} catch (Exception e) {
if (LOG.isErrorEnabled()) {
LOG.error("Cannot parse errorCode [#0] value as Integer!", e, error);
}
}
if (errorCode != -1) {
if (errorMessage != null) {
String finalMessage = parse ? TextParseUtil.translateVariables(errorMessage, stack) : errorMessage;
response.sendError(errorCode, finalMessage);
} else {
response.sendError(errorCode);
}
response.addHeader((String) entry.getKey(), finalValue);
}
}
}
@@ -198,9 +198,8 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec
if (resultConfig != null) {
Map<String, String> resultConfigParams = resultConfig.getParams();
List<String> prohibitedResultParams = getProhibitedResultParams();
for (Map.Entry<String, String> e : resultConfigParams.entrySet()) {
if (!prohibitedResultParams.contains(e.getKey())) {
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);
@@ -228,18 +227,7 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec
}
protected List<String> getProhibitedResultParams() {
return Arrays.asList(
DEFAULT_PARAM,
"namespace",
"method",
"encode",
"parse",
"location",
"prependServletContext",
"suppressEmptyParameters",
"anchor",
"statusCode"
);
return Arrays.asList(DEFAULT_PARAM, "namespace", "method", "encode", "parse", "location", "prependServletContext", "suppressEmptyParameters", "anchor");
}
/**
@@ -20,20 +20,15 @@
*/
package org.apache.struts2.dispatcher;
import org.apache.struts2.dispatcher.ng.HostConfig;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import org.apache.struts2.dispatcher.ng.HostConfig;
/**
* Interface for loading static resources, based on a path. After implementing your own static content loader
* you must tell the framework how to use it, eg.
*
* &lt;bean name="myContentLoader" type="org.apache.struts2.dispatcher" class="com.company.struts.MyContentLoader"/&gt;
* &lt;constant name="struts.staticContentLoader" value="myContentLoader"/&gt;
*
* Check {@link org.apache.struts2.config.BeanSelectionProvider} for more details.
* Interface for loading static resources, based on a path
*/
public interface StaticContentLoader {
@@ -21,13 +21,11 @@
package org.apache.struts2.dispatcher;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.util.ValueStack;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import static org.apache.commons.lang3.BooleanUtils.isTrue;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.util.ValueStack;
/**
* <!-- START SNIPPET: javadoc -->
@@ -43,61 +41,49 @@ import static org.apache.commons.lang3.BooleanUtils.isTrue;
*/
public class StrutsRequestWrapper extends HttpServletRequestWrapper {
private static final String REQUEST_WRAPPER_GET_ATTRIBUTE = "__requestWrapper.getAttribute";
private final boolean disableRequestAttributeValueStackLookup;
/**
* The constructor
* @param req The request
*/
public StrutsRequestWrapper(HttpServletRequest req) {
this(req, false);
}
/**
* The constructor
* @param req The request
* @param disableRequestAttributeValueStackLookup flag for disabling request attribute value stack lookup (JSTL accessibility)
*/
public StrutsRequestWrapper(HttpServletRequest req, boolean disableRequestAttributeValueStackLookup) {
super(req);
this.disableRequestAttributeValueStackLookup = disableRequestAttributeValueStackLookup;
}
/**
* Gets the object, looking in the value stack if not found
*
* @param key The attribute key
* @param s The attribute key
*/
public Object getAttribute(String key) {
if (key == null) {
throw new NullPointerException("You must specify a key value");
}
if (disableRequestAttributeValueStackLookup || key.startsWith("javax.servlet")) {
public Object getAttribute(String s) {
if (s != null && s.startsWith("javax.servlet")) {
// don't bother with the standard javax.servlet attributes, we can short-circuit this
// see WW-953 and the forums post linked in that issue for more info
return super.getAttribute(key);
return super.getAttribute(s);
}
ActionContext ctx = ActionContext.getContext();
Object attribute = super.getAttribute(key);
if (ctx != null && attribute == null) {
boolean alreadyIn = isTrue((Boolean) ctx.get(REQUEST_WRAPPER_GET_ATTRIBUTE));
// note: we don't let # come through or else a request for
// #attr.foo or #request.foo could cause an endless loop
if (!alreadyIn && !key.contains("#")) {
try {
// If not found, then try the ValueStack
ctx.put(REQUEST_WRAPPER_GET_ATTRIBUTE, Boolean.TRUE);
ValueStack stack = ctx.getValueStack();
if (stack != null) {
attribute = stack.findValue(key);
Object attribute = super.getAttribute(s);
if (ctx != null) {
if (attribute == null) {
boolean alreadyIn = false;
Boolean b = (Boolean) ctx.get("__requestWrapper.getAttribute");
if (b != null) {
alreadyIn = b.booleanValue();
}
// note: we don't let # come through or else a request for
// #attr.foo or #request.foo could cause an endless loop
if (!alreadyIn && s.indexOf("#") == -1) {
try {
// If not found, then try the ValueStack
ctx.put("__requestWrapper.getAttribute", Boolean.TRUE);
ValueStack stack = ctx.getValueStack();
if (stack != null) {
attribute = stack.findValue(s);
}
} finally {
ctx.put("__requestWrapper.getAttribute", Boolean.FALSE);
}
} finally {
ctx.put(REQUEST_WRAPPER_GET_ATTRIBUTE, Boolean.FALSE);
}
}
}
@@ -197,13 +197,13 @@ public abstract class StrutsResultSupport implements Result, StrutsStatics {
if (parse && param != null && invocation != null) {
return TextParseUtil.translateVariables(param, invocation.getStack(),
new TextParseUtil.ParsedValueEvaluator() {
public Object evaluate(String parsedValue) {
public Object evaluate(Object parsedValue) {
if (encode) {
if (parsedValue != null) {
try {
// use UTF-8 as this is the recommended encoding by W3C to
// avoid incompatibilities.
return URLEncoder.encode(parsedValue, "UTF-8");
return URLEncoder.encode(parsedValue.toString(), "UTF-8");
}
catch(UnsupportedEncodingException e) {
if (LOG.isWarnEnabled()) {
@@ -159,15 +159,15 @@ public class VelocityResult extends StrutsResultSupport {
// to do it all the time (WW-829). Since Velocity support is being deprecated, we'll oblige :)
writer.flush();
} catch (Exception e) {
if (LOG.isErrorEnabled()) {
LOG.error("Unable to render Velocity Template, '#0'", e, finalLocation);
}
LOG.error("Unable to render Velocity Template, '" + finalLocation + "'", e);
throw e;
} finally {
if (usedJspFactory) {
jspFactory.releasePageContext(pageContext);
}
}
return;
}
/**
@@ -21,10 +21,10 @@
package org.apache.struts2.dispatcher.mapper;
import com.opensymphony.xwork2.Result;
import java.util.Map;
import com.opensymphony.xwork2.Result;
/**
* Simple class that holds the action mapping information used to invoke a
* Struts action. The name and namespace are required, but the params map
@@ -157,17 +157,4 @@ public class ActionMapping {
public void setExtension(String extension) {
this.extension = extension;
}
@Override
public String toString() {
return "ActionMapping{" +
"name='" + name + '\'' +
", namespace='" + namespace + '\'' +
", method='" + method + '\'' +
", extension='" + extension + '\'' +
", params=" + params +
", result=" + (result != null ? result.getClass().getName() : "null") +
'}';
}
}
@@ -21,24 +21,60 @@
package org.apache.struts2.dispatcher.mapper;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.StrutsConstants;
import com.opensymphony.xwork2.config.ConfigurationManager;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.StrutsConstants;
import javax.servlet.http.HttpServletRequest;
import java.util.LinkedList;
import java.util.List;
/**
* <!-- START SNIPPET: description -->
*
* A composite action mapper that is capable of delegating to a series of {@link ActionMapper} if the former
* failed to obtained a valid {@link ActionMapping} or uri.
* <p/>
* It is configured through struts.properties.
* <p/>
* For example, with the following entries in struts.properties
* <p/>
* <pre>
* &lt;bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="struts"
* class="org.apache.struts2.dispatcher.mapper.CompositeActionMapper" /&gt;
* &lt;constant name="struts.mapper.composite"
* value="org.apache.struts2.dispatcher.mapper.DefaultActionMapper,org.apache.struts2.dispatcher.mapper.RestfulActionMapper,org.apache.struts2.dispatcher.mapper.Restful2ActionMapper" /&gt;
* </pre>
* <p/>
* When {@link CompositeActionMapper#getMapping(HttpServletRequest, ConfigurationManager)} or
* {@link CompositeActionMapper#getUriFromActionMapping(ActionMapping)} is invoked,
* {@link CompositeActionMapper} would go through these {@link ActionMapper}s in sequence
* starting from {@link ActionMapper} identified by 'struts.mapper.composite.1', followed by
* 'struts.mapper.composite.2' and finally 'struts.mapper.composite.3' (in this case) until either
* one of the {@link ActionMapper} return a valid result (not null) or it runs out of {@link ActionMapper}
* in which case it will just return null for both
* {@link CompositeActionMapper#getMapping(HttpServletRequest, ConfigurationManager)} and
* {@link CompositeActionMapper#getUriFromActionMapping(ActionMapping)} methods.
* <p/>
*
* More details: http://struts.apache.org/2.x/docs/actionmapper.html
* For example with the following in struts-*.xml :-
* <pre>
* &lt;bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="struts"
* class="org.apache.struts2.dispatcher.mapper.CompositeActionMapper" /&gt;
* &lt;constant name="struts.mapper.composite"
* value="org.apache.struts2.dispatcher.mapper.DefaultActionMapper,foo.bar.MyActionMapper,foo.bar.MyAnotherActionMapper" /&gt;
* </pre>
* <p/>
* <code>CompositeActionMapper</code> will be configured with 3 ActionMapper, namely
* "DefaultActionMapper", "MyActionMapper" and "MyAnotherActionMapper".
* <code>CompositeActionMapper</code> would consult each of them in order described above.
*
* <!-- END SNIPPET: description -->
*
* @see ActionMapper
* @see ActionMapping
@@ -49,11 +85,17 @@ public class CompositeActionMapper implements ActionMapper {
private static final Logger LOG = LoggerFactory.getLogger(CompositeActionMapper.class);
protected List<ActionMapper> actionMappers = new LinkedList<ActionMapper>();
protected Container container;
protected List<ActionMapper> actionMappers = new ArrayList<ActionMapper>();
@Inject
public CompositeActionMapper(Container container,
@Inject(value = StrutsConstants.STRUTS_MAPPER_COMPOSITE) String list) {
public void setContainer(Container container) {
this.container = container;
}
@Inject(StrutsConstants.STRUTS_MAPPER_COMPOSITE)
public void setActionMappers(String list) {
if (list != null) {
String[] arr = list.split(",");
for (String name : arr) {
@@ -65,6 +107,7 @@ public class CompositeActionMapper implements ActionMapper {
}
}
public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
for (ActionMapper actionMapper : actionMappers) {
@@ -27,9 +27,6 @@ import com.opensymphony.xwork2.config.ConfigurationManager;
import com.opensymphony.xwork2.config.entities.PackageConfig;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.commons.lang3.StringUtils;
import org.apache.struts2.RequestUtils;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.StrutsConstants;
@@ -37,8 +34,13 @@ import org.apache.struts2.dispatcher.ServletRedirectResult;
import org.apache.struts2.util.PrefixTrie;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.regex.Pattern;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* <!-- START SNIPPET: javadoc -->
@@ -160,18 +162,21 @@ import java.util.regex.Pattern;
*/
public class DefaultActionMapper implements ActionMapper {
private static final Logger LOG = LoggerFactory.getLogger(DefaultActionMapper.class);
protected static final String METHOD_PREFIX = "method:";
protected static final String ACTION_PREFIX = "action:";
protected static final String REDIRECT_PREFIX = "redirect:";
protected static final String REDIRECT_ACTION_PREFIX = "redirectAction:";
protected boolean allowDynamicMethodCalls = true;
protected boolean allowSlashesInActionNames = false;
protected boolean alwaysSelectFullNamespace = false;
protected PrefixTrie prefixTrie = null;
protected Pattern allowedActionNames = Pattern.compile("[a-zA-Z0-9._!/\\-]*");
protected List<String> extensions = new ArrayList<String>() {{
add("action");
@@ -261,11 +266,6 @@ public class DefaultActionMapper implements ActionMapper {
this.alwaysSelectFullNamespace = "true".equals(val);
}
@Inject(value = StrutsConstants.STRUTS_ALLOWED_ACTION_NAMES, required = false)
public void setAllowedActionNames(String allowedActionNames) {
this.allowedActionNames = Pattern.compile(allowedActionNames);
}
@Inject
public void setContainer(Container container) {
this.container = container;
@@ -292,16 +292,14 @@ public class DefaultActionMapper implements ActionMapper {
return parseActionName(mapping);
}
public boolean isSlashesInActionNames() {
return allowSlashesInActionNames;
}
/*
* (non-Javadoc)
*
* @see org.apache.struts2.dispatcher.mapper.ActionMapper#getMapping(javax.servlet.http.HttpServletRequest)
*/
public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
public ActionMapping getMapping(HttpServletRequest request,
ConfigurationManager configManager) {
ActionMapping mapping = new ActionMapping();
String uri = getUri(request);
@@ -314,13 +312,21 @@ public class DefaultActionMapper implements ActionMapper {
}
parseNameAndNamespace(uri, mapping, configManager);
handleSpecialParameters(request, mapping);
return parseActionName(mapping);
if (mapping.getName() == null) {
return null;
}
parseActionName(mapping);
return mapping;
}
protected ActionMapping parseActionName(ActionMapping mapping) {
if (mapping.getName() == null) {
return null;
return mapping;
}
if (allowDynamicMethodCalls) {
// handle "name!method" convention.
@@ -342,12 +348,14 @@ public class DefaultActionMapper implements ActionMapper {
* @param request The request
* @param mapping The action mapping
*/
public void handleSpecialParameters(HttpServletRequest request, ActionMapping mapping) {
public void handleSpecialParameters(HttpServletRequest request,
ActionMapping mapping) {
// handle special parameter prefixes.
Set<String> uniqueParameters = new HashSet<String>();
Map parameterMap = request.getParameterMap();
for (Object o : parameterMap.keySet()) {
String key = (String) o;
for (Iterator iterator = parameterMap.keySet().iterator(); iterator
.hasNext();) {
String key = (String) iterator.next();
// Strip off the image button location info, if found
if (key.endsWith(".x") || key.endsWith(".y")) {
@@ -356,7 +364,8 @@ public class DefaultActionMapper implements ActionMapper {
// Ensure a parameter doesn't get processed twice
if (!uniqueParameters.contains(key)) {
ParameterAction parameterAction = (ParameterAction) prefixTrie.get(key);
ParameterAction parameterAction = (ParameterAction) prefixTrie
.get(key);
if (parameterAction != null) {
parameterAction.execute(key, mapping);
uniqueParameters.add(key);
@@ -372,7 +381,8 @@ public class DefaultActionMapper implements ActionMapper {
* @param uri The uri
* @param mapping The action mapping to populate
*/
protected void parseNameAndNamespace(String uri, ActionMapping mapping, ConfigurationManager configManager) {
protected void parseNameAndNamespace(String uri, ActionMapping mapping,
ConfigurationManager configManager) {
String namespace, name;
int lastSlash = uri.lastIndexOf("/");
if (lastSlash == -1) {
@@ -415,7 +425,7 @@ public class DefaultActionMapper implements ActionMapper {
}
}
if (!allowSlashesInActionNames) {
if (!allowSlashesInActionNames && name != null) {
int pos = name.lastIndexOf('/');
if (pos > -1 && pos < name.length() - 1) {
name = name.substring(pos + 1);
@@ -423,32 +433,7 @@ public class DefaultActionMapper implements ActionMapper {
}
mapping.setNamespace(namespace);
mapping.setName(cleanupActionName(name));
}
/**
* Cleans up action name from suspicious characters
*
* @param rawActionName action name extracted from URI
* @return safe action name
*/
protected String cleanupActionName(final String rawActionName) {
if (allowedActionNames.matcher(rawActionName).matches()) {
return rawActionName;
} else {
if (LOG.isWarnEnabled()) {
LOG.warn("Action [#0] does not match allowed action names pattern [#1], cleaning it up!",
rawActionName, allowedActionNames);
}
String cleanActionName = rawActionName;
for(String chunk : allowedActionNames.split(rawActionName)) {
cleanActionName = cleanActionName.replace(chunk, "");
}
if (LOG.isDebugEnabled()) {
LOG.debug("Cleaned action name [#0]", cleanActionName);
}
return cleanActionName;
}
mapping.setName(name);
}
/**
@@ -456,7 +441,7 @@ public class DefaultActionMapper implements ActionMapper {
*
* @param name The action name
* @return The action name without its extension
* @deprecated Since 2.1, use {@link #dropExtension(java.lang.String, org.apache.struts2.dispatcher.mapper.ActionMapping)} instead
* @deprecated Since 2.1, use {@link #dropExtension(java.lang.String,org.apache.struts2.dispatcher.mapper.ActionMapping)} instead
*/
protected String dropExtension(String name) {
return dropExtension(name, new ActionMapping());
@@ -501,7 +486,7 @@ public class DefaultActionMapper implements ActionMapper {
if (extensions == null) {
return null;
} else {
return extensions.get(0);
return (String) extensions.get(0);
}
}
@@ -533,64 +518,29 @@ public class DefaultActionMapper implements ActionMapper {
*
* @see org.apache.struts2.dispatcher.mapper.ActionMapper#getUriFromActionMapping(org.apache.struts2.dispatcher.mapper.ActionMapping)
*/
public String getUriFromActionMapping(ActionMapping mapping) {
StringBuilder uri = new StringBuilder();
handleNamespace(mapping, uri);
handleName(mapping, uri);
handleDynamicMethod(mapping, uri);
handleExtension(mapping, uri);
handleParams(mapping, uri);
return uri.toString();
}
protected void handleNamespace(ActionMapping mapping, StringBuilder uri) {
if (mapping.getNamespace() != null) {
uri.append(mapping.getNamespace());
if (!"/".equals(mapping.getNamespace())) {
uri.append("/");
}
}
}
protected void handleName(ActionMapping mapping, StringBuilder uri) {
String name = mapping.getName();
String params = "";
if (name.indexOf('?') != -1) {
params = name.substring(name.indexOf('?'));
name = name.substring(0, name.indexOf('?'));
}
uri.append(name);
}
protected void handleDynamicMethod(ActionMapping mapping, StringBuilder uri) {
// See WW-3965
if (StringUtils.isNotEmpty(mapping.getMethod())) {
if (allowDynamicMethodCalls) {
// handle "name!method" convention.
String name = mapping.getName();
if (!name.contains("!")) {
// Append the method as no bang found
uri.append("!").append(mapping.getMethod());
}
} else {
uri.append("!").append(mapping.getMethod());
}
if (null != mapping.getMethod() && !"".equals(mapping.getMethod())) {
uri.append("!").append(mapping.getMethod());
}
}
protected void handleExtension(ActionMapping mapping, StringBuilder uri) {
String extension = lookupExtension(mapping.getExtension());
if (extension != null) {
if (extension.length() == 0 || (extension.length() > 0 && uri.indexOf('.' + extension) == -1)) {
if (extension.length() > 0) {
uri.append(".").append(extension);
}
}
}
}
protected String lookupExtension(String extension) {
String extension = mapping.getExtension();
if (extension == null) {
// Look for the current extension, if available
ActionContext context = ActionContext.getContext();
@@ -604,18 +554,24 @@ public class DefaultActionMapper implements ActionMapper {
extension = getDefaultExtension();
}
}
return extension;
}
protected void handleParams(ActionMapping mapping, StringBuilder uri) {
String name = mapping.getName();
String params = "";
if (name.indexOf('?') != -1) {
params = name.substring(name.indexOf('?'));
if (extension != null) {
if (extension.length() == 0 || (extension.length() > 0 && uri.indexOf('.' + extension) == -1)) {
if (extension.length() > 0) {
uri.append(".").append(extension);
}
}
}
if (params.length() > 0) {
uri.append(params);
}
return uri.toString();
}
public boolean isSlashesInActionNames() {
return allowSlashesInActionNames;
}
}
@@ -3,8 +3,8 @@ package org.apache.struts2.dispatcher.mapper;
import com.opensymphony.xwork2.config.ConfigurationManager;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.StrutsConstants;
import javax.servlet.http.HttpServletRequest;
@@ -14,7 +14,7 @@ import java.util.Map;
/**
* <!-- START SNIPPET: description -->
*
*
* A prefix based action mapper that is capable of delegating to other {@link ActionMapper}s based on the request's prefix
*
* It is configured through struts.xml
@@ -37,100 +37,98 @@ import java.util.Map;
*
* @see ActionMapper
* @see ActionMapping
*
*/
public class PrefixBasedActionMapper extends DefaultActionMapper implements ActionMapper {
protected transient final Log log = LogFactory.getLog(getClass());
protected Container container;
protected Map<String,ActionMapper> actionMappers = new HashMap<String,ActionMapper>();
private static final Logger LOG = LoggerFactory.getLogger(PrefixBasedActionMapper.class);
@Inject
public void setContainer(Container container) {
this.container = container;
}
protected Container container;
protected Map<String, ActionMapper> actionMappers = new HashMap<String, ActionMapper>();
@Inject
public void setContainer(Container container) {
this.container = container;
@Inject(StrutsConstants.PREFIX_BASED_MAPPER_CONFIGURATION)
public void setPrefixBasedActionMappers(String list) {
if (list != null) {
String[] mappers = list.split(",");
for (String mapper : mappers) {
String[] thisMapper = mapper.split(":");
if ((thisMapper != null) && (thisMapper.length == 2)) {
String mapperPrefix = thisMapper[0].trim();
String mapperName = thisMapper[1].trim();
Object obj = container.getInstance(ActionMapper.class, mapperName);
if (obj != null) {
actionMappers.put(mapperPrefix, (ActionMapper) obj);
} else if (log.isDebugEnabled()) {
log.debug("invalid PrefixBasedActionMapper config entry: " + mapper);
}
}
}
}
}
@Inject(StrutsConstants.PREFIX_BASED_MAPPER_CONFIGURATION)
public void setPrefixBasedActionMappers(String list) {
if (list != null) {
String[] mappers = list.split(",");
for (String mapper : mappers) {
String[] thisMapper = mapper.split(":");
if ((thisMapper != null) && (thisMapper.length == 2)) {
String mapperPrefix = thisMapper[0].trim();
String mapperName = thisMapper[1].trim();
Object obj = container.getInstance(ActionMapper.class, mapperName);
if (obj != null) {
actionMappers.put(mapperPrefix, (ActionMapper) obj);
} else if (LOG.isDebugEnabled()) {
LOG.debug("invalid PrefixBasedActionMapper config entry: [#0]", mapper);
}
@SuppressWarnings("unchecked")
public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
String uri = getUri(request);
for (int lastIndex = uri.lastIndexOf('/'); lastIndex > (-1); lastIndex = uri.lastIndexOf('/', lastIndex-1)) {
ActionMapper actionMapper = actionMappers.get(uri.substring(0,lastIndex));
if (actionMapper != null) {
ActionMapping actionMapping = actionMapper.getMapping(request, configManager);
if (log.isDebugEnabled()) {
log.debug("Using ActionMapper "+actionMapper);
}
if (actionMapping != null) {
if (log.isDebugEnabled()) {
if (actionMapping.getParams() != null) {
log.debug("ActionMapper found mapping. Parameters: "+actionMapping.getParams());
for (Map.Entry<String,Object> mappingParameterEntry : ((Map<String,Object>)(actionMapping.getParams())).entrySet()) {
Object paramValue = mappingParameterEntry.getValue();
if (paramValue == null) {
log.debug(mappingParameterEntry.getKey()+" : null!");
} else if (paramValue instanceof String[]) {
log.debug(mappingParameterEntry.getKey()+" : (String[]) "+Arrays.toString((String[])paramValue));
} else if (paramValue instanceof String) {
log.debug(mappingParameterEntry.getKey()+" : (String) "+(String)paramValue);
} else {
log.debug(mappingParameterEntry.getKey()+" : (Object) "+(paramValue.toString()));
}
}
}
}
return actionMapping;
} else if (log.isDebugEnabled()) {
log.debug("ActionMapper "+actionMapper+" failed to return an ActionMapping");
}
}
}
@SuppressWarnings("unchecked")
public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
String uri = getUri(request);
for (int lastIndex = uri.lastIndexOf('/'); lastIndex > (-1); lastIndex = uri.lastIndexOf('/', lastIndex - 1)) {
ActionMapper actionMapper = actionMappers.get(uri.substring(0, lastIndex));
if (actionMapper != null) {
ActionMapping actionMapping = actionMapper.getMapping(request, configManager);
if (LOG.isDebugEnabled()) {
LOG.debug("Using ActionMapper [#0]", actionMapper.toString());
}
if (actionMapping != null) {
if (LOG.isDebugEnabled()) {
if (actionMapping.getParams() != null) {
LOG.debug("ActionMapper found mapping. Parameters: [#0]", actionMapping.getParams().toString());
for (Map.Entry<String, Object> mappingParameterEntry : actionMapping.getParams().entrySet()) {
Object paramValue = mappingParameterEntry.getValue();
if (paramValue == null) {
LOG.debug("[#0] : null!", mappingParameterEntry.getKey());
} else if (paramValue instanceof String[]) {
LOG.debug("[#0] : (String[]) #1", mappingParameterEntry.getKey(), Arrays.toString((String[]) paramValue));
} else if (paramValue instanceof String) {
LOG.debug("[#0] : (String) [#1]", mappingParameterEntry.getKey(), paramValue.toString());
} else {
LOG.debug("[#0] : (Object) [#1]", mappingParameterEntry.getKey(), paramValue.toString());
}
}
}
}
return actionMapping;
} else if (LOG.isDebugEnabled()) {
LOG.debug("ActionMapper [#0] failed to return an ActionMapping", actionMapper.toString());
}
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("No ActionMapper found");
}
return null;
if (log.isDebugEnabled()) {
log.debug("no ActionMapper found");
}
return null;
}
public String getUriFromActionMapping(ActionMapping mapping) {
String namespace = mapping.getNamespace();
for (int lastIndex = namespace.length(); lastIndex > (-1); lastIndex = namespace.lastIndexOf('/', lastIndex - 1)) {
ActionMapper actionMapper = actionMappers.get(namespace.substring(0, lastIndex));
if (actionMapper != null) {
String uri = actionMapper.getUriFromActionMapping(mapping);
if (LOG.isDebugEnabled()) {
LOG.debug("Using ActionMapper [#0]", actionMapper.toString());
}
if (uri != null) {
return uri;
} else if (LOG.isDebugEnabled()) {
LOG.debug("ActionMapper [#0] failed to return an ActionMapping (null)", actionMapper.toString());
}
}
public String getUriFromActionMapping(ActionMapping mapping) {
String namespace = mapping.getNamespace();
for (int lastIndex = namespace.length(); lastIndex > (-1); lastIndex = namespace.lastIndexOf('/', lastIndex-1)) {
ActionMapper actionMapper = actionMappers.get(namespace.substring(0,lastIndex));
if (actionMapper != null) {
String uri = actionMapper.getUriFromActionMapping(mapping);
if (log.isDebugEnabled()) {
log.debug("Using ActionMapper "+actionMapper);
}
if (LOG.isDebugEnabled()) {
LOG.debug("ActionMapper failed to return a uri");
if (uri != null) {
return uri;
} else if (log.isDebugEnabled()) {
log.debug("ActionMapper "+actionMapper+" failed to return an ActionMapping (null)");
}
return null;
}
}
if (log.isDebugEnabled()) {
log.debug("ActionMapper failed to return a uri");
}
return null;
}
}
@@ -21,20 +21,77 @@
package org.apache.struts2.dispatcher.mapper;
import com.opensymphony.xwork2.config.ConfigurationManager;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.StrutsConstants;
import javax.servlet.http.HttpServletRequest;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.StringTokenizer;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.StrutsConstants;
import com.opensymphony.xwork2.config.ConfigurationManager;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
/**
* Extended version of {@link RestfulActionMapper}, see documentation for more details
* http://struts.apache.org/2.x/docs/restfulactionmapper.html
* <!-- START SNIPPET: description -->
*
* Improved restful action mapper that adds several ReST-style improvements to
* action mapping, but supports fully-customized URL's via XML. The two primary
* ReST enhancements are:
* <ul>
* <li>If the method is not specified (via '!' or 'method:' prefix), the method is
* "guessed" at using ReST-style conventions that examine the URL and the HTTP
* method.</li>
* <li>Parameters are extracted from the action name, if parameter name/value pairs
* are specified using PARAM_NAME/PARAM_VALUE syntax.
* </ul>
* <p>
* These two improvements allow a GET request for 'category/action/movie/Thrillers' to
* be mapped to the action name 'movie' with an id of 'Thrillers' with an extra parameter
* named 'category' with a value of 'action'. A single action mapping can then handle
* all CRUD operations using wildcards, e.g.
* </p>
* <pre>
* &lt;action name="movie/*" className="app.MovieAction"&gt;
* &lt;param name="id"&gt;{0}&lt;/param&gt;
* ...
* &lt;/action&gt;
* </pre>
* <p>
* This mapper supports the following parameters:
* </p>
* <ul>
* <li><code>struts.mapper.idParameterName</code> - If set, this value will be the name
* of the parameter under which the id is stored. The id will then be removed
* from the action name. This allows restful actions to not require wildcards.
* </li>
* </ul>
* <p>
* The following URL's will invoke its methods:
* </p>
* <ul>
* <li><code>GET: /movie/ => method="index"</code></li>
* <li><code>GET: /movie/Thrillers => method="view", id="Thrillers"</code></li>
* <li><code>GET: /movie/Thrillers!edit => method="edit", id="Thrillers"</code></li>
* <li><code>GET: /movie/new => method="editNew"</code></li>
* <li><code>POST: /movie/ => method="create"</code></li>
* <li><code>PUT: /movie/Thrillers => method="update", id="Thrillers"</code></li>
* <li><code>DELETE: /movie/Thrillers => method="remove", id="Thrillers"</code></li>
* </ul>
* <p>
* To simulate the HTTP methods PUT and DELETE, since they aren't supported by HTML,
* the HTTP parameter "__http_method" will be used.
* </p>
* <p>
* The syntax and design for this feature was inspired by the ReST support in Ruby on Rails.
* See <a href="http://ryandaigle.com/articles/2006/08/01/whats-new-in-edge-rails-simply-restful-support-and-how-to-use-it">
* http://ryandaigle.com/articles/2006/08/01/whats-new-in-edge-rails-simply-restful-support-and-how-to-use-it
* </a>
* </p>
*
* <!-- END SNIPPET: description -->
*/
public class Restful2ActionMapper extends DefaultActionMapper {
@@ -45,6 +102,7 @@ public class Restful2ActionMapper extends DefaultActionMapper {
public Restful2ActionMapper() {
setSlashesInActionNames("true");
}
/*
* (non-Javadoc)
@@ -21,21 +21,47 @@
package org.apache.struts2.dispatcher.mapper;
import com.opensymphony.xwork2.config.ConfigurationManager;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.RequestUtils;
import javax.servlet.http.HttpServletRequest;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.StringTokenizer;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.RequestUtils;
import com.opensymphony.xwork2.config.ConfigurationManager;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
/**
* Simple Restfull Action Mapper to support REST application
* See docs for more information
* http://struts.apache.org/2.x/docs/restfulactionmapper.html
* <!-- START SNIPPET: description -->
*
* A custom action mapper using the following format:
* <p/>
* <p/>
* <ul><tt>http://HOST/ACTION_NAME/PARAM_NAME1/PARAM_VALUE1/PARAM_NAME2/PARAM_VALUE2</tt></ul>
* <p/>
* You can have as many parameters you'd like to use. Alternatively the URL can be shortened to the following:
* <p/>
* <ul><tt>http://HOST/ACTION_NAME/PARAM_VALUE1/PARAM_NAME2/PARAM_VALUE2</tt></ul>
* <p/>
* This is the same as:
* <p/>
* <ul><tt>http://HOST/ACTION_NAME/ACTION_NAME + "Id"/PARAM_VALUE1/PARAM_NAME2/PARAM_VALUE2</tt></ul>
* <p/>
* Suppose for example we would like to display some articles by id at using the following URL sheme:
* <p/>
* <ul><tt>http://HOST/article/Id</tt></ul>
* <p/>
* <p/>
* Your action just needs a setArticleId() method, and requests such as /article/1, /article/2, etc will all map
* to that URL pattern.
*
* <!-- END SNIPPET: description -->
*
*/
public class RestfulActionMapper implements ActionMapper {
protected static final Logger LOG = LoggerFactory.getLogger(RestfulActionMapper.class);
@@ -133,7 +133,8 @@ public class PrepareOperations {
// parameters might not be accessible through before encoding (ww-1278)
request = dispatcher.wrapRequest(request, servletContext);
} catch (IOException e) {
throw new ServletException("Could not wrap servlet request with MultipartRequestWrapper!", e);
String message = "Could not wrap servlet request with MultipartRequestWrapper!";
throw new ServletException(message, e);
}
return request;
}
@@ -22,17 +22,12 @@ package org.apache.struts2.dispatcher.ng.filter;
import org.apache.struts2.StrutsStatics;
import org.apache.struts2.dispatcher.Dispatcher;
import org.apache.struts2.dispatcher.mapper.ActionMapping;
import org.apache.struts2.dispatcher.ng.PrepareOperations;
import org.apache.struts2.dispatcher.ng.ExecuteOperations;
import org.apache.struts2.dispatcher.ng.InitOperations;
import org.apache.struts2.dispatcher.ng.PrepareOperations;
import org.apache.struts2.dispatcher.mapper.ActionMapping;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@@ -68,15 +63,15 @@ public class StrutsExecuteFilter implements StrutsStatics, Filter {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
if (excludeUrl(request)) {
chain.doFilter(request, response);
return;
}
if (excludeUrl(request)) {
chain.doFilter(request, response);
return;
}
// This is necessary since we need the dispatcher instance, which was created by the prepare filter
if (execute == null) {
lazyInit();
}
if (execute == null) {
lazyInit();
}
ActionMapping mapping = prepare.findActionMapping(request, response);
@@ -94,14 +89,13 @@ public class StrutsExecuteFilter implements StrutsStatics, Filter {
}
}
private boolean excludeUrl(HttpServletRequest request) {
return request.getAttribute(StrutsPrepareFilter.REQUEST_EXCLUDED_FROM_ACTION_MAPPING) != null;
}
private boolean excludeUrl(HttpServletRequest request) {
return request.getAttribute(StrutsPrepareFilter.REQUEST_EXCLUDED_FROM_ACTION_MAPPING) != null;
}
public void destroy() {
prepare = null;
execute = null;
filterConfig = null;
}
}

Some files were not shown because too many files have changed in this diff Show More