Compare commits

..

2 Commits

Author SHA1 Message Date
René Gielen 676a011b4f Fixed ignores
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4@1368890 13f79535-47bb-0310-9956-ffa450edef68
2012-08-03 11:15:11 +00:00
Lukasz Lenart 954c21481f [maven-release-plugin] copy for tag STRUTS_2_3_4
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4@1337582 13f79535-47bb-0310-9956-ffa450edef68
2012-05-12 16:06:38 +00:00
255 changed files with 1692 additions and 4596 deletions
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-blank</artifactId>
@@ -34,9 +34,9 @@
<name>Blank Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/apps/blank</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps/blank</url>
</scm>
<dependencies>
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jboss-blank</artifactId>
@@ -34,9 +34,9 @@
<name>JBoss Blank Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/jboss-blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/jboss-blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/apps/jboss-blank</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/jboss-blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/jboss-blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps/jboss-blank</url>
</scm>
<dependencies>
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-mailreader</artifactId>
@@ -34,9 +34,9 @@
<name>Mail Reader Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/mailreader</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/mailreader</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/apps/mailreader</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/mailreader</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/mailreader</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps/mailreader</url>
</scm>
<dependencies>
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.5</version>
<version>2.3.4</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_5/apps</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/apps</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps</url>
</scm>
<profiles>
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-portlet</artifactId>
@@ -34,9 +34,9 @@
<name>Portlet Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/portlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/portlet</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/apps/portlet</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/portlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/portlet</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps/portlet</url>
</scm>
<profiles>
+2 -2
View File
@@ -26,13 +26,13 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-rest-showcase</artifactId>
<packaging>war</packaging>
<version>2.3.5</version>
<version>2.3.4</version>
<name>Struts 2 Rest Showcase Example</name>
<description>Struts 2 Rest Showcase Example</description>
@@ -1,4 +1,4 @@
package org.demo.rest.example;
package org.apache.struts2.rest.example;
public class Order {
String id;
@@ -1,11 +1,16 @@
package org.demo.rest.example;
package org.apache.struts2.rest.example;
import java.util.Collection;
import org.apache.struts2.dispatcher.ServletActionRedirectResult;
import org.apache.struts2.rest.DefaultHttpHeaders;
import org.apache.struts2.rest.HttpHeaders;
import org.apache.struts2.convention.annotation.Results;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Namespaces;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.InterceptorRef;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Validateable;
@@ -1,4 +1,4 @@
package org.demo.rest.example;
package org.apache.struts2.rest.example;
import java.util.*;
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-showcase</artifactId>
@@ -34,9 +34,9 @@
<name>Showcase Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/showcase</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/apps/showcase</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/apps/showcase</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/showcase</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/showcase</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps/showcase</url>
</scm>
@@ -26,7 +26,12 @@ import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.ServletActionContext;
import java.io.File;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*/
@@ -62,9 +67,9 @@ public class UITagExample extends ActionSupport implements Validateable {
String thoughts;
public UITagExample() {
favouriteLanguages.add(new Language("EnglishKey", "English Language", "color: blue; font-style: italic;"));
favouriteLanguages.add(new Language("FrenchKey", "French Language", "color: grey;"));
favouriteLanguages.add(new Language("SpanishKey", "Spanish Language", "color: red; font-wight: bold;"));
favouriteLanguages.add(new Language("EnglishKey", "English Language"));
favouriteLanguages.add(new Language("FrenchKey", "French Language"));
favouriteLanguages.add(new Language("SpanishKey", "Spanish Language"));
VehicalType car = new VehicalType("CarKey", "Car");
VehicalType motorcycle = new VehicalType("MotorcycleKey", "Motorcycle");
@@ -263,12 +268,10 @@ public class UITagExample extends ActionSupport implements Validateable {
public static class Language {
String description;
String key;
String style;
public Language(String key, String description, String style) {
public Language(String key, String description) {
this.key = key;
this.description = description;
this.style = style;
}
public String getKey() {
@@ -277,9 +280,6 @@ public class UITagExample extends ActionSupport implements Validateable {
public String getDescription() {
return description;
}
public String getStyle() {
return style;
}
}
@@ -20,8 +20,6 @@
*/
package org.apache.struts2.showcase.model;
import org.apache.commons.lang3.StringEscapeUtils;
import java.io.Serializable;
/**
@@ -49,7 +47,7 @@ public class Skill implements IdEntity {
}
public void setName(String name) {
this.name = StringEscapeUtils.escapeEcmaScript(StringEscapeUtils.escapeHtml4(name));
this.name = name;
}
public String getDescription() {
@@ -57,7 +55,7 @@ public class Skill implements IdEntity {
}
public void setDescription(String description) {
this.description = StringEscapeUtils.escapeEcmaScript(StringEscapeUtils.escapeHtml4(description));
this.description = description;
}
public Serializable getId() {
@@ -24,7 +24,7 @@ log4j.logger.noModule=FATAL
# OpenSymphony Stuff
log4j.logger.com.opensymphony=INFO
log4j.logger.org.apache.struts2=INFO
log4j.logger.org.apache.struts2=DEBUG
# Spring Stuff
log4j.logger.org.springframework=INFO
@@ -23,6 +23,10 @@
For more "by example" solutions,
see the <a href="http://struts.apache.org/2.x/docs/cookbook.html">Struts Cookbook</a> pages.
</li>
<li>
For a "best practices" example, see the
<a href="http://planetstruts.org/struts2-mailreader/">MailReader application</a> Tour and source code.
</li>
</ul>
</blockquote>
<p>
@@ -55,7 +55,6 @@
name="favouriteLanguage"
listKey="key"
listValue="description"
listCssStyle="style"
emptyOption="true"
headerKey="None"
headerValue="None"/>
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.5</version>
<version>2.3.4</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_5/archetypes</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes</url>
</scm>
<modules>
+5 -5
View File
@@ -3,19 +3,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-blank</artifactId>
<version>2.3.5</version>
<version>2.3.4</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_5/archetypes/struts2-archetype-blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-blank</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-blank</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-blank</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-blank</url>
</scm>
<properties>
@@ -62,7 +62,7 @@ public class ConfigTest extends StrutsTestCase {
protected void setUp() throws Exception {
super.setUp();
XmlConfigurationProvider c = new XmlConfigurationProvider("struts.xml");
configurationManager.addContainerProvider(c);
configurationManager.addConfigurationProvider(c);
configurationManager.reload();
}
@@ -2,19 +2,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-convention</artifactId>
<version>2.3.5</version>
<version>2.3.4</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_5/archetypes/struts2-archetype-convention</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-convention</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-convention</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-convention</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-convention</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/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>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/webapp</directory>
<includes>
@@ -2,19 +2,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-dbportlet</artifactId>
<version>2.3.5</version>
<version>2.3.4</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_5/archetypes/struts2-archetype-dbportlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-dbportlet</developerConnection>
<url>svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-dbportlet</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-dbportlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-dbportlet</developerConnection>
<url>svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-dbportlet</url>
</scm>
<properties>
@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor name="struts2-archetype-dbportlet">
<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="false">
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/webapp</directory>
<includes>
<include>**/*.jsp</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="false">
<directory>src/main/webapp/WEB-INF</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>
+5 -5
View File
@@ -2,19 +2,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-plugin</artifactId>
<version>2.3.5</version>
<version>2.3.4</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_5/archetypes/struts2-archetype-plugin</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-plugin</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-plugin</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-plugin</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-plugin</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-plugin</url>
</scm>
<properties>
@@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor name="struts2-archetype-plugin">
<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="false">
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/webapp</directory>
<includes>
<include>**/*.jsp</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="false">
<directory>src/main</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.txt</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>
+5 -5
View File
@@ -2,19 +2,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-portlet</artifactId>
<version>2.3.5</version>
<version>2.3.4</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_5/archetypes/struts2-archetype-portlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-portlet</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-portlet</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-portlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-portlet</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-portlet</url>
</scm>
<properties>
@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor name="struts2-archetype-portlet">
<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="false">
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/webapp</directory>
<includes>
<include>**/*.jsp</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="false">
<directory>src/main/webapp/WEB-INF</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>
+5 -5
View File
@@ -4,19 +4,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-archetypes</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-starter</artifactId>
<version>2.3.5</version>
<version>2.3.4</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_5/archetypes/struts2-archetype-starter</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-starter</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/archetypes/struts2-archetype-starter</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-starter</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-starter</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/archetypes/struts2-archetype-starter</url>
</scm>
<properties>
@@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor name="struts2-archetype-starter">
<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>**/*.properties</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/webapp</directory>
<includes>
<include>**/*.jsp</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>src/main/webapp</directory>
<includes>
<include>**/*.MF</include>
<include>**/*.js</include>
<include>**/*.css</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="false">
<directory>src/main/webapp/WEB-INF</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>
+4 -4
View File
@@ -11,13 +11,13 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/assembly</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/assembly</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/assembly</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/assembly</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/assembly</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/assembly</url>
</scm>
<profiles>
+4 -4
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-bundles</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-admin-bundle</artifactId>
@@ -12,9 +12,9 @@
<name>Struts 2 OSGi Admin Bundle</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/bundles/admin</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/bundles/admin</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/bundles/admin</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/bundles/admin</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/bundles/admin</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/bundles/admin</url>
</scm>
<dependencies>
+4 -4
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-bundles</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-demo-bundle</artifactId>
@@ -12,9 +12,9 @@
<name>Struts 2 OSGi Demo Bundle</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/bundles/demo</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/bundles/demo</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/bundles/demo</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/bundles/demo</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/bundles/demo</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/bundles/demo</url>
</scm>
<dependencies>
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-osgi-bundles</artifactId>
@@ -34,9 +34,9 @@
<name>Struts OSGi Bundles</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/bundles</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/bundles</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/bundles</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/bundles</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/bundles</developerConnection>
<url>http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/bundles</url>
</scm>
<modules>
+4 -4
View File
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.5</version>
<version>2.3.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
@@ -34,9 +34,9 @@
<name>Struts 2 Core</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/core</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_5/core</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_5/core</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/core</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/core</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/core</url>
</scm>
<properties>
@@ -65,10 +65,7 @@ public final class StrutsConstants {
public static final String STRUTS_OBJECTFACTORY = "struts.objectFactory";
/** The com.opensymphony.xwork2.util.FileManager implementation class */
public static final String STRUTS_FILE_MANAGER_FACTORY = "struts.fileManagerFactory";
/** The com.opensymphony.xwork2.util.fs.FileManager implementation class */
public static final String STRUTS_FILE_MANAGER = "struts.fileManager";
public static final String STRUTS_FILEMANAGER = "struts.fileManager";
/** The com.opensymphony.xwork2.util.ObjectTypeDeterminer implementation class */
public static final String STRUTS_OBJECTTYPEDETERMINER = "struts.objectTypeDeterminer";
@@ -194,9 +191,6 @@ public final class StrutsConstants {
/** XWork default text provider */
public static final String STRUTS_XWORKTEXTPROVIDER = "struts.xworkTextProvider";
/** The {@link com.opensymphony.xwork2.LocaleProvider} implementation class */
public static final String STRUTS_LOCALE_PROVIDER = "struts.localeProvider";
/** The name of the parameter to create when mapping an id (used by some action mappers) */
public static final String STRUTS_ID_PARAMETER_NAME = "struts.mapper.idParameterName";
@@ -236,14 +230,4 @@ public final class StrutsConstants {
/** The{@link org.apache.struts2.views.util.UrlHelper} implementation class **/
public static final String STRUTS_URL_HELPER = "struts.view.urlHelper";
/** {@link com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter} **/
public static final String STRUTS_CONVERTER_COLLECTION = "struts.converter.collection";
public static final String STRUTS_CONVERTER_ARRAY = "struts.converter.array";
public static final String STRUTS_CONVERTER_DATE = "struts.converter.date";
public static final String STRUTS_CONVERTER_NUMBER = "struts.converter.number";
public static final String STRUTS_CONVERTER_STRING = "struts.converter.string";
/** Enable handling exceptions by Dispatcher - true by default **/
public static final String STRUTS_HANDLE_EXCEPTION = "struts.handle.exception";
}
@@ -28,9 +28,9 @@ import org.apache.struts2.StrutsConstants;
import org.apache.struts2.StrutsException;
import org.apache.struts2.dispatcher.mapper.ActionMapper;
import org.apache.struts2.dispatcher.mapper.ActionMapping;
import org.apache.struts2.util.ComponentUtils;
import org.apache.struts2.util.FastByteArrayOutputStream;
import org.apache.struts2.views.jsp.TagUtils;
import org.apache.struts2.views.util.ContextUtil;
import org.apache.struts2.views.util.UrlHelper;
import javax.servlet.http.HttpServletRequest;
@@ -265,7 +265,35 @@ public class Component {
* the parameter expression is returned as is.
*/
protected String stripExpressionIfAltSyntax(String expr) {
return ComponentUtils.stripExpressionIfAltSyntax(stack, expr);
return stripExpressionIfAltSyntax(stack, expr);
}
/**
* If altsyntax (%{...}) is applied, simply strip the "%{" and "}" off.
* @param stack the ValueStack where the context value is searched for.
* @param expr the expression (must be not null)
* @return the stripped expression if altSyntax is enabled. Otherwise
* the parameter expression is returned as is.
*/
public static String stripExpressionIfAltSyntax(ValueStack stack, String expr) {
if (altSyntax(stack)) {
// does the expression start with %{ and end with }? if so, just cut it off!
if (expr.startsWith("%{") && expr.endsWith("}")) {
return expr.substring(2, expr.length() - 1);
}
}
return expr;
}
/**
* Is the altSyntax enabled? [TRUE]
* <p/>
* @param stack the ValueStack where the context value is searched for.
* @return true if altSyntax is activated. False otherwise.
* See <code>struts.properties</code> where the altSyntax flag is defined.
*/
public static boolean altSyntax(ValueStack stack) {
return ContextUtil.isUseAltSyntax(stack.getContext());
}
/**
@@ -274,7 +302,7 @@ public class Component {
* See <code>struts.properties</code> where the altSyntax flag is defined.
*/
public boolean altSyntax() {
return ComponentUtils.altSyntax(stack);
return altSyntax(stack);
}
/**
@@ -483,11 +511,10 @@ public class Component {
}
/**
* Overwrite to set if body should be used.
* Overwrite to set if body shold be used.
* @return always false for this component.
*/
public boolean usesBody() {
return false;
}
}
@@ -21,12 +21,14 @@
package org.apache.struts2.components;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import com.opensymphony.xwork2.util.ValueStack;
/**
* DoubleListUIBean is the standard superclass of all Struts double list handling components.
@@ -53,9 +55,6 @@ public abstract class DoubleListUIBean extends ListUIBean {
protected String doubleList;
protected String doubleListKey;
protected String doubleListValue;
protected String doubleListCssClass;
protected String doubleListCssStyle;
protected String doubleListTitle;
protected String doubleName;
protected String doubleValue;
protected String formName;
@@ -150,15 +149,6 @@ public abstract class DoubleListUIBean extends ListUIBean {
}else if (tmpDoubleList instanceof Map) {
addParameter("doubleListValue", "value");
}
if (doubleListCssClass != null) {
addParameter("doubleListCssClass", findString(doubleListCssClass));
}
if (doubleListCssStyle!= null) {
addParameter("doubleListCssStyle", findString(doubleListCssStyle));
}
if (doubleListTitle != null) {
addParameter("doubleListTitle", findString(doubleListTitle));
}
if (formName != null) {
@@ -286,21 +276,6 @@ public abstract class DoubleListUIBean extends ListUIBean {
this.doubleListValue = doubleListValue;
}
@StrutsTagAttribute(description = "Property of second list objects to get css class from")
public void setDoubleListCssClass(String doubleListCssClass) {
this.doubleListCssClass = doubleListCssClass;
}
@StrutsTagAttribute(description = "Property of second list objects to get css style from")
public void setDoubleListCssStyle(String doubleListCssStyle) {
this.doubleListCssStyle = doubleListCssStyle;
}
@StrutsTagAttribute(description = "Property of second list objects to get title from")
public void setDoubleListTitle(String doubleListTitle) {
this.doubleListTitle = doubleListTitle;
}
@StrutsTagAttribute(description="The name for complete component", required=true)
public void setDoubleName(String doubleName) {
this.doubleName = doubleName;
@@ -21,14 +21,15 @@
package org.apache.struts2.components;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.views.annotations.StrutsTag;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.StrutsConstants;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ValueStack;
/**
* <!-- START SNIPPET: javadoc -->
*
@@ -47,11 +48,8 @@ import javax.servlet.http.HttpServletResponse;
* </pre>
*
*/
@StrutsTag(name="head",
tldBodyContent="empty",
tldTagClass="org.apache.struts2.views.jsp.ui.HeadTag",
description="Render a chunk of HEAD for your HTML file",
allowDynamicAttributes = true)
@StrutsTag(name="head", tldBodyContent="empty", tldTagClass="org.apache.struts2.views.jsp.ui.HeadTag",
description="Render a chunk of HEAD for your HTML file")
public class Head extends UIBean {
public static final String TEMPLATE = "head";
@@ -21,37 +21,37 @@
package org.apache.struts2.components;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.util.ContainUtil;
import org.apache.struts2.util.MakeIterator;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import org.apache.struts2.util.ContainUtil;
import org.apache.struts2.util.MakeIterator;
import com.opensymphony.xwork2.util.ValueStack;
/**
* DoubleListUIBean is the standard superclass of all Struts list handling components.
*
* <p/>
* <p/>
* <p/>
*
* <!-- START SNIPPET: javadoc -->
* <p/>
*
* Note that the listkey and listvalue attribute will default to "key" and "value"
* respectively only when the list attribute is evaluated to a Map or its decendant.
* Everything else will result in listkey and listvalue to be null and not used.
* <p/>
*
* <!-- END SNIPPET: javadoc -->
*
*/
public abstract class ListUIBean extends UIBean {
protected Object list;
protected String listKey;
protected String listValue;
protected String listCssClass;
protected String listCssStyle;
protected String listTitle;
// indicate if an exception is to be thrown when value attribute is null
protected boolean throwExceptionOnNullValueAttribute = false;
@@ -78,12 +78,13 @@ public abstract class ListUIBean extends UIBean {
if (throwExceptionOnNullValueAttribute) {
// will throw an exception if not found
value = findValue((list == null) ? (String) list : list.toString(), "list",
"The requested list key '" + list + "' could not be resolved as a collection/array/map/enumeration/iterator type. " +
"Example: people or people.{name}");
} else {
"The requested list key '" + list + "' could not be resolved as a collection/array/map/enumeration/iterator type. " +
"Example: people or people.{name}");
}
else {
// ww-1010, allows value with null value to be compatible with ww
// 2.1.7 behaviour
value = findValue((list == null) ? (String) list : list.toString());
value = findValue((list == null)?(String) list:list.toString());
}
}
@@ -102,30 +103,18 @@ public abstract class ListUIBean extends UIBean {
}
if (listKey != null) {
listKey = stripExpressionIfAltSyntax(listKey);
listKey = stripExpressionIfAltSyntax(listKey);
addParameter("listKey", listKey);
} else if (value instanceof Map) {
addParameter("listKey", "key");
}
if (listValue != null) {
listValue = stripExpressionIfAltSyntax(listValue);
listValue = stripExpressionIfAltSyntax(listValue);
addParameter("listValue", listValue);
} else if (value instanceof Map) {
addParameter("listValue", "value");
}
if (listCssClass != null && listCssClass.trim().length() > 0) {
addParameter("listCssClass", listCssClass);
}
if (listCssStyle != null && listCssStyle.trim().length() > 0) {
addParameter("listCssStyle", listCssStyle);
}
if (listTitle != null && listTitle.trim().length() > 0) {
addParameter("listTitle", listTitle);
}
}
public boolean contains(Object obj1, Object obj2) {
@@ -136,37 +125,22 @@ public abstract class ListUIBean extends UIBean {
return null; // don't convert nameValue to anything, we need the raw value
}
@StrutsTagAttribute(description = "Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value'" +
" parameter and the Map value will become the option body.", required = true)
@StrutsTagAttribute(description="Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value'" +
" parameter and the Map value will become the option body.", required=true)
public void setList(Object list) {
this.list = list;
}
@StrutsTagAttribute(description = " Property of list objects to get field value from")
@StrutsTagAttribute(description=" Property of list objects to get field value from")
public void setListKey(String listKey) {
this.listKey = listKey;
}
@StrutsTagAttribute(description = "Property of list objects to get field content from")
@StrutsTagAttribute(description="Property of list objects to get field content from")
public void setListValue(String listValue) {
this.listValue = listValue;
}
@StrutsTagAttribute(description = "Property of list objects to get css class from")
public void setListCssClass(String listCssClass) {
this.listCssClass = listCssClass;
}
@StrutsTagAttribute(description = "Property of list objects to get css style from")
public void setListCssStyle(String listCssStyle) {
this.listCssStyle = listCssStyle;
}
@StrutsTagAttribute(description = "Property of list objects to get title from")
public void setListTitle(String listTitle) {
this.listTitle = listTitle;
}
public void setThrowExceptionOnNullValueAttribute(boolean throwExceptionOnNullValueAttribute) {
this.throwExceptionOnNullValueAttribute = throwExceptionOnNullValueAttribute;
@@ -21,16 +21,18 @@
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.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.struts2.views.annotations.StrutsTag;
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;
/**
* <!-- START SNIPPET: javadoc -->
@@ -49,7 +51,7 @@ import java.util.Map;
*
* NOTE: The id and doubleId need not be supplied as they will generated provided
* that the optiontransferselect tag is being used in a form tag. The generated id
* and doubleId will be &lt;form_id&gt;_&lt;optiontransferselect_nameame&gt; and
* and doubleId will be &lt;form_id&gt;_&lt;optiontransferselect_doubleName&gt; and
* &lt;form_id&gt;_&lt;optiontransferselect_doubleName&gt; respectively.
*
* <!-- END SNIPPET: notice -->
@@ -21,12 +21,13 @@
package org.apache.struts2.components;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.views.annotations.StrutsTag;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.views.annotations.StrutsTag;
import com.opensymphony.xwork2.util.ValueStack;
/**
* <!-- START SNIPPET: javadoc -->
* Render a radio button input field.</p>
@@ -46,16 +47,10 @@ import javax.servlet.http.HttpServletResponse;
* &lt;s:action name="GenderMap" var="genders"/&gt;
* &lt;s:radio label="Gender" name="male" list="#genders.genders"/&gt;
* <!-- END SNIPPET: example -->
*
* <!-- START SNIPPET: example_fmt -->
* &lt;@s.radio name="car" list={"ford": "Ford Motor Co", "toyota": "Toyota"} listKey="key" listValue="value" /&gt;
* <!-- END SNIPPET: example_fmt -->
* </pre>
*
*/
@StrutsTag(name="radio",
tldTagClass="org.apache.struts2.views.jsp.ui.RadioTag",
description="Renders a radio button input field",
allowDynamicAttributes = true)
@StrutsTag(name="radio", tldTagClass="org.apache.struts2.views.jsp.ui.RadioTag", description="Renders a radio button input field")
public class Radio extends ListUIBean {
final public static String TEMPLATE = "radiomap";
@@ -145,13 +145,6 @@ public class ServletUrlRenderer implements UrlRenderer {
}
}
Map actionParams = null;
if (action != null && action.indexOf("?") > 0) {
String queryString = action.substring(action.indexOf("?") + 1);
actionParams = urlHelper.parseQueryString(queryString, false);
action = action.substring(0, action.indexOf("?"));
}
ActionMapping nameMapping = actionMapper.getMappingFromActionName(action);
String actionName = nameMapping.getName();
String actionMethod = nameMapping.getMethod();
@@ -162,7 +155,7 @@ public class ServletUrlRenderer implements UrlRenderer {
ActionMapping mapping = new ActionMapping(actionName, namespace, actionMethod, formComponent.parameters);
String result = urlHelper.buildUrl(formComponent.actionMapper.getUriFromActionMapping(mapping),
formComponent.request, formComponent.response, actionParams, null, formComponent.includeContext, true);
formComponent.request, formComponent.response, null, null, formComponent.includeContext, true);
formComponent.addParameter("action", result);
// let's try to get the actual action class and name
@@ -21,12 +21,13 @@
package org.apache.struts2.components;
import com.opensymphony.xwork2.util.ValueStack;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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 com.opensymphony.xwork2.util.ValueStack;
/**
* <!-- START SNIPPET: javadoc -->
@@ -66,7 +67,6 @@ public class TextField extends UIBean {
protected String maxlength;
protected String readonly;
protected String size;
protected String type;
public TextField(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
super(stack, request, response);
@@ -90,11 +90,6 @@ public class TextField extends UIBean {
if (readonly != null) {
addParameter("readonly", findValue(readonly, Boolean.class));
}
if (type != null) {
addParameter("type", findString(type));
}
}
@StrutsTagAttribute(description="HTML maxlength attribute", type="Integer")
@@ -116,9 +111,4 @@ public class TextField extends UIBean {
public void setSize(String size) {
this.size = size;
}
@StrutsTagAttribute(description="Specifies the html5 type element to display. e.g. text, email, url", defaultValue="text")
public void setType(String type) {
this.type = type;
}
}
@@ -23,21 +23,13 @@ package org.apache.struts2.config;
import com.opensymphony.xwork2.ActionProxyFactory;
import com.opensymphony.xwork2.FileManager;
import com.opensymphony.xwork2.FileManagerFactory;
import com.opensymphony.xwork2.LocaleProvider;
import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.TextProvider;
import com.opensymphony.xwork2.UnknownHandlerManager;
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.ObjectTypeDeterminer;
import com.opensymphony.xwork2.conversion.impl.ArrayConverter;
import com.opensymphony.xwork2.conversion.impl.CollectionConverter;
import com.opensymphony.xwork2.conversion.impl.DateConverter;
import com.opensymphony.xwork2.conversion.impl.NumberConverter;
import com.opensymphony.xwork2.conversion.impl.StringConverter;
import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.ContainerBuilder;
@@ -181,12 +173,6 @@ import java.util.StringTokenizer;
* <td>Allows provide custom TextProvider for whole application</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.LocaleProvider</td>
* <td>struts.localeProvider</td>
* <td>singleton</td>
* <td>Allows provide custom TextProvider for whole application</td>
* </tr>
* <tr>
* <td>org.apache.struts2.components.UrlRenderer</td>
* <td>struts.urlRenderer</td>
* <td>singleton</td>
@@ -205,41 +191,12 @@ import java.util.StringTokenizer;
* <td>Helper class used with URLRenderer to provide exact logic for building URLs</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.FileManagerFactory</td>
* <td>struts.fileManagerFactory</td>
* <td>com.opensymphony.xwork2.FileManager</td>
* <td>struts.fileManager</td>
* <td>singleton</td>
* <td>Used to create {@link FileManager} instance to access files on the File System as also to monitor if reload is needed,
* <td>Used to access files on the File System as also to monitor if reload is needed,
* can be implemented / overwritten to meet specific an application server needs
* </td>
* <tr>
* <td>com.opensymphony.xwork2.conversion.impl.CollectionConverter</td>
* <td>struts.converter.collection</td>
* <td>singleton</td>
* <td>Converter used to convert any object to Collection and back</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.conversion.impl.ArrayConverter</td>
* <td>struts.converter.array</td>
* <td>singleton</td>
* <td>Converter used to convert any object to Array and back</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.conversion.impl.DateConverter</td>
* <td>struts.converter.date</td>
* <td>singleton</td>
* <td>Converter used to convert any object to Date and back</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.conversion.impl.NumberConverter</td>
* <td>struts.converter.number</td>
* <td>singleton</td>
* <td>Converter used to convert any object to Number and back</td>
* </tr>
* <tr>
* <td>com.opensymphony.xwork2.conversion.impl.StringConverter</td>
* <td>struts.converter.string</td>
* <td>singleton</td>
* <td>Converter used to convert any object to String and back</td>
* </tr>
* </table>
*
@@ -286,10 +243,9 @@ 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);
alias(FileManager.class, StrutsConstants.STRUTS_FILEMANAGER, builder, props);
alias(XWorkConverter.class, StrutsConstants.STRUTS_XWORKCONVERTER, 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);
alias(ActionMapper.class, StrutsConstants.STRUTS_MAPPER_CLASS, builder, props);
@@ -306,28 +262,21 @@ 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(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");
props.setProperty(StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD, "true");
props.setProperty(StrutsConstants.STRUTS_FREEMARKER_TEMPLATES_CACHE, "false");
props.setProperty(StrutsConstants.STRUTS_FREEMARKER_TEMPLATES_CACHE_UPDATE_DELAY, "0");
// Convert struts properties into ones that xwork expects
props.setProperty(XWorkConstants.DEV_MODE, "true");
props.setProperty("devMode", "true");
} else {
props.setProperty(XWorkConstants.DEV_MODE, "false");
props.setProperty("devMode", "false");
}
// 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_ALLOW_STATIC_METHOD_ACCESS, XWorkConstants.ALLOW_STATIC_METHOD_ACCESS);
convertIfExist(props, StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD, XWorkConstants.RELOAD_XML_CONFIGURATION);
convertIfExist(props, StrutsConstants.STRUTS_LOG_MISSING_PROPERTIES, "logMissingProperties");
convertIfExist(props, StrutsConstants.STRUTS_ENABLE_OGNL_EXPRESSION_CACHE, "enableOGNLExpressionCache");
convertIfExist(props, StrutsConstants.STRUTS_ALLOW_STATIC_METHOD_ACCESS, "allowStaticMethodAccess");
LocalizedTextUtil.addDefaultResourceBundle("org/apache/struts2/struts-messages");
loadCustomResourceBundles(props);
@@ -25,16 +25,12 @@ import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.ActionProxyFactory;
import com.opensymphony.xwork2.FileManager;
import com.opensymphony.xwork2.FileManagerFactory;
import com.opensymphony.xwork2.LocaleProvider;
import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.Result;
import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.config.ConfigurationManager;
import com.opensymphony.xwork2.config.ConfigurationProvider;
import com.opensymphony.xwork2.config.FileManagerFactoryProvider;
import com.opensymphony.xwork2.config.FileManagerProvider;
import com.opensymphony.xwork2.config.entities.InterceptorMapping;
import com.opensymphony.xwork2.config.entities.InterceptorStackConfig;
import com.opensymphony.xwork2.config.entities.PackageConfig;
@@ -67,7 +63,6 @@ import org.apache.struts2.dispatcher.multipart.MultiPartRequest;
import org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper;
import org.apache.struts2.util.AttributeMap;
import org.apache.struts2.util.ObjectFactoryDestroyable;
import org.apache.struts2.util.fs.JBossFileManager;
import org.apache.struts2.views.freemarker.FreemarkerManager;
import javax.servlet.ServletContext;
@@ -78,6 +73,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -155,12 +151,6 @@ public class Dispatcher {
*/
private boolean paramsWorkaroundEnabled = false;
/**
* Indicates if Dispatcher should handle exception and call sendError()
* Introduced to allow integration with other frameworks like Spring Security
*/
private boolean handleException;
/**
* Provide the dispatcher instance for the current thread.
*
@@ -260,11 +250,6 @@ public class Dispatcher {
this.valueStackFactory = valueStackFactory;
}
@Inject(StrutsConstants.STRUTS_HANDLE_EXCEPTION)
public void setHandleException(String handleException) {
this.handleException = Boolean.parseBoolean(handleException);
}
/**
* Releases all instances bound to this dispatcher instance.
*/
@@ -321,28 +306,6 @@ public class Dispatcher {
configurationManager = null;
}
private void init_FileManager() throws ClassNotFoundException {
if (initParams.containsKey(StrutsConstants.STRUTS_FILE_MANAGER)) {
final String fileManagerClassName = initParams.get(StrutsConstants.STRUTS_FILE_MANAGER);
final Class<FileManager> fileManagerClass = (Class<FileManager>) Class.forName(fileManagerClassName);
if (LOG.isInfoEnabled()) {
LOG.info("Custom FileManager specified: #0", fileManagerClassName);
}
configurationManager.addContainerProvider(new FileManagerProvider(fileManagerClass, fileManagerClass.getSimpleName()));
} else {
// add any other Struts 2 provided implementations of FileManager
configurationManager.addContainerProvider(new FileManagerProvider(JBossFileManager.class, "jboss"));
}
if (initParams.containsKey(StrutsConstants.STRUTS_FILE_MANAGER_FACTORY)) {
final String fileManagerFactoryClassName = initParams.get(StrutsConstants.STRUTS_FILE_MANAGER_FACTORY);
final Class<FileManagerFactory> fileManagerFactoryClass = (Class<FileManagerFactory>) Class.forName(fileManagerFactoryClassName);
if (LOG.isInfoEnabled()) {
LOG.info("Custom FileManagerFactory specified: #0", fileManagerFactoryClassName);
}
configurationManager.addContainerProvider(new FileManagerFactoryProvider(fileManagerFactoryClass));
}
}
private void init_DefaultProperties() {
configurationManager.addContainerProvider(new DefaultPropertiesProvider());
}
@@ -433,6 +396,12 @@ public class Dispatcher {
return container;
}
private void init_CheckConfigurationReloading(Container container) {
FileManager fileManager = container.getInstance(FileManager.class);
fileManager.setReloadingConfigs("true".equals(container.getInstance(String.class,
StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD)));
}
private void init_CheckWebLogicWorkaround(Container container) {
// test whether param-access workaround needs to be enabled
if (servletContext != null && servletContext.getServerInfo() != null
@@ -458,7 +427,6 @@ public class Dispatcher {
}
try {
init_FileManager();
init_DefaultProperties(); // [1]
init_TraditionalXmlConfigurations(); // [2]
init_LegacyStrutsProperties(); // [3]
@@ -468,6 +436,7 @@ public class Dispatcher {
Container container = init_PreloadConfiguration();
container.inject(this);
init_CheckConfigurationReloading(container);
init_CheckWebLogicWorkaround(container);
if (!dispatcherListeners.isEmpty()) {
@@ -548,24 +517,21 @@ public class Dispatcher {
}
} catch (ConfigurationException e) {
// WW-2874 Only log error if in devMode
if (devMode) {
if(devMode) {
String reqStr = request.getRequestURI();
if (request.getQueryString() != null) {
reqStr = reqStr + "?" + request.getQueryString();
}
LOG.error("Could not find action or result\n" + reqStr, e);
} else {
if (LOG.isWarnEnabled()) {
LOG.warn("Could not find action or result", e);
}
}
else {
if (LOG.isWarnEnabled()) {
LOG.warn("Could not find action or result", e);
}
}
sendError(request, response, context, HttpServletResponse.SC_NOT_FOUND, e);
} catch (Exception e) {
if (handleException || devMode) {
sendError(request, response, context, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e);
} else {
throw new ServletException(e);
}
sendError(request, response, context, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e);
} finally {
UtilTimerStack.pop(timerKey);
}
@@ -716,7 +682,7 @@ public class Dispatcher {
}
// check for Ajax request to use UTF-8 encoding strictly http://www.w3.org/TR/XMLHttpRequest/#the-send-method
if ("XMLHttpRequest".equals(request.getHeader("X-Requested-With"))) {
encoding = "UTF-8";
encoding = "utf-8";
}
Locale locale = null;
@@ -774,16 +740,17 @@ public class Dispatcher {
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 (multiNames != null) {
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);
request = new MultiPartRequestWrapper(mpr, request, getSaveDir(servletContext));
} else {
request = new StrutsRequestWrapper(request);
}
@@ -796,13 +763,35 @@ public class Dispatcher {
*
* @param request the HttpServletRequest object.
* @see org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper
* @throws java.io.IOException on any error.
*/
public void cleanUpRequest(HttpServletRequest request) {
public void cleanUpRequest(HttpServletRequest request) throws IOException {
if (!(request instanceof MultiPartRequestWrapper)) {
return;
}
MultiPartRequestWrapper multiWrapper = (MultiPartRequestWrapper) request;
multiWrapper.cleanUp();
Enumeration fileParameterNames = multiWrapper.getFileParameterNames();
while (fileParameterNames != null && fileParameterNames.hasMoreElements()) {
String inputValue = (String) fileParameterNames.nextElement();
File[] files = multiWrapper.getFiles(inputValue);
for (File currentFile : files) {
if (LOG.isInfoEnabled()) {
String msg = LocalizedTextUtil.findText(this.getClass(), "struts.messages.removing.file", Locale.ENGLISH, "no.message.found", new Object[]{inputValue, currentFile});
LOG.info(msg);
}
if ((currentFile != null) && currentFile.isFile()) {
if (!currentFile.delete()) {
if (LOG.isWarnEnabled()) {
LOG.warn("Resource Leaking: Could not remove uploaded file '" + currentFile.getCanonicalPath() + "'.");
}
}
}
}
}
}
/**
@@ -814,7 +803,8 @@ public class Dispatcher {
* @param e the Exception that is reported.
* @param ctx the ServletContext object.
*/
public void sendError(HttpServletRequest request, HttpServletResponse response, ServletContext ctx, int code, Exception e) {
public void sendError(HttpServletRequest request, HttpServletResponse response,
ServletContext ctx, int code, Exception e) {
Boolean devModeOverride = FilterDispatcher.getDevModeOverride();
if (devModeOverride != null ? devModeOverride : devMode) {
response.setContentType("text/html");
@@ -388,8 +388,6 @@ public class FilterDispatcher implements StrutsStatics, Filter {
*/
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
showDeprecatedWarning();
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
ServletContext servletContext = getServletContext();
@@ -443,21 +441,4 @@ public class FilterDispatcher implements StrutsStatics, Filter {
devModeOverride.remove();
}
}
private void showDeprecatedWarning() {
String msg =
"\n\n" +
"***********************************************************************\n" +
"* WARNING!!! *\n" +
"* *\n" +
"* >>> FilterDispatcher <<< 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);
}
}
@@ -250,13 +250,11 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec
}
private boolean isPathUrl(String url) {
private static boolean isPathUrl(String url) {
// filter out "http:", "https:", "mailto:", "file:", "ftp:"
return !url.startsWith("http:")
&& !url.startsWith("https:")
&& !url.startsWith("mailto:")
&& !url.startsWith("file:")
&& !url.startsWith("ftp:");
// since the only valid places for : in URL's is before the path specification
// either before the port, or after the protocol
return (url.indexOf(':') == -1);
}
/**
@@ -21,10 +21,10 @@
package org.apache.struts2.dispatcher.mapper;
import com.opensymphony.xwork2.config.ConfigurationManager;
import javax.servlet.http.HttpServletRequest;
import com.opensymphony.xwork2.config.ConfigurationManager;
/**
* <!-- START SNIPPET: javadoc -->
*
@@ -51,7 +51,7 @@ public interface ActionMapper {
*
* @param request The servlet request
* @param configManager The current configuration manager
* @return The appropriate action mapping or null if mapping cannot be determined
* @return The appropriate action mapping
*/
ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager);
@@ -21,13 +21,10 @@
package org.apache.struts2.dispatcher.multipart;
import com.opensymphony.xwork2.LocaleProvider;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadBase;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.RequestContext;
import org.apache.commons.fileupload.disk.DiskFileItem;
@@ -45,84 +42,50 @@ import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
/**
* Multipart form data request adapter for Jakarta Commons Fileupload package.
*/
public class JakartaMultiPartRequest implements MultiPartRequest {
static final Logger LOG = LoggerFactory.getLogger(JakartaMultiPartRequest.class);
static final Logger LOG = LoggerFactory.getLogger(MultiPartRequest.class);
// maps parameter name -> List of FileItem objects
protected Map<String, List<FileItem>> files = new HashMap<String, List<FileItem>>();
protected Map<String,List<FileItem>> files = new HashMap<String,List<FileItem>>();
// maps parameter name -> List of param values
protected Map<String, List<String>> params = new HashMap<String, List<String>>();
protected Map<String,List<String>> params = new HashMap<String,List<String>>();
// any errors while processing this request
protected List<String> errors = new ArrayList<String>();
protected long maxSize;
private Locale defaultLocale = Locale.ENGLISH;
@Inject(StrutsConstants.STRUTS_MULTIPART_MAXSIZE)
public void setMaxSize(String maxSize) {
this.maxSize = Long.parseLong(maxSize);
}
@Inject
public void setLocaleProvider(LocaleProvider provider) {
defaultLocale = provider.getLocale();
}
/**
* Creates a new request wrapper to handle multi-part data using methods adapted from Jason Pell's
* multipart classes (see class description).
*
* @param saveDir the directory to save off the file
* @param saveDir the directory to save off the file
* @param request the request containing the multipart
* @throws java.io.IOException is thrown if encoding fails.
* @throws java.io.IOException is thrown if encoding fails.
*/
public void parse(HttpServletRequest request, String saveDir) throws IOException {
try {
setLocale(request);
processUpload(request, saveDir);
} catch (FileUploadBase.SizeLimitExceededException e) {
} catch (FileUploadException e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Request exceeded size limit!", e);
}
String errorMessage = buildErrorMessage(e, new Object[]{e.getPermittedSize(), e.getActualSize()});
if (!errors.contains(errorMessage)) {
errors.add(errorMessage);
}
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Unable to parse request", e);
}
String errorMessage = buildErrorMessage(e, new Object[]{});
if (!errors.contains(errorMessage)) {
errors.add(errorMessage);
LOG.warn("Unable to parse request", e);
}
errors.add(e.getMessage());
}
}
protected void setLocale(HttpServletRequest request) {
if (defaultLocale == null) {
defaultLocale = request.getLocale();
}
}
protected String buildErrorMessage(Throwable e, Object[] args) {
String errorKey = "struts.messages.upload.error." + e.getClass().getSimpleName();
if (LOG.isDebugEnabled()) {
LOG.debug("Preparing error message for key: [#0]", errorKey);
}
return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, e.getMessage(), args);
}
private void processUpload(HttpServletRequest request, String saveDir) throws FileUploadException, UnsupportedEncodingException {
for (FileItem item : parseRequest(request, saveDir)) {
if (LOG.isDebugEnabled()) {
@@ -179,7 +142,6 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
values.add(item.getString());
}
params.put(item.getFieldName(), values);
item.delete();
}
private List<FileItem> parseRequest(HttpServletRequest servletRequest, String saveDir) throws FileUploadException {
@@ -237,12 +199,12 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
List<File> fileList = new ArrayList<File>(items.size());
for (FileItem fileItem : items) {
File storeLocation = ((DiskFileItem) fileItem).getStoreLocation();
if (fileItem.isInMemory() && storeLocation != null && !storeLocation.exists()) {
if(fileItem.isInMemory() && storeLocation!=null && !storeLocation.exists()) {
try {
storeLocation.createNewFile();
} catch (IOException e) {
if (LOG.isErrorEnabled()) {
LOG.error("Cannot write uploaded empty file to disk: " + storeLocation.getAbsolutePath(), e);
if(LOG.isErrorEnabled()){
LOG.error("Cannot write uploaded empty file to disk: " + storeLocation.getAbsolutePath(),e);
}
}
}
@@ -322,14 +284,14 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
/* (non-Javadoc)
* @see org.apache.struts2.dispatcher.multipart.MultiPartRequest#getErrors()
*/
public List<String> getErrors() {
public List getErrors() {
return errors;
}
/**
* Returns the canonical name of the given file.
*
* @param filename the given file
* @param filename the given file
* @return the canonical name of the given file
*/
private String getCanonicalName(String filename) {
@@ -347,7 +309,7 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
/**
* Creates a RequestContext needed by Jakarta Commons Upload.
*
* @param req the request.
* @param req the request.
* @return a new request context.
*/
private RequestContext createRequestContext(final HttpServletRequest req) {
@@ -374,24 +336,4 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
};
}
/* (non-Javadoc)
* @see org.apache.struts2.dispatcher.multipart.MultiPartRequest#cleanUp()
*/
public void cleanUp() {
Set<String> names = files.keySet();
for (String name : names) {
List<FileItem> items = files.get(name);
for (FileItem item : items) {
if (LOG.isDebugEnabled()) {
String msg = LocalizedTextUtil.findText(this.getClass(), "struts.messages.removing.file",
Locale.ENGLISH, "no.message.found", new Object[]{name, item});
LOG.debug(msg);
}
if (!item.isInMemory()) {
item.delete();
}
}
}
}
}
@@ -21,12 +21,13 @@
package org.apache.struts2.dispatcher.multipart;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.Enumeration;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
/**
* Abstract wrapper class HTTP requests to handle multi-part data. <p>
@@ -113,11 +114,5 @@ public interface MultiPartRequest {
*
* @return a list of Strings that represent various errors during parsing
*/
public List<String> getErrors();
/**
* Cleans up all uploaded file, should be called at the end of request
*/
public void cleanUp();
public List getErrors();
}
@@ -21,23 +21,22 @@
package org.apache.struts2.dispatcher.multipart;
import com.opensymphony.xwork2.LocaleProvider;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.dispatcher.StrutsRequestWrapper;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.dispatcher.StrutsRequestWrapper;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
/**
* Parse a multipart request and provide a wrapper around the request. The parsing implementation used
@@ -56,54 +55,33 @@ import java.util.Vector;
*
*/
public class MultiPartRequestWrapper extends StrutsRequestWrapper {
protected static final Logger LOG = LoggerFactory.getLogger(MultiPartRequestWrapper.class);
private Collection<String> errors;
private MultiPartRequest multi;
private Locale defaultLocale = Locale.ENGLISH;
Collection<String> errors;
MultiPartRequest multi;
/**
* Process file downloads and log any errors.
*
* @param multiPartRequest Our MultiPartRequest object
* @param request Our HttpServletRequest object
* @param saveDir Target directory for any files that we save
* @param provider
* @param multiPartRequest Our MultiPartRequest object
*/
public MultiPartRequestWrapper(MultiPartRequest multiPartRequest, HttpServletRequest request, String saveDir, LocaleProvider provider) {
public MultiPartRequestWrapper(MultiPartRequest multiPartRequest, HttpServletRequest request, String saveDir) {
super(request);
errors = new ArrayList<String>();
multi = multiPartRequest;
defaultLocale = provider.getLocale();
setLocale(request);
try {
multi.parse(request, saveDir);
for (String error : multi.getErrors()) {
for (Object o : multi.getErrors()) {
String error = (String) o;
addError(error);
}
} catch (IOException e) {
if (LOG.isWarnEnabled()) {
LOG.warn(e.getMessage(), e);
}
addError(buildErrorMessage(e, new Object[] {e.getMessage()}));
addError("Cannot parse request: "+e.toString());
}
}
protected void setLocale(HttpServletRequest request) {
if (defaultLocale == null) {
defaultLocale = request.getLocale();
}
}
protected String buildErrorMessage(Throwable e, Object[] args) {
String errorKey = "struts.messages.upload.error." + e.getClass().getSimpleName();
if (LOG.isDebugEnabled()) {
LOG.debug("Preparing error message for key: [#0]", errorKey);
}
return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, e.getMessage(), args);
}
/**
* Get an enumeration of the parameter names for uploaded files
*
@@ -222,7 +200,7 @@ public class MultiPartRequestWrapper extends StrutsRequestWrapper {
* @return <tt>true</tt> if any errors occured when parsing the HTTP multipart request, <tt>false</tt> otherwise.
*/
public boolean hasErrors() {
return !errors.isEmpty();
return !((errors == null) || errors.isEmpty());
}
/**
@@ -235,14 +213,16 @@ public class MultiPartRequestWrapper extends StrutsRequestWrapper {
}
/**
* Adds an error message when it isn't already added.
* Adds an error message.
*
* @param anErrorMessage the error message to report.
*/
protected void addError(String anErrorMessage) {
if (!errors.contains(anErrorMessage)) {
errors.add(anErrorMessage);
if (errors == null) {
errors = new ArrayList<String>();
}
errors.add(anErrorMessage);
}
/**
@@ -265,11 +245,4 @@ public class MultiPartRequestWrapper extends StrutsRequestWrapper {
return temp.elements();
}
public void cleanUp() {
if (multi != null) {
multi.cleanUp();
}
}
}
@@ -26,6 +26,7 @@ import com.opensymphony.xwork2.util.ValueStackFactory;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.RequestUtils;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.StrutsException;
import org.apache.struts2.dispatcher.Dispatcher;
import org.apache.struts2.dispatcher.mapper.ActionMapper;
@@ -101,6 +102,11 @@ public class PrepareOperations {
// always clean up the thread request, even if an action hasn't been executed
try {
dispatcher.cleanUpRequest(request);
} catch (IOException e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Cannot clean up the request, some files can still remain in #0 after upload!", e,
StrutsConstants.STRUTS_MULTIPART_SAVEDIR);
}
} finally {
ActionContext.setContext(null);
Dispatcher.setInstance(null);
@@ -257,9 +257,8 @@ public class ExecuteAndWaitInterceptor extends MethodFilterInterceptor {
if ((!executeAfterValidationPass || !secondTime) && bp != null && !bp.isDone()) {
actionInvocation.getStack().push(bp.getAction());
final String token = TokenHelper.getToken();
if (token != null) {
TokenHelper.setSessionToken(TokenHelper.getTokenName(), token);
if (TokenHelper.getToken() != null) {
session.put(TokenHelper.getTokenName(), TokenHelper.getToken());
}
Map results = proxy.getConfig().getResults();
@@ -24,13 +24,10 @@ package org.apache.struts2.interceptor;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.LocaleProvider;
import com.opensymphony.xwork2.TextProvider;
import com.opensymphony.xwork2.TextProviderFactory;
import com.opensymphony.xwork2.ValidationAware;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
import com.opensymphony.xwork2.util.PatternMatcher;
import com.opensymphony.xwork2.util.TextParseUtil;
import com.opensymphony.xwork2.util.logging.Logger;
@@ -40,14 +37,7 @@ import org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
/**
* <!-- START SNIPPET: description -->
@@ -155,27 +145,27 @@ import java.util.Set;
* <pre>
* <!-- START SNIPPET: example-action -->
* package com.example;
*
* <p/>
* import java.io.File;
* import com.opensymphony.xwork2.ActionSupport;
*
* <p/>
* public UploadAction extends ActionSupport {
* private File file;
* private String contentType;
* private String filename;
*
* <p/>
* public void setUpload(File file) {
* this.file = file;
* }
*
* <p/>
* public void setUploadContentType(String contentType) {
* this.contentType = contentType;
* }
*
* <p/>
* public void setUploadFileName(String filename) {
* this.filename = filename;
* }
*
* <p/>
* public String execute() {
* //...
* return SUCCESS;
@@ -189,22 +179,23 @@ public class FileUploadInterceptor extends AbstractInterceptor {
private static final long serialVersionUID = -4764627478894962478L;
protected static final Logger LOG = LoggerFactory.getLogger(FileUploadInterceptor.class);
private static final String DEFAULT_MESSAGE = "no.message.found";
protected boolean useActionMessageBundle;
protected Long maximumSize;
protected Set<String> allowedTypesSet = Collections.emptySet();
protected Set<String> allowedExtensionsSet = Collections.emptySet();
private PatternMatcher matcher;
private Container container;
@Inject
public void setMatcher(PatternMatcher matcher) {
this.matcher = matcher;
}
@Inject
public void setContainer(Container container) {
this.container = container;
public void setUseActionMessageBundle(String value) {
this.useActionMessageBundle = Boolean.valueOf(value);
}
/**
@@ -246,7 +237,7 @@ public class FileUploadInterceptor extends AbstractInterceptor {
if (!(request instanceof MultiPartRequestWrapper)) {
if (LOG.isDebugEnabled()) {
ActionProxy proxy = invocation.getProxy();
LOG.debug(getTextMessage("struts.messages.bypass.request", new String[]{proxy.getNamespace(), proxy.getActionName()}));
LOG.debug(getTextMessage("struts.messages.bypass.request", new Object[]{proxy.getNamespace(), proxy.getActionName()}, ac.getLocale()));
}
return invocation.invoke();
@@ -267,6 +258,10 @@ public class FileUploadInterceptor extends AbstractInterceptor {
if (validation != null) {
validation.addActionError(error);
}
if (LOG.isWarnEnabled()) {
LOG.warn(error);
}
}
}
@@ -294,7 +289,7 @@ public class FileUploadInterceptor extends AbstractInterceptor {
String fileNameName = inputName + "FileName";
for (int index = 0; index < files.length; index++) {
if (acceptFile(action, files[index], fileName[index], contentType[index], inputName, validation)) {
if (acceptFile(action, files[index], fileName[index], contentType[index], inputName, validation, ac.getLocale())) {
acceptedFiles.add(files[index]);
acceptedContentTypes.add(contentType[index]);
acceptedFileNames.add(fileName[index]);
@@ -311,12 +306,12 @@ public class FileUploadInterceptor extends AbstractInterceptor {
}
} else {
if (LOG.isWarnEnabled()) {
LOG.warn(getTextMessage(action, "struts.messages.invalid.file", new String[]{inputName}));
LOG.warn(getTextMessage(action, "struts.messages.invalid.file", new Object[]{inputName}, ac.getLocale()));
}
}
} else {
if (LOG.isWarnEnabled()) {
LOG.warn(getTextMessage(action, "struts.messages.invalid.content.type", new String[]{inputName}));
LOG.warn(getTextMessage(action, "struts.messages.invalid.content.type", new Object[]{inputName}, ac.getLocale()));
}
}
}
@@ -334,47 +329,48 @@ public class FileUploadInterceptor extends AbstractInterceptor {
* @param inputName - inputName of the file.
* @param validation - Non-null ValidationAware if the action implements ValidationAware, allowing for better
* logging.
* @param locale
* @return true if the proposed file is acceptable by contentType and size.
*/
protected boolean acceptFile(Object action, File file, String filename, String contentType, String inputName, ValidationAware validation) {
protected boolean acceptFile(Object action, File file, String filename, String contentType, String inputName, ValidationAware validation, Locale locale) {
boolean fileIsAcceptable = false;
// If it's null the upload failed
if (file == null) {
String errMsg = getTextMessage(action, "struts.messages.error.uploading", new String[]{inputName});
String errMsg = getTextMessage(action, "struts.messages.error.uploading", new Object[]{inputName}, locale);
if (validation != null) {
validation.addFieldError(inputName, errMsg);
}
if (LOG.isWarnEnabled()) {
LOG.warn(errMsg);
LOG.warn(errMsg);
}
} else if (maximumSize != null && maximumSize < file.length()) {
String errMsg = getTextMessage(action, "struts.messages.error.file.too.large", new String[]{inputName, filename, file.getName(), "" + file.length()});
String errMsg = getTextMessage(action, "struts.messages.error.file.too.large", new Object[]{inputName, filename, file.getName(), "" + file.length()}, locale);
if (validation != null) {
validation.addFieldError(inputName, errMsg);
}
if (LOG.isWarnEnabled()) {
LOG.warn(errMsg);
LOG.warn(errMsg);
}
} else if ((!allowedTypesSet.isEmpty()) && (!containsItem(allowedTypesSet, contentType))) {
String errMsg = getTextMessage(action, "struts.messages.error.content.type.not.allowed", new String[]{inputName, filename, file.getName(), contentType});
String errMsg = getTextMessage(action, "struts.messages.error.content.type.not.allowed", new Object[]{inputName, filename, file.getName(), contentType}, locale);
if (validation != null) {
validation.addFieldError(inputName, errMsg);
}
if (LOG.isWarnEnabled()) {
LOG.warn(errMsg);
LOG.warn(errMsg);
}
} else if ((!allowedExtensionsSet.isEmpty()) && (!hasAllowedExtension(allowedExtensionsSet, filename))) {
String errMsg = getTextMessage(action, "struts.messages.error.file.extension.not.allowed", new String[]{inputName, filename, file.getName(), contentType});
String errMsg = getTextMessage(action, "struts.messages.error.file.extension.not.allowed", new Object[]{inputName, filename, file.getName(), contentType}, locale);
if (validation != null) {
validation.addFieldError(inputName, errMsg);
}
if (LOG.isWarnEnabled()) {
LOG.warn(errMsg);
LOG.warn(errMsg);
}
} else {
fileIsAcceptable = true;
@@ -430,34 +426,21 @@ public class FileUploadInterceptor extends AbstractInterceptor {
return result;
}
protected String getTextMessage(String messageKey, String[] args) {
return getTextMessage(this, messageKey, args);
private String getTextMessage(String messageKey, Object[] args, Locale locale) {
return getTextMessage(null, messageKey, args, locale);
}
protected String getTextMessage(Object action, String messageKey, String[] args) {
if (action instanceof TextProvider) {
return ((TextProvider) action).getText(messageKey, args);
}
return getTextProvider(action).getText(messageKey, args);
}
private TextProvider getTextProvider(Object action) {
TextProviderFactory tpf = new TextProviderFactory();
if (container != null) {
container.inject(tpf);
}
LocaleProvider localeProvider = getLocaleProvider(action);
return tpf.createInstance(action.getClass(), localeProvider);
}
private LocaleProvider getLocaleProvider(Object action) {
LocaleProvider localeProvider;
if (action instanceof LocaleProvider) {
localeProvider = (LocaleProvider) action;
private String getTextMessage(Object action, String messageKey, Object[] args, Locale locale) {
if (args == null || args.length == 0) {
if (action != null && useActionMessageBundle) {
return LocalizedTextUtil.findText(action.getClass(), messageKey, locale);
}
return LocalizedTextUtil.findText(this.getClass(), messageKey, locale);
} else {
localeProvider = container.getInstance(LocaleProvider.class);
if (action != null && useActionMessageBundle) {
return LocalizedTextUtil.findText(action.getClass(), messageKey, locale, DEFAULT_MESSAGE, args);
}
return LocalizedTextUtil.findText(this.getClass(), messageKey, locale, DEFAULT_MESSAGE, args);
}
return localeProvider;
}
}
@@ -22,10 +22,9 @@
package org.apache.struts2.interceptor;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.TextProvider;
import com.opensymphony.xwork2.ValidationAware;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.util.TokenHelper;
@@ -121,31 +120,18 @@ public class TokenInterceptor extends MethodFilterInterceptor {
public static final String INVALID_TOKEN_CODE = "invalid.token";
private static final String INVALID_TOKEN_MESSAGE_KEY = "struts.messages.invalid.token";
private static final String DEFAULT_ERROR_MESSAGE = "The form has already been processed or no token was supplied, please try again.";
private TextProvider textProvider;
@Inject
public void setTextProvider(TextProvider textProvider) {
this.textProvider = textProvider;
}
/**
* @see com.opensymphony.xwork2.interceptor.MethodFilterInterceptor#doIntercept(com.opensymphony.xwork2.ActionInvocation)
*/
@Override
protected String doIntercept(ActionInvocation invocation) throws Exception {
if (log.isDebugEnabled()) {
log.debug("Intercepting invocation to check for valid transaction token.");
}
return handleToken(invocation);
}
protected String handleToken(ActionInvocation invocation) throws Exception {
//see WW-2902: we need to use the real HttpSession here, as opposed to the map
//that wraps the session, because a new wrap is created on every request
HttpSession session = ServletActionContext.getRequest().getSession(true);
synchronized (session) {
if (!TokenHelper.validToken()) {
return handleInvalidToken(invocation);
@@ -163,7 +149,9 @@ public class TokenInterceptor extends MethodFilterInterceptor {
*/
protected String handleInvalidToken(ActionInvocation invocation) throws Exception {
Object action = invocation.getAction();
String errorMessage = getErrorMessage(invocation);
String errorMessage = LocalizedTextUtil.findText(this.getClass(), "struts.messages.invalid.token",
invocation.getInvocationContext().getLocale(),
"The form has already been processed or no token was supplied, please try again.", new Object[0]);
if (action instanceof ValidationAware) {
((ValidationAware) action).addActionError(errorMessage);
@@ -174,14 +162,6 @@ public class TokenInterceptor extends MethodFilterInterceptor {
return INVALID_TOKEN_CODE;
}
protected String getErrorMessage(ActionInvocation invocation) {
Object action = invocation.getAction();
if (action instanceof TextProvider) {
return ((TextProvider) action).getText(INVALID_TOKEN_MESSAGE_KEY, DEFAULT_ERROR_MESSAGE);
}
return textProvider.getText(INVALID_TOKEN_MESSAGE_KEY, DEFAULT_ERROR_MESSAGE);
}
/**
* Called when a valid token is found. This method invokes the action by can be changed to do something more
* interesting.
@@ -192,5 +172,4 @@ public class TokenInterceptor extends MethodFilterInterceptor {
protected String handleValidToken(ActionInvocation invocation) throws Exception {
return invocation.invoke();
}
}
@@ -21,18 +21,19 @@
package org.apache.struts2.interceptor;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.Result;
import com.opensymphony.xwork2.util.ValueStack;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.util.InvocationSessionStore;
import org.apache.struts2.util.TokenHelper;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Map;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.Result;
import com.opensymphony.xwork2.util.ValueStack;
/**
@@ -104,20 +105,9 @@ public class TokenSessionStoreInterceptor extends TokenInterceptor {
private static final long serialVersionUID = -9032347965469098195L;
@Override
protected String handleToken(ActionInvocation invocation) throws Exception {
//see WW-2902: we need to use the real HttpSession here, as opposed to the map
//that wraps the session, because a new wrap is created on every request
HttpSession session = ServletActionContext.getRequest().getSession(true);
synchronized (session) {
if (!TokenHelper.validToken()) {
return handleInvalidToken(invocation);
}
return handleValidToken(invocation);
}
}
@Override
/* (non-Javadoc)
* @see org.apache.struts2.interceptor.TokenInterceptor#handleInvalidToken(com.opensymphony.xwork2.ActionInvocation)
*/
protected String handleInvalidToken(ActionInvocation invocation) throws Exception {
ActionContext ac = invocation.getInvocationContext();
@@ -131,8 +121,7 @@ public class TokenSessionStoreInterceptor extends TokenInterceptor {
params.remove(tokenName);
params.remove(TokenHelper.TOKEN_NAME_FIELD);
String sessionTokenName = TokenHelper.buildTokenSessionAttributeName(tokenName);
ActionInvocation savedInvocation = InvocationSessionStore.loadInvocation(sessionTokenName, token);
ActionInvocation savedInvocation = InvocationSessionStore.loadInvocation(tokenName, token);
if (savedInvocation != null) {
// set the valuestack to the request scope
@@ -146,7 +135,9 @@ public class TokenSessionStoreInterceptor extends TokenInterceptor {
Result result = savedInvocation.getResult();
if ((result != null) && (savedInvocation.getProxy().getExecuteResult())) {
result.execute(savedInvocation);
synchronized (context) {
result.execute(savedInvocation);
}
}
// turn off execution of this invocations result
@@ -159,15 +150,15 @@ public class TokenSessionStoreInterceptor extends TokenInterceptor {
return INVALID_TOKEN_CODE;
}
@Override
/* (non-Javadoc)
* @see org.apache.struts2.interceptor.TokenInterceptor#handleValidToken(com.opensymphony.xwork2.ActionInvocation)
*/
protected String handleValidToken(ActionInvocation invocation) throws Exception {
// we know the token name and token must be there
String key = TokenHelper.getTokenName();
String token = TokenHelper.getToken(key);
String sessionTokenName = TokenHelper.buildTokenSessionAttributeName(key);
InvocationSessionStore.storeInvocation(sessionTokenName, token, invocation);
InvocationSessionStore.storeInvocation(key, token, invocation);
return invocation.invoke();
}
}
@@ -1,51 +0,0 @@
package org.apache.struts2.util;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.views.util.ContextUtil;
/**
* Various static methods used with components
*/
public class ComponentUtils {
/**
* If altSyntax (%{...}) is applied, simply strip the "%{" and "}" off.
*
* @param stack the ValueStack where the context value is searched for.
* @param expr the expression (must be not null)
* @return the stripped expression if altSyntax is enabled. Otherwise
* the parameter expression is returned as is.
*/
public static String stripExpressionIfAltSyntax(ValueStack stack, String expr) {
if (altSyntax(stack)) {
// does the expression start with %{ and end with }? if so, just cut it off!
if (isExpression(expr)) {
return expr.substring(2, expr.length() - 1);
}
}
return expr;
}
/**
* Is the altSyntax enabled? [TRUE]
*
* @param stack the ValueStack where the context value is searched for.
* @return true if altSyntax is activated. False otherwise.
* See <code>struts.properties</code> where the altSyntax flag is defined.
*/
public static boolean altSyntax(ValueStack stack) {
return ContextUtil.isUseAltSyntax(stack.getContext());
}
/**
* Check if object is expression base on altSyntax
*
* @param value to treat as an expression
* @return true if it is an expression
*/
public static boolean isExpression(Object value) {
String expr = value.toString();
return expr.startsWith("%{") && expr.endsWith("}");
}
}
@@ -94,7 +94,7 @@ public class TextProviderHelper {
} else {
LOG.warn("Could not locate the message resource '"+key+"' as there is no TextProvider in the ValueStack.");
}
if (defaultMessage.equals(msg)) {
if (msg.equals(defaultMessage)) {
LOG.warn("The default value expression '"+defaultMessage+"' was evaluated and did not match a property. The literal value '"+defaultMessage+"' will be used.");
} else {
LOG.warn("The default value expression '"+defaultMessage+"' evaluated to '"+msg+"'");
@@ -36,15 +36,10 @@ import com.opensymphony.xwork2.util.logging.LoggerFactory;
*/
public class TokenHelper {
/**
* The default namespace for storing token session values
*/
public static final String TOKEN_NAMESPACE = "struts.tokens";
/**
/**
* The default name to map the token value
*/
public static final String DEFAULT_TOKEN_NAME = "token";
public static final String DEFAULT_TOKEN_NAME = "struts.token";
/**
* The name of the field which will hold the token name
@@ -63,53 +58,31 @@ public class TokenHelper {
return setToken(DEFAULT_TOKEN_NAME);
}
/**
* Sets a transaction token into the session based on the provided token name.
*
* @param tokenName the token name based on which a generated token value is stored into session; for actual session
* store, this name will be prefixed by a namespace.
*
* @return the token string
*/
public static String setToken( String tokenName ) {
String token = generateGUID();
setSessionToken(tokenName, token);
return token;
}
/**
* Sets a transaction token into the session using the provided token name.
*
* @param tokenName the name to store into the session with the token as the value
* @return the token string
*/
public static String setToken(String tokenName) {
Map session = ActionContext.getContext().getSession();
String token = generateGUID();
try {
session.put(tokenName, token);
}
catch(IllegalStateException e) {
// WW-1182 explain to user what the problem is
String msg = "Error creating HttpSession due response is commited to client. You can use the CreateSessionInterceptor or create the HttpSession from your action before the result is rendered to the client: " + e.getMessage();
LOG.error(msg, e);
throw new IllegalArgumentException(msg);
}
/**
* Put a given named token into the session map. The token will be stored with a namespace prefix prepended.
*
* @param tokenName the token name based on which given token value is stored into session; for actual session store,
* this name will be prefixed by a namespace.
* @param token the token value to store
*/
public static void setSessionToken( String tokenName, String token ) {
Map<String, Object> session = ActionContext.getContext().getSession();
try {
session.put(buildTokenSessionAttributeName(tokenName), token);
} catch ( IllegalStateException e ) {
// WW-1182 explain to user what the problem is
String msg = "Error creating HttpSession due response is commited to client. You can use the CreateSessionInterceptor or create the HttpSession from your action before the result is rendered to the client: " + e.getMessage();
LOG.error(msg, e);
throw new IllegalArgumentException(msg);
}
}
return token;
}
/**
* Build a name-spaced token session attribute name based on the given token name.
*
* @param tokenName the token name to prefix
*
* @return the name space prefixed session token name
*/
public static String buildTokenSessionAttributeName( String tokenName ) {
return TOKEN_NAMESPACE + "." + tokenName;
}
/**
* Gets a transaction token from the params in the ServletActionContext using the default token name.
/**
* Gets a transaction token into the session using the default token name.
*
* @return token
*/
@@ -202,8 +175,7 @@ public class TokenHelper {
}
Map session = ActionContext.getContext().getSession();
String tokenSessionName = buildTokenSessionAttributeName(tokenName);
String sessionToken = (String) session.get(tokenSessionName);
String sessionToken = (String) session.get(tokenName);
if (!token.equals(sessionToken)) {
if (LOG.isWarnEnabled()) {
@@ -216,7 +188,7 @@ public class TokenHelper {
}
// remove the token so it won't be used again
session.remove(tokenSessionName);
session.remove(tokenName);
return true;
}
@@ -1,172 +0,0 @@
package org.apache.struts2.util.fs;
import com.opensymphony.xwork2.util.fs.DefaultFileManager;
import com.opensymphony.xwork2.util.fs.FileRevision;
import com.opensymphony.xwork2.util.fs.Revision;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* FileManager implementation used with JBoss AS
*/
public class JBossFileManager extends DefaultFileManager {
private static final Logger LOG = LoggerFactory.getLogger(JBossFileManager.class);
private static final String JBOSS5_VFS = "vfs";
private static final String JBOSS5_VFSZIP = "vfszip";
private static final String JBOSS5_VFSMEMORY = "vfsmemory";
private static final String JBOSS5_VFSFILE = "vfsfile";
private static final String VFS_JBOSS7 = "org.jboss.vfs.VirtualFile";
private static final String VFS_JBOSS5 = "org.jboss.virtual.VirtualFile";
@Override
public boolean support() {
boolean supports = isJBoss7() || isJBoss5();
if (supports && LOG.isInfoEnabled()) {
LOG.info("JBoss server detected, Struts 2 will use [#0] to support file system operations!", JBossFileManager.class.getSimpleName());
}
return supports;
}
private boolean isJBoss5() {
try {
Class.forName(VFS_JBOSS5);
return true;
} catch (ClassNotFoundException e) {
LOG.debug("Cannot load [#0] class, not a JBoss 5!", VFS_JBOSS7);
return false;
}
}
private boolean isJBoss7() {
try {
Class.forName(VFS_JBOSS7);
return true;
} catch (ClassNotFoundException e) {
LOG.debug("Cannot load [#0] class, not a JBoss 7!", VFS_JBOSS7);
return false;
}
}
@Override
public void monitorFile(URL fileUrl) {
if (isReloadingConfigs()) {
if (isJBossUrl(fileUrl)) {
Revision revision = FileRevision.build(normalizeToFileProtocol(fileUrl));
files.put(fileUrl.toString(), revision);
} else {
super.monitorFile(fileUrl);
}
}
}
@Override
public URL normalizeToFileProtocol(URL url) {
if (isJBossUrl(url)) {
try {
return getJBossPhysicalUrl(url);
} catch (IOException e) {
LOG.error(e.getMessage(), e);
return null;
}
} else {
return super.normalizeToFileProtocol(url);
}
}
@Override
public Collection<? extends URL> getAllPhysicalUrls(URL url) throws IOException {
if (isJBossUrl(url)) {
return getAllJBossPhysicalUrls(url);
} else {
return super.getAllPhysicalUrls(url);
}
}
/**
* Check if given URL is pointing to JBoss 5 VFS resource
* @param fileUrl
* @return
*/
protected boolean isJBossUrl(URL fileUrl) {
final String protocol = fileUrl.getProtocol();
return JBOSS5_VFSZIP.equals(protocol) || JBOSS5_VFSMEMORY.equals(protocol) || JBOSS5_VFS.equals(protocol)
|| ("true".equals(System.getProperty("jboss.vfs.forceVfsJar")) && JBOSS5_VFSFILE.equals(protocol));
}
/**
* Try to determine physical file location.
*
* @param url JBoss VFS URL
* @return URL pointing to physical file or original URL
* @throws java.io.IOException If conversion fails
*/
protected URL getJBossPhysicalUrl(URL url) throws IOException {
Object content = url.openConnection().getContent();
try {
String s = content.getClass().toString();
if (s.startsWith("class org.jboss.vfs.VirtualFile")) { // JBoss 7 and probably 6
File physicalFile = readJBossPhysicalFile(content);
return physicalFile.toURI().toURL();
} else if (s.startsWith("class org.jboss.virtual.VirtualFile")) { // JBoss 5
String fileName = url.toExternalForm();
return new URL("file", null, fileName.substring(fileName.indexOf(":") + 1));
}
} catch (Exception e) {
LOG.warn("Error calling getPhysicalFile() on JBoss VirtualFile.", e);
}
return url;
}
private File readJBossPhysicalFile(Object content) throws Exception {
Method method = content.getClass().getDeclaredMethod("getPhysicalFile");
return (File) method.invoke(content);
}
private List<URL> getAllJBossPhysicalUrls(URL url) throws IOException {
List<URL> urls = new ArrayList<URL>();
Object content = url.openConnection().getContent();
try {
if (content.getClass().toString().startsWith("class org.jboss.vfs.VirtualFile")) {
File physicalFile = readJBossPhysicalFile(content);
readFile(urls, physicalFile);
readFile(urls, physicalFile.getParentFile());
} else {
urls.add(url);
}
} catch (Exception e) {
LOG.warn("Error calling getPhysicalFile() on JBoss VirtualFile.", e);
}
return urls;
}
private void readFile(List<URL> urls, File physicalFile) throws MalformedURLException {
if (physicalFile.isDirectory()) {
for (File file : physicalFile.listFiles()) {
if (file.isFile()) {
addIfAbsent(urls, file.toURI().toURL());
} else if (file.isDirectory()) {
readFile(urls, file);
}
}
}
}
private void addIfAbsent(List<URL> urls, URL fileUrl) {
if (!urls.contains(fileUrl)) {
urls.add(fileUrl);
}
}
}
@@ -22,7 +22,6 @@
package org.apache.struts2.views.freemarker;
import com.opensymphony.xwork2.FileManager;
import com.opensymphony.xwork2.FileManagerFactory;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ClassLoaderUtil;
@@ -216,8 +215,8 @@ public class FreemarkerManager {
}
@Inject
public void setFileManagerFactory(FileManagerFactory fileManagerFactory) {
this.fileManager = fileManagerFactory.getFileManager();
public void setFileManager(FileManager fileManager) {
this.fileManager = fileManager;
}
public boolean getNoCharsetInContentType() {
@@ -25,7 +25,7 @@ import java.io.PrintWriter;
import javax.servlet.jsp.tagext.BodyTagSupport;
import org.apache.struts2.util.ComponentUtils;
import org.apache.struts2.components.Component;
import org.apache.struts2.util.FastByteArrayOutputStream;
import com.opensymphony.xwork2.util.TextParseUtil;
@@ -49,17 +49,17 @@ public class StrutsBodyTagSupport extends BodyTagSupport {
}
protected Object findValue(String expr) {
expr = ComponentUtils.stripExpressionIfAltSyntax(getStack(), expr);
expr = Component.stripExpressionIfAltSyntax(getStack(), expr);
return getStack().findValue(expr);
}
protected Object findValue(String expr, Class toType) {
if (ComponentUtils.altSyntax(getStack()) && toType == String.class) {
if (Component.altSyntax(getStack()) && toType == String.class) {
return TextParseUtil.translateVariables('%', expr, getStack());
//return translateVariables(expr, getStack());
} else {
expr = ComponentUtils.stripExpressionIfAltSyntax(getStack(), expr);
expr = Component.stripExpressionIfAltSyntax(getStack(), expr);
return getStack().findValue(expr, toType);
}
@@ -31,9 +31,6 @@ public abstract class AbstractDoubleListTag extends AbstractRequiredListTag {
protected String doubleList;
protected String doubleListKey;
protected String doubleListValue;
protected String doubleListCssClass;
protected String doubleListCssStyle;
protected String doubleListTitle;
protected String doubleName;
protected String doubleValue;
protected String formName;
@@ -79,9 +76,6 @@ public abstract class AbstractDoubleListTag extends AbstractRequiredListTag {
bean.setDoubleList(doubleList);
bean.setDoubleListKey(doubleListKey);
bean.setDoubleListValue(doubleListValue);
bean.setDoubleListCssClass(doubleListCssClass);
bean.setDoubleListCssStyle(doubleListCssStyle);
bean.setDoubleListTitle(doubleListTitle);
bean.setDoubleName(doubleName);
bean.setDoubleValue(doubleValue);
bean.setFormName(formName);
@@ -133,18 +127,6 @@ public abstract class AbstractDoubleListTag extends AbstractRequiredListTag {
this.doubleListValue = listValue;
}
public void setDoubleListCssClass(String doubleListCssClass) {
this.doubleListCssClass = doubleListCssClass;
}
public void setDoubleListCssStyle(String doubleListCssStyle) {
this.doubleListCssStyle = doubleListCssStyle;
}
public void setDoubleListTitle(String doubleListTitle) {
this.doubleListTitle = doubleListTitle;
}
public void setDoubleName(String aName) {
doubleName = aName;
}
@@ -29,9 +29,6 @@ public abstract class AbstractListTag extends AbstractUITag {
protected String list;
protected String listKey;
protected String listValue;
protected String listCssClass;
protected String listCssStyle;
protected String listTitle;
protected void populateParams() {
super.populateParams();
@@ -40,9 +37,6 @@ public abstract class AbstractListTag extends AbstractUITag {
listUIBean.setList(list);
listUIBean.setListKey(listKey);
listUIBean.setListValue(listValue);
listUIBean.setListCssClass(listCssClass);
listUIBean.setListCssStyle(listCssStyle);
listUIBean.setListTitle(listTitle);
}
public void setList(String list) {
@@ -56,16 +50,4 @@ public abstract class AbstractListTag extends AbstractUITag {
public void setListValue(String listValue) {
this.listValue = listValue;
}
public void setListCssClass(String listCssClass) {
this.listCssClass = listCssClass;
}
public void setListCssStyle(String listCssStyle) {
this.listCssStyle = listCssStyle;
}
public void setListTitle(String listTitle) {
this.listTitle = listTitle;
}
}
@@ -23,7 +23,6 @@ package org.apache.struts2.views.jsp.ui;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.struts2.components.UIBean;
import org.apache.struts2.util.ComponentUtils;
import org.apache.struts2.views.jsp.ComponentTagSupport;
import javax.servlet.jsp.JspException;
@@ -292,11 +291,10 @@ public abstract class AbstractUITag extends ComponentTagSupport implements Dynam
}
public void setDynamicAttribute(String uri, String localName, Object value) throws JspException {
if (ComponentUtils.altSyntax(getStack()) && ComponentUtils.isExpression(value)) {
if (value != null && value instanceof String) {
dynamicAttributes.put(localName, String.valueOf(ObjectUtils.defaultIfNull(findValue(value.toString()), value)));
} else {
dynamicAttributes.put(localName, value);
}
}
}
@@ -21,12 +21,13 @@
package org.apache.struts2.views.jsp.ui;
import com.opensymphony.xwork2.util.ValueStack;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
import org.apache.struts2.components.TextField;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.opensymphony.xwork2.util.ValueStack;
/**
* @see TextField
@@ -38,7 +39,6 @@ public class TextFieldTag extends AbstractUITag {
protected String maxlength;
protected String readonly;
protected String size;
protected String type;
public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
return new TextField(stack, req, res);
@@ -51,7 +51,6 @@ public class TextFieldTag extends AbstractUITag {
textField.setMaxlength(maxlength);
textField.setReadonly(readonly);
textField.setSize(size);
textField.setType(type);
}
/**
@@ -72,8 +71,4 @@ public class TextFieldTag extends AbstractUITag {
public void setSize(String size) {
this.size = size;
}
public void setType(String type) {
this.type = type;
}
}
@@ -207,8 +207,4 @@ struts.ognl.logMissingProperties=false
### Caches parsed OGNL expressions, but can lead to memory leaks
### if the application generates a lot of different expressions
struts.ognl.enableExpressionCache=true
### Indicates if Dispatcher should handle unexpected exceptions by calling sendError()
### or simply rethrow it as a ServletException to allow future processing by other frameworks like Spring Security
struts.handle.exception=true
### END SNIPPET: complete_file
@@ -27,14 +27,10 @@ struts.messages.invalid.file=Could not find a Filename for {0}. Verify that a va
struts.messages.invalid.content.type=Could not find a Content-Type for {0}. Verify that a valid file was submitted.
struts.messages.removing.file=Removing file {0} {1}
struts.messages.error.uploading=Error uploading: {0}
struts.messages.error.file.too.large=The file is to large to be uploaded: {0} "{1}" "{2}" {3}
struts.messages.error.file.too.large=File too large: {0} "{1}" "{2}" {3}
struts.messages.error.content.type.not.allowed=Content-Type not allowed: {0} "{1}" "{2}" {3}
struts.messages.error.file.extension.not.allowed=File extension not allowed: {0} "{1}" "{2}" {3}
# dedicated messages used to handle various problems with file upload - check {@link JakartaMultiPartRequest#parse(HttpServletRequest, String)}
struts.messages.upload.error.SizeLimitExceededException=Request exceeded allowed size limit! Max size allowed is: {0} but request was: {1}!
struts.messages.upload.error.IOException=Error uploading: {0}!
devmode.notification=Developer Notification (set struts.devMode to false to disable this message):\n{0}
struts.exception.missing-package-action.with-context = There is no Action mapped for namespace [{0}] and action name [{1}] associated with context path [{2}].
@@ -30,8 +30,4 @@ struts.messages.error.uploading=Fejl ved upload: {0}
struts.messages.error.file.too.large=Filen er for stor: {0} "{1}" {2}
struts.messages.error.content.type.not.allowed=Content-Type er ikke tilladt: {0} "{1}" {2}
# dedicated messages used to handle various problems with file upload - check {@link JakartaMultiPartRequest#parse(HttpServletRequest, String)}
struts.messages.upload.error.SizeLimitExceededException=Request overskredet tilladte st\u00F8rrelse gr\u00E6nse! Max tilladte st\u00F8rrelse er: {0}, men anmodning var: {1}!
struts.messages.upload.error.IOException=Fejl ved upload: {0}!
devmode.notification=Note til udvikler (ret struts.devMode til 'false' for at deaktivere denne meddelse):\n{0}
@@ -19,21 +19,16 @@
# under the License.
#
struts.messages.invalid.token=Das Formular wurde bereits verarbeitet oder es wurde kein Token angegeben, bitte versuchen Sie es erneut.
struts.internal.invalid.token=Das Formular Token {0} stimmt nicht mit dem Session Token {1} \u00FCberein.
struts.internal.invalid.token=Das Formular Token {0} stimmt nicht mit dem Session Token {1} \u00fcberein.
struts.messages.bypass.request=\u00DCberspringe {0}/{1}
struts.messages.bypass.request=\u00dcberspringe {0}/{1}
struts.messages.current.file=Datei {0} {1} {2} {3}
struts.messages.invalid.file=Es konnte kein Dateiname f\u00FCr {0} ermittelt werden. \u00DCberpr\u00FCfen Sie ob eine g\u00FCltige Datei \u00FCbermittelt wurde.
struts.messages.invalid.content.type=Es konnte kein Content-Type f\u00FCr {0} ermittelt werden. \u00DCberpr\u00FCfen Sie ob eine g\u00FCltige Datei \u00FCbermittelt wurde.
struts.messages.invalid.file=Es konnte kein Dateiname f\u00fcr {0} ermittelt werden. \u00dcberpr\u00fcfen Sie ob eine g\u00fcltige Datei \u00fcbermittelt wurde.
struts.messages.invalid.content.type=Es konnte kein Content-Type f\u00fcr {0} ermittelt werden. \u00dcberpr\u00fcfen Sie ob eine g\u00fcltige Datei \u00fcbermittelt wurde.
struts.messages.removing.file=Entferne Datei {0} {1}
struts.messages.error.uploading=Fehler beim Upload: {0}
struts.messages.error.file.too.large=Datei zu gross: {0} "{1}" "{2}" {3}
struts.messages.error.content.type.not.allowed=Content-Type nicht erlaubt: {0} "{1}" "{2}" {3}
struts.messages.error.file.extension.not.allowed=File extension nicht erlaubt: {0} "{1}" "{2}" {3}
# dedicated messages used to handle various problems with file upload - check {@link JakartaMultiPartRequest#parse(HttpServletRequest, String)}
struts.messages.upload.error.SizeLimitExceededException=Der Request \u00FCbertraf die maximal erlaubte Gr\u00F6\u00DFe und wurde daher abgelehnt. Die maximal zul\u00E4ssige Gr\u00F6\u00DFe ist {0}, die Gr\u00F6\u00DFe der Anfrage betrug aber {1}!
struts.messages.upload.error.IOException=Fehler beim Upload: {0}!
devmode.notification=Entwickler Hinweis (Setzen Sie struts.devMode auf false um diese Nachricht zu deaktivieren):\n{0}
@@ -18,21 +18,17 @@
# specific language governing permissions and limitations
# under the License.
#
struts.messages.invalid.token=Formularz zosta\u0142 ju\u017C przetworzony lub nie za\u0142\u0105czono tokena, spr\u00F3buj ponownie.
struts.messages.invalid.token=Formularz zosta\u0142 ju\u017c przetworzony lub nie za\u0142\u0105czono tokena, spr\u00f3buj ponownie.
struts.internal.invalid.token=Token formularza {0} nie pasuje do tokena sesji {1}.
struts.messages.bypass.request=Omijanie {0}/{1}
struts.messages.current.file=Plik {0} {1} {2} {3}
struts.messages.invalid.file=Nie odnaleziono nazwy pliku dla {0}. Upewnij si\u0119 \u017Ce wys\u0142ano w\u0142a\u015Bciwy plik.
struts.messages.invalid.content.type=Nie odnaleziono Content-Type dla {0}. Upewnij si\u0119 \u017Ce wys\u0142ano w\u0142a\u015Bciwy plik.
struts.messages.invalid.file=Nie odnaleziono nazwy pliku dla {0}. Upewnij si\u0119 \u017ce wys\u0142ano w\u0142a\u015bciwy plik.
struts.messages.invalid.content.type=Nie odnaleziono Content-Type dla {0}. Upewnij si\u0119 \u017ce wys\u0142ano w\u0142a\u015bciwy plik.
struts.messages.removing.file=Usuwanie pliku {0} {1}
struts.messages.error.uploading=B\u0142\u0105d podczas wysy\u0142ania pliku: {0}
struts.messages.error.file.too.large=Plik jest za du\u017Cy: {0} "{1}" "{2}" {3}
struts.messages.error.file.too.large=Plik jest za du\u017cy: {0} "{1}" "{2}" {3}
struts.messages.error.content.type.not.allowed=Niedozwolony Content-Type: {0} "{1}" "{2}" {3}
struts.messages.error.file.extension.not.allowed=Niedozwolony File extension: {0} "{1}" "{2}" {3}
# dedicated messages used to handle various problems with file upload - check {@link JakartaMultiPartRequest#parse(HttpServletRequest, String)}
struts.messages.upload.error.SizeLimitExceededException=Zapytanie przekroczy\u0142o dozwolony limit rozmiaru! Maksymalny rozmiar to: {0} ale \u017C\u0105danie mia\u0142o: {1}!
struts.messages.upload.error.IOException=B\u0142\u0105d podczas wysy\u0142ania pliku: {0}!
devmode.notification=Powiadmienie Developera (ustaw struts.devMode na false by wy\u0142\u0105czy\u0107 t\u0119 wiadomo\u015B\u0107):\n{0}
devmode.notification=Powiadmienie Developera (ustaw struts.devMode na false by wy\u0142\u0105czy\u0107 t\u0119 wiadomo\u015b\u0107):\n{0}
@@ -30,8 +30,4 @@ struts.messages.error.uploading=Erro de uploading: {0}
struts.messages.error.file.too.large=Arquivo muito grande: {0} "{1}" {2}
struts.messages.error.content.type.not.allowed=Content-Type n\u00E3o permitido: {0} "{1}" {2}
# dedicated messages used to handle various problems with file upload - check {@link JakartaMultiPartRequest#parse(HttpServletRequest, String)}
struts.messages.upload.error.SizeLimitExceededException=Pedido excedeu o limite de tamanho permitido! Tamanho m\u00E1ximo permitido \u00E9: {0} mas foi pedido: {1}!
struts.messages.upload.error.IOException=Erro de uploading: {0}!
devmode.notification=Notifica\u00E7\u00E3o para o Desenvolvedor (altere o param\u00EAtro struts.devMode para false para desabilitar esta mensagem):\n{0}
+9 -10
View File
@@ -29,10 +29,8 @@
<bean class="com.opensymphony.xwork2.ObjectFactory" name="xwork" />
<bean type="com.opensymphony.xwork2.ObjectFactory" name="struts" class="org.apache.struts2.impl.StrutsObjectFactory" />
<bean type="com.opensymphony.xwork2.FileManager" class="com.opensymphony.xwork2.util.fs.DefaultFileManager" name="system"/>
<bean type="com.opensymphony.xwork2.FileManagerFactory" class="com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory" name="xwork"/>
<bean type="com.opensymphony.xwork2.FileManagerFactory" class="com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory" name="struts"/>
<bean type="com.opensymphony.xwork2.FileManager" class="com.opensymphony.xwork2.util.fs.DefaultFileManager" name="xwork"/>
<bean type="com.opensymphony.xwork2.FileManager" class="com.opensymphony.xwork2.util.fs.DefaultFileManager" name="struts"/>
<bean type="com.opensymphony.xwork2.ActionProxyFactory" name="xwork" class="com.opensymphony.xwork2.DefaultActionProxyFactory"/>
<bean type="com.opensymphony.xwork2.ActionProxyFactory" name="struts" class="org.apache.struts2.impl.StrutsActionProxyFactory"/>
@@ -65,16 +63,17 @@
<bean type="org.apache.struts2.components.template.TemplateEngine" name="jsp" class="org.apache.struts2.components.template.JspTemplateEngine" />
<bean type="com.opensymphony.xwork2.conversion.impl.XWorkConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.XWorkConverter" />
<bean type="com.opensymphony.xwork2.conversion.impl.XWorkConverter" name="xwork1" class="com.opensymphony.xwork2.conversion.impl.XWorkConverter" />
<bean class="com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter" />
<bean type="com.opensymphony.xwork2.conversion.impl.CollectionConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.CollectionConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.impl.ArrayConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.ArrayConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.impl.DateConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.DateConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.impl.NumberConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.NumberConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.impl.StringConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.StringConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.TypeConverter" name="collection" class="com.opensymphony.xwork2.conversion.impl.CollectionConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.TypeConverter" name="array" class="com.opensymphony.xwork2.conversion.impl.ArrayConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.TypeConverter" name="date" class="com.opensymphony.xwork2.conversion.impl.DateConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.TypeConverter" name="number" class="com.opensymphony.xwork2.conversion.impl.NumberConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.conversion.TypeConverter" name="string" class="com.opensymphony.xwork2.conversion.impl.StringConverter" scope="singleton"/>
<bean type="com.opensymphony.xwork2.TextProvider" name="xwork1" class="com.opensymphony.xwork2.TextProviderSupport" scope="default" />
<bean type="com.opensymphony.xwork2.TextProvider" name="struts" class="com.opensymphony.xwork2.TextProviderSupport" scope="default" />
<bean type="com.opensymphony.xwork2.LocaleProvider" name="struts" class="com.opensymphony.xwork2.DefaultLocaleProvider" scope="singleton" />
<bean type="org.apache.struts2.components.UrlRenderer" name="struts" class="org.apache.struts2.components.ServletUrlRenderer"/>
<bean type="org.apache.struts2.views.util.UrlHelper" name="struts" class="org.apache.struts2.views.util.DefaultUrlHelper"/>
@@ -34,27 +34,6 @@
<#else>
<#assign itemValue = stack.findString('top')/>
</#if>
<#if parameters.listCssClass??>
<#if stack.findString(parameters.listCssClass)??>
<#assign itemCssClass= stack.findString(parameters.listCssClass)/>
<#else>
<#assign itemCssClass = ''/>
</#if>
</#if>
<#if parameters.listCssStyle??>
<#if stack.findString(parameters.listCssStyle)??>
<#assign itemCssStyle= stack.findString(parameters.listCssStyle)/>
<#else>
<#assign itemCssStyle = ''/>
</#if>
</#if>
<#if parameters.listTitle??>
<#if stack.findString(parameters.listTitle)??>
<#assign itemTitle= stack.findString(parameters.listTitle)/>
<#else>
<#assign itemTitle = ''/>
</#if>
</#if>
<#assign itemKeyStr=itemKey.toString() />
<input type="checkbox" name="${parameters.name?html}" value="${itemKeyStr?html}"
id="${parameters.name?html}-${itemCount}"<#rt/>
@@ -64,26 +43,8 @@
<#if parameters.disabled?default(false)>
disabled="disabled"<#rt/>
</#if>
<#if itemCssClass?if_exists != "">
class="${itemCssClass?html}"<#rt/>
<#else>
<#if parameters.cssClass??>
class="${parameters.cssClass?html}"<#rt/>
</#if>
</#if>
<#if itemCssStyle?if_exists != "">
style="${itemCssStyle?html}"<#rt/>
<#else>
<#if parameters.cssStyle??>
style="${parameters.cssStyle?html}"<#rt/>
</#if>
</#if>
<#if itemTitle?if_exists != "">
title="${itemTitle?html}"<#rt/>
<#else>
<#if parameters.title??>
title="${parameters.title?html}"<#rt/>
</#if>
<#if parameters.title??>
title="${parameters.title?html}"<#rt/>
</#if>
<#include "/${parameters.templateDir}/simple/css.ftl" />
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
@@ -61,40 +61,10 @@
<#else>
<#assign tmpListValue = stack.findString('top') />
</#if>
<#if parameters.listCssClass??>
<#if stack.findString(parameters.listCssClass)??>
<#assign itemCssClass= stack.findString(parameters.listCssClass)/>
<#else>
<#assign itemCssClass = ''/>
</#if>
</#if>
<#if parameters.listCssStyle??>
<#if stack.findString(parameters.listCssStyle)??>
<#assign itemCssStyle= stack.findString(parameters.listCssStyle)/>
<#else>
<#assign itemCssStyle = ''/>
</#if>
</#if>
<#if parameters.listTitle??>
<#if stack.findString(parameters.listTitle)??>
<#assign itemTitle= stack.findString(parameters.listTitle)/>
<#else>
<#assign itemTitle = ''/>
</#if>
</#if>
<option value="${tmpListKey?html}"<#rt/>
<#if (parameters.nameValue == tmpListKey)>
selected="selected"<#rt/>
</#if>
<#if itemCssClass?if_exists != "">
class="${itemCssClass?html}"<#rt/>
</#if>
<#if itemCssStyle?if_exists != "">
style="${itemCssStyle?html}"<#rt/>
</#if>
<#if itemTitle?if_exists != "">
title="${itemTitle?html}"<#rt/>
</#if>
><#t/>
${tmpListValue?html}<#t/>
</option><#lt/>
@@ -110,37 +110,7 @@
<#else>
<#assign doubleItemValue = stack.findString('top')/>
</#if>
<#if parameters.doubleListCssClass??>
<#if stack.findString(parameters.doubleListCssClass)??>
<#assign itemDoubleCssClass= stack.findString(parameters.doubleListCssClass)/>
<#else>
<#assign itemDoubleCssClass = ''/>
</#if>
</#if>
<#if parameters.doubleListCssStyle??>
<#if stack.findString(parameters.doubleListCssStyle)??>
<#assign itemDoubleCssStyle= stack.findString(parameters.doubleListCssStyle)/>
<#else>
<#assign itemDoubleCssStyle = ''/>
</#if>
</#if>
<#if parameters.doubleListTitle??>
<#if stack.findString(parameters.doubleListTitle)??>
<#assign itemDoubleTitle= stack.findString(parameters.doubleListTitle)/>
<#else>
<#assign itemDoubleTitle = ''/>
</#if>
</#if>
${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue?js_string}", "${doubleItemKeyStr?js_string}");
<#if itemDoubleCssClass?if_exists != "">
${parameters.id}Group[${itemCount}][${doubleItemCount}].setAttribute("class","${itemDoubleCssClass?html}");
</#if>
<#if itemDoubleCssStyle?if_exists != "">
${parameters.id}Group[${itemCount}][${doubleItemCount}].setAttribute("style","${itemDoubleCssStyle?html}");
</#if>
<#if itemDoubleTitle?if_exists != "">
${parameters.id}Group[${itemCount}][${doubleItemCount}].setAttribute("title","${itemDoubleTitle?html}");
</#if>
<#assign doubleItemCount = doubleItemCount + 1/>
</@s.iterator>
@@ -24,11 +24,7 @@
<#assign aKeys = parameters.dynamicAttributes.keySet()><#rt/>
<#list aKeys as aKey><#rt/>
<#assign keyValue = parameters.dynamicAttributes[aKey]/>
<#if keyValue?is_string>
<#assign value = struts.translateVariables(keyValue)!keyValue/>
<#else>
<#assign value = keyValue?string/>
</#if>
<#assign value = struts.translateVariables(keyValue)!keyValue/>
${aKey}="${value?html}"<#rt/>
</#list><#rt/>
</#if><#rt/>
@@ -214,14 +214,11 @@
onmousedown="${parameters.doubleOnmousedown?html}"
</#if><#t/>
<#if parameters.doubleOnmouseup??><#t/>
onmouseup="${parameters.doubleOnmouseup?html}"
onmouseup="${parameters.doubleMnmouseup?html}"
</#if><#t/>
<#if parameters.doubleOnmousemove??><#t/>
onmousemove="${parameters.doubleOnmousemove?html}"
</#if><#t/>
<#if parameters.doubleOnmouseover??><#t/>
onmouseover="${parameters.doubleOnmouseover?html}"
</#if><#t/>
<#if parameters.doubleOnmouseout??><#t/>
onmouseout="${parameters.doubleOnmouseout?html}"
</#if><#t/>
@@ -32,27 +32,6 @@
<#else>
<#assign itemValue = stack.findString('top')/>
</#if>
<#if parameters.listCssClass??>
<#if stack.findString(parameters.listCssClass)??>
<#assign itemCssClass= stack.findString(parameters.listCssClass)/>
<#else>
<#assign itemCssClass = ''/>
</#if>
</#if>
<#if parameters.listCssStyle??>
<#if stack.findString(parameters.listCssStyle)??>
<#assign itemCssStyle= stack.findString(parameters.listCssStyle)/>
<#else>
<#assign itemCssStyle = ''/>
</#if>
</#if>
<#if parameters.listTitle??>
<#if stack.findString(parameters.listTitle)??>
<#assign itemTitle= stack.findString(parameters.listTitle)/>
<#else>
<#assign itemTitle = ''/>
</#if>
</#if>
<input type="radio"<#rt/>
<#if parameters.name??>
name="${parameters.name?html}"<#rt/>
@@ -70,33 +49,21 @@
<#if parameters.tabindex??>
tabindex="${parameters.tabindex?html}"<#rt/>
</#if>
<#if itemCssClass?if_exists != "">
class="${itemCssClass?html}"<#rt/>
<#else>
<#if parameters.cssClass??>
<#if parameters.cssClass??>
class="${parameters.cssClass?html}"<#rt/>
</#if>
</#if>
<#if itemCssStyle?if_exists != "">
style="${itemCssStyle?html}"<#rt/>
<#else>
<#if parameters.cssStyle??>
<#if parameters.cssStyle??>
style="${parameters.cssStyle?html}"<#rt/>
</#if>
</#if>
<#if itemTitle?if_exists != "">
title="${itemTitle?html}"<#rt/>
<#else>
<#if parameters.title??>
title="${parameters.title?html}"<#rt/>
</#if>
</#if>
<#include "/${parameters.templateDir}/simple/css.ftl" />
<#if parameters.title??>
title="${parameters.title?html}"<#rt/>
</#if>
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
<#include "/${parameters.templateDir}/simple/common-attributes.ftl" />
<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" />
/><#rt/>
<label for="${parameters.id?html}${itemKeyStr?html}"<#include "/${parameters.templateDir}/simple/css.ftl"/>><#rt/>
<label for="${parameters.id?html}${itemKeyStr?html}"><#rt/>
${itemValue}<#t/>
</label>
</@s.iterator>
@@ -78,40 +78,10 @@
<#else>
<#assign itemValue = stack.findString('top')/>
</#if>
<#if parameters.listCssClass??>
<#if stack.findString(parameters.listCssClass)??>
<#assign itemCssClass= stack.findString(parameters.listCssClass)/>
<#else>
<#assign itemCssClass = ''/>
</#if>
</#if>
<#if parameters.listCssStyle??>
<#if stack.findString(parameters.listCssStyle)??>
<#assign itemCssStyle= stack.findString(parameters.listCssStyle)/>
<#else>
<#assign itemCssStyle = ''/>
</#if>
</#if>
<#if parameters.listTitle??>
<#if stack.findString(parameters.listTitle)??>
<#assign itemTitle= stack.findString(parameters.listTitle)/>
<#else>
<#assign itemTitle = ''/>
</#if>
</#if>
<option value="${itemKeyStr?html}"<#rt/>
<#if tag.contains(parameters.nameValue, itemKey) == true>
selected="selected"<#rt/>
</#if>
<#if itemCssClass?if_exists != "">
class="${itemCssClass?html}"<#rt/>
</#if>
<#if itemCssStyle?if_exists != "">
style="${itemCssStyle?html}"<#rt/>
</#if>
<#if itemTitle?if_exists != "">
title="${itemTitle?html}"<#rt/>
</#if>
>${itemValue?html}</option><#lt/>
</@s.iterator>
@@ -20,8 +20,7 @@
* under the License.
*/
-->
<input<#rt/>
type="${parameters.type?default("text")?html}"<#rt/>
<input type="text"<#rt/>
name="${parameters.name?default("")?html}"<#rt/>
<#if parameters.get("size")??>
size="${parameters.get("size")?html}"<#rt/>
@@ -137,22 +137,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.</td>
</tr>
<tr>
<td align="left" valign="top">listCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">listCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">listKey</td>
<td align="left" valign="top">false</td>
@@ -161,14 +145,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top"> Property of list objects to get field value from</td>
</tr>
<tr>
<td align="left" valign="top">listTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">listValue</td>
<td align="left" valign="top">false</td>
@@ -425,14 +425,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Icon path used for image that will have the tooltip</td>
</tr>
<tr>
<td align="left" valign="top">type</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">text</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Specifies the html5 type element to display. e.g. text, email, url</td>
</tr>
<tr>
<td align="left" valign="top">value</td>
<td align="left" valign="top">false</td>
@@ -153,22 +153,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">The second iterable source to populate from.</td>
</tr>
<tr>
<td align="left" valign="top">doubleListCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of second list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">doubleListCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of second list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">doubleListKey</td>
<td align="left" valign="top">false</td>
@@ -177,14 +161,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">The key expression to use for second list</td>
</tr>
<tr>
<td align="left" valign="top">doubleListTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of second list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">doubleListValue</td>
<td align="left" valign="top">false</td>
@@ -425,22 +401,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.</td>
</tr>
<tr>
<td align="left" valign="top">listCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">listCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">listKey</td>
<td align="left" valign="top">false</td>
@@ -449,14 +409,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top"> Property of list objects to get field value from</td>
</tr>
<tr>
<td align="left" valign="top">listTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">listValue</td>
<td align="left" valign="top">false</td>
+1 -1
View File
@@ -20,7 +20,7 @@ Please do not edit it directly.
<!-- START SNIPPET: tagattributes -->
<table width="100%">
<tr>
<td colspan="6"><h4>Dynamic Attributes Allowed:</h4> true</td>
<td colspan="6"><h4>Dynamic Attributes Allowed:</h4> false</td>
</tr>
<tr>
<td colspan="6">&nbsp;</td>
@@ -209,22 +209,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.</td>
</tr>
<tr>
<td align="left" valign="top">listCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">listCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">listKey</td>
<td align="left" valign="top">false</td>
@@ -233,14 +217,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top"> Property of list objects to get field value from</td>
</tr>
<tr>
<td align="left" valign="top">listTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">listValue</td>
<td align="left" valign="top">false</td>
@@ -289,22 +289,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">The second iterable source to populate from.</td>
</tr>
<tr>
<td align="left" valign="top">doubleListCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of second list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">doubleListCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of second list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">doubleListKey</td>
<td align="left" valign="top">false</td>
@@ -313,14 +297,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">The key expression to use for second list</td>
</tr>
<tr>
<td align="left" valign="top">doubleListTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of second list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">doubleListValue</td>
<td align="left" valign="top">false</td>
@@ -585,22 +561,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.</td>
</tr>
<tr>
<td align="left" valign="top">listCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">listCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">listKey</td>
<td align="left" valign="top">false</td>
@@ -609,14 +569,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top"> Property of list objects to get field value from</td>
</tr>
<tr>
<td align="left" valign="top">listTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">listValue</td>
<td align="left" valign="top">false</td>
@@ -385,14 +385,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Icon path used for image that will have the tooltip</td>
</tr>
<tr>
<td align="left" valign="top">type</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">text</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Specifies the html5 type element to display. e.g. text, email, url</td>
</tr>
<tr>
<td align="left" valign="top">value</td>
<td align="left" valign="top">false</td>
+1 -25
View File
@@ -20,7 +20,7 @@ Please do not edit it directly.
<!-- START SNIPPET: tagattributes -->
<table width="100%">
<tr>
<td colspan="6"><h4>Dynamic Attributes Allowed:</h4> true</td>
<td colspan="6"><h4>Dynamic Attributes Allowed:</h4> false</td>
</tr>
<tr>
<td colspan="6">&nbsp;</td>
@@ -137,22 +137,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.</td>
</tr>
<tr>
<td align="left" valign="top">listCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">listCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">listKey</td>
<td align="left" valign="top">false</td>
@@ -161,14 +145,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top"> Property of list objects to get field value from</td>
</tr>
<tr>
<td align="left" valign="top">listTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">listValue</td>
<td align="left" valign="top">false</td>
-24
View File
@@ -161,22 +161,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.</td>
</tr>
<tr>
<td align="left" valign="top">listCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">listCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">listKey</td>
<td align="left" valign="top">false</td>
@@ -185,14 +169,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top"> Property of list objects to get field value from</td>
</tr>
<tr>
<td align="left" valign="top">listTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">listValue</td>
<td align="left" valign="top">false</td>
@@ -377,14 +377,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Icon path used for image that will have the tooltip</td>
</tr>
<tr>
<td align="left" valign="top">type</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">text</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Specifies the html5 type element to display. e.g. text, email, url</td>
</tr>
<tr>
<td align="left" valign="top">value</td>
<td align="left" valign="top">false</td>
@@ -185,22 +185,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top">Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.</td>
</tr>
<tr>
<td align="left" valign="top">listCssClass</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css class from</td>
</tr>
<tr>
<td align="left" valign="top">listCssStyle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get css style from</td>
</tr>
<tr>
<td align="left" valign="top">listKey</td>
<td align="left" valign="top">false</td>
@@ -209,14 +193,6 @@ Please do not edit it directly.
<td align="left" valign="top">String</td>
<td align="left" valign="top"> Property of list objects to get field value from</td>
</tr>
<tr>
<td align="left" valign="top">listTitle</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top"></td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">String</td>
<td align="left" valign="top">Property of list objects to get title from</td>
</tr>
<tr>
<td align="left" valign="top">listValue</td>
<td align="left" valign="top">false</td>
@@ -23,7 +23,7 @@ package org.apache.struts2.dispatcher;
import com.mockobjects.dynamic.C;
import com.mockobjects.dynamic.Mock;
import com.opensymphony.xwork2.FileManagerFactory;
import com.opensymphony.xwork2.FileManager;
import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.ConfigurationManager;
@@ -32,8 +32,8 @@ import com.opensymphony.xwork2.config.entities.InterceptorStackConfig;
import com.opensymphony.xwork2.config.entities.PackageConfig;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.interceptor.Interceptor;
import com.opensymphony.xwork2.util.fs.DefaultFileManager;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
import com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.StrutsTestCase;
import org.apache.struts2.dispatcher.FilterDispatcherTest.InnerDestroyableObjectFactory;
@@ -84,7 +84,7 @@ public class DispatcherTest extends StrutsTestCase {
// given
MockHttpServletRequest req = new MockHttpServletRequest();
req.addHeader("X-Requested-With", "XMLHttpRequest");
req.setCharacterEncoding("UTF-8");
req.setCharacterEncoding("utf-8");
HttpServletResponse res = new MockHttpServletResponse();
Dispatcher du = initDispatcher(new HashMap<String, String>() {{
@@ -95,7 +95,7 @@ public class DispatcherTest extends StrutsTestCase {
du.prepare(req, res);
// then
assertEquals(req.getCharacterEncoding(), "UTF-8");
assertEquals(req.getCharacterEncoding(), "utf-8");
}
public void testSetEncodingIfDiffer() throws Exception {
@@ -198,10 +198,9 @@ public class DispatcherTest extends StrutsTestCase {
mockContainer.expectAndReturn("getInstance", C.args(C.eq(ObjectFactory.class)), destroyedObjectFactory);
mockConfiguration.expectAndReturn("getContainer", mockContainer.proxy());
mockConfiguration.expectAndReturn("getContainer", mockContainer.proxy());
FileManagerFactory fileManagerFactory = new DefaultFileManagerFactory();
container.inject(fileManagerFactory);
mockContainer.expectAndReturn("getInstance", C.args(C.eq(FileManagerFactory.class)), fileManagerFactory);
mockContainer.expectAndReturn("getInstance", C.args(C.eq(FileManagerFactory.class)), fileManagerFactory);
FileManager fileManager = new DefaultFileManager();
mockContainer.expectAndReturn("getInstance", C.args(C.eq(FileManager.class)), fileManager);
mockContainer.expectAndReturn("getInstance", C.args(C.eq(FileManager.class)), fileManager);
mockConfiguration.expect("destroy");
mockConfiguration.matchAndReturn("getPackageConfigs", new HashMap<String, PackageConfig>());
@@ -229,9 +228,7 @@ public class DispatcherTest extends StrutsTestCase {
Mock mockContainer = new Mock(Container.class);
mockContainer.matchAndReturn("getInstance", C.args(C.eq(ObjectFactory.class)), new ObjectFactory());
DefaultFileManagerFactory factory = new DefaultFileManagerFactory();
container.inject(factory);
mockContainer.matchAndReturn("getInstance", C.args(C.eq(FileManagerFactory.class)), factory);
mockContainer.matchAndReturn("getInstance", C.args(C.eq(FileManager.class)), new DefaultFileManager());
Mock mockConfiguration = new Mock(Configuration.class);
mockConfiguration.matchAndReturn("getPackageConfigs", packageConfigs);
@@ -79,20 +79,6 @@ public class ServletRedirectResultTest extends StrutsTestCase implements StrutsS
}
}
public void testFullUrlRedirect() {
view.setLocation("http://localhost/bar/foo.jsp");
responseMock.expect("sendRedirect", C.args(C.eq("http://localhost/bar/foo.jsp")));
try {
view.execute(ai);
requestMock.verify();
responseMock.verify();
} catch (Exception e) {
e.printStackTrace();
fail();
}
}
public void testAbsoluteRedirect303() {
view.setLocation("/bar/foo.jsp");
view.setStatusCode(303);
@@ -23,14 +23,12 @@ package org.apache.struts2.interceptor;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.DefaultLocaleProvider;
import com.opensymphony.xwork2.ValidationAwareSupport;
import com.opensymphony.xwork2.mock.MockActionInvocation;
import com.opensymphony.xwork2.util.ClassLoaderUtil;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.StrutsTestCase;
import org.apache.struts2.TestAction;
import org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest;
import org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper;
import org.springframework.mock.web.MockHttpServletRequest;
@@ -42,6 +40,7 @@ import java.net.URI;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -52,12 +51,11 @@ public class FileUploadInterceptorTest extends StrutsTestCase {
private FileUploadInterceptor interceptor;
private File tempDir;
private TestAction action;
public void testAcceptFileWithEmptyAllowedTypesAndExtensions() throws Exception {
// when allowed type is empty
ValidationAwareSupport validation = new ValidationAwareSupport();
boolean ok = interceptor.acceptFile(action, new File(""), "filename", "text/plain", "inputName", validation);
boolean ok = interceptor.acceptFile(null, new File(""), "filename", "text/plain", "inputName", validation, Locale.getDefault());
assertTrue(ok);
assertTrue(validation.getFieldErrors().isEmpty());
@@ -69,7 +67,7 @@ public class FileUploadInterceptorTest extends StrutsTestCase {
// when file is of allowed types
ValidationAwareSupport validation = new ValidationAwareSupport();
boolean ok = interceptor.acceptFile(action, new File(""), "filename.txt", "text/plain", "inputName", validation);
boolean ok = interceptor.acceptFile(null, new File(""), "filename.txt", "text/plain", "inputName", validation, Locale.getDefault());
assertTrue(ok);
assertTrue(validation.getFieldErrors().isEmpty());
@@ -77,7 +75,7 @@ public class FileUploadInterceptorTest extends StrutsTestCase {
// when file is not of allowed types
validation = new ValidationAwareSupport();
boolean notOk = interceptor.acceptFile(action, new File(""), "filename.html", "text/html", "inputName", validation);
boolean notOk = interceptor.acceptFile(null, new File(""), "filename.html", "text/html", "inputName", validation, Locale.getDefault());
assertFalse(notOk);
assertFalse(validation.getFieldErrors().isEmpty());
@@ -89,7 +87,7 @@ public class FileUploadInterceptorTest extends StrutsTestCase {
interceptor.setAllowedTypes("text/*");
ValidationAwareSupport validation = new ValidationAwareSupport();
boolean ok = interceptor.acceptFile(action, new File(""), "filename.txt", "text/plain", "inputName", validation);
boolean ok = interceptor.acceptFile(null, new File(""), "filename.txt", "text/plain", "inputName", validation, Locale.getDefault());
assertTrue(ok);
assertTrue(validation.getFieldErrors().isEmpty());
@@ -97,7 +95,7 @@ public class FileUploadInterceptorTest extends StrutsTestCase {
interceptor.setAllowedTypes("text/h*");
validation = new ValidationAwareSupport();
boolean notOk = interceptor.acceptFile(action, new File(""), "filename.html", "text/plain", "inputName", validation);
boolean notOk = interceptor.acceptFile(null, new File(""), "filename.html", "text/plain", "inputName", validation, Locale.getDefault());
assertFalse(notOk);
assertFalse(validation.getFieldErrors().isEmpty());
@@ -109,7 +107,7 @@ public class FileUploadInterceptorTest extends StrutsTestCase {
// when file is of allowed extensions
ValidationAwareSupport validation = new ValidationAwareSupport();
boolean ok = interceptor.acceptFile(action, new File(""), "filename.txt", "text/plain", "inputName", validation);
boolean ok = interceptor.acceptFile(null, new File(""), "filename.txt", "text/plain", "inputName", validation, Locale.getDefault());
assertTrue(ok);
assertTrue(validation.getFieldErrors().isEmpty());
@@ -117,7 +115,7 @@ public class FileUploadInterceptorTest extends StrutsTestCase {
// when file is not of allowed extensions
validation = new ValidationAwareSupport();
boolean notOk = interceptor.acceptFile(action, new File(""), "filename.html", "text/html", "inputName", validation);
boolean notOk = interceptor.acceptFile(null, new File(""), "filename.html", "text/html", "inputName", validation, Locale.getDefault());
assertFalse(notOk);
assertFalse(validation.getFieldErrors().isEmpty());
@@ -126,7 +124,7 @@ public class FileUploadInterceptorTest extends StrutsTestCase {
//test with multiple extensions
interceptor.setAllowedExtensions(".txt,.lol");
validation = new ValidationAwareSupport();
ok = interceptor.acceptFile(action, new File(""), "filename.lol", "text/plain", "inputName", validation);
ok = interceptor.acceptFile(null, new File(""), "filename.lol", "text/plain", "inputName", validation, Locale.getDefault());
assertTrue(ok);
assertTrue(validation.getFieldErrors().isEmpty());
@@ -139,7 +137,7 @@ public class FileUploadInterceptorTest extends StrutsTestCase {
// when file is not of allowed types
ValidationAwareSupport validation = new ValidationAwareSupport();
boolean notOk = interceptor.acceptFile(action, null, "filename.html", "text/html", "inputName", validation);
boolean notOk = interceptor.acceptFile(null, null, "filename.html", "text/html", "inputName", validation, Locale.getDefault());
assertFalse(notOk);
assertFalse(validation.getFieldErrors().isEmpty());
@@ -161,7 +159,7 @@ public class FileUploadInterceptorTest extends StrutsTestCase {
URL url = ClassLoaderUtil.getResource("log4j.properties", FileUploadInterceptorTest.class);
File file = new File(new URI(url.toString()));
assertTrue("log4j.properties should be in src/test folder", file.exists());
boolean notOk = interceptor.acceptFile(action, file, "filename", "text/html", "inputName", validation);
boolean notOk = interceptor.acceptFile(null, file, "filename", "text/html", "inputName", validation, Locale.getDefault());
assertFalse(notOk);
assertFalse(validation.getFieldErrors().isEmpty());
@@ -358,12 +356,11 @@ public class FileUploadInterceptorTest extends StrutsTestCase {
private MultiPartRequestWrapper createMultipartRequest(HttpServletRequest req, int maxsize) throws IOException {
JakartaMultiPartRequest jak = new JakartaMultiPartRequest();
jak.setMaxSize(String.valueOf(maxsize));
return new MultiPartRequestWrapper(jak, req, tempDir.getAbsolutePath(), new DefaultLocaleProvider());
return new MultiPartRequestWrapper(jak, req, tempDir.getAbsolutePath());
}
protected void setUp() throws Exception {
super.setUp();
action = new TestAction();
interceptor = new FileUploadInterceptor();
container.inject(interceptor);
tempDir = File.createTempFile("struts", "fileupload");
@@ -1,104 +0,0 @@
package org.apache.struts2.util;
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.util.ValueStack;
import com.opensymphony.xwork2.util.ValueStackFactory;
import com.opensymphony.xwork2.util.location.LocatableProperties;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.StrutsTestCase;
public class ComponentUtilsTest extends StrutsTestCase {
public void testStripExpression() throws Exception {
// given
ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();
String anExpression = "%{foo}";
// when
String actual = ComponentUtils.stripExpressionIfAltSyntax(stack, anExpression);
// then
assertEquals(actual, "foo");
}
public void testNoStripExpressionIfNoAltSyntax() throws Exception {
// given
loadConfigurationProviders(new MockConfigurationProvider());
ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();
String anExpression = "%{foo}";
// when
String actual = ComponentUtils.stripExpressionIfAltSyntax(stack, anExpression);
// then
assertEquals(actual, "%{foo}");
}
public void testAltSyntaxIsTrue() throws Exception {
// given
ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();
// when
boolean actual = ComponentUtils.altSyntax(stack);
// then
assertTrue(actual);
}
public void testAltSyntaxIsFalse() throws Exception {
// given
loadConfigurationProviders(new MockConfigurationProvider());
ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();
// when
boolean actual = ComponentUtils.altSyntax(stack);
// then
assertFalse(actual);
}
public void testIsExpressionIsTrue() throws Exception {
// given
String anExpression = "%{foo}";
// when
boolean actual = ComponentUtils.isExpression(anExpression);
// then
assertTrue(actual);
}
public void testIsExpressionIsFalse() throws Exception {
// given
String anExpression = "foo";
// when
boolean actual = ComponentUtils.isExpression(anExpression);
// then
assertFalse(actual);
}
}
class MockConfigurationProvider implements ConfigurationProvider {
public void destroy() {
}
public void init(Configuration configuration) throws ConfigurationException {
}
public boolean needsReload() {
return false;
}
public void loadPackages() throws ConfigurationException {
}
public void register(ContainerBuilder builder, LocatableProperties props) throws ConfigurationException {
builder.constant(StrutsConstants.STRUTS_TAG_ALTSYNTAX, "false");
}
}
@@ -38,38 +38,22 @@ public class TokenHelperTest extends TestCase {
private Map session;
public void testTokenSessionNameBuilding() throws Exception {
String name = "foo";
String sessionName = TokenHelper.buildTokenSessionAttributeName(name);
assertEquals(TokenHelper.TOKEN_NAMESPACE + "." + name, sessionName);
}
public void testSetToken() {
String token = TokenHelper.setToken();
final String defaultSessionTokenName = TokenHelper.buildTokenSessionAttributeName(TokenHelper.DEFAULT_TOKEN_NAME);
assertEquals(token, session.get(defaultSessionTokenName));
assertEquals(token, session.get(TokenHelper.DEFAULT_TOKEN_NAME));
}
public void testSetTokenWithName() {
String tokenName = "myTestToken";
String token = TokenHelper.setToken(tokenName);
final String sessionTokenName = TokenHelper.buildTokenSessionAttributeName(tokenName);
assertEquals(token, session.get(sessionTokenName));
assertEquals(token, session.get(tokenName));
}
public void testSetSessionToken() {
String tokenName = "myOtherTestToken";
String token = "foobar";
TokenHelper.setSessionToken(tokenName, token);
final String sessionTokenName = TokenHelper.buildTokenSessionAttributeName(tokenName);
assertEquals(token, session.get(sessionTokenName));
}
public void testValidToken() {
public void testValidToken() {
String tokenName = "validTokenTest";
String token = TokenHelper.setToken(tokenName);
final String sessionTokenName = TokenHelper.buildTokenSessionAttributeName(tokenName);
assertEquals(token, session.get(sessionTokenName));
assertEquals(token, session.get(tokenName));
ActionContext.getContext().getParameters().put(TokenHelper.TOKEN_NAME_FIELD, new String[]{tokenName});
ActionContext.getContext().getParameters().put(tokenName, new String[]{token});
assertTrue(TokenHelper.validToken());
@@ -24,8 +24,8 @@ package org.apache.struts2.views.freemarker;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.mock.MockActionInvocation;
import com.opensymphony.xwork2.util.ClassLoaderUtil;
import com.opensymphony.xwork2.util.fs.DefaultFileManager;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory;
import freemarker.template.Configuration;
import freemarker.template.TemplateExceptionHandler;
import org.apache.struts2.ServletActionContext;
@@ -44,8 +44,6 @@ import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import static org.apache.struts2.views.jsp.AbstractUITagTest.normalize;
/**
* Test case for FreeMarkerResult.
*
@@ -218,8 +216,7 @@ public class FreeMarkerResultTest extends StrutsTestCase {
ActionMapping mapping = dispatcher.getContainer().getInstance(ActionMapper.class).getMapping(request, dispatcher.getConfigurationManager());
dispatcher.serviceAction(request, response, servletContext, mapping);
String expected = "<input type=\"text\" name=\"test\" value=\"\" id=\"test\" placeholder=\"input\" foo=\"bar\"/>"
+ "<input type=\"text\" name=\"test\" value=\"\" id=\"test\" placeholder=\"input\" foo=\"bar\"/>"
+ "<input type=\"text\" name=\"test\" value=\"\" id=\"test\" break=\"true\"/>";
+ "<input type=\"text\" name=\"test\" value=\"\" id=\"test\" placeholder=\"input\" foo=\"bar\"/>";
assertEquals(expected, stringWriter.toString());
}
@@ -259,38 +256,9 @@ public class FreeMarkerResultTest extends StrutsTestCase {
Dispatcher dispatcher = Dispatcher.getInstance();
ActionMapping mapping = dispatcher.getContainer().getInstance(ActionMapper.class).getMapping(request, dispatcher.getConfigurationManager());
dispatcher.serviceAction(request, response, servletContext, mapping);
String expected = "<input type=\"radio\" name=\"client\" id=\"client_foo\" value=\"foo\"/><label for=\"client_foo\">foo</label>\n"
+ "<input type=\"radio\" name=\"client\" id=\"client_bar\" value=\"bar\"/><label for=\"client_bar\">bar</label>\n"
+ "\n"
+ "<input type=\"radio\" name=\"car\" id=\"carford\" value=\"ford\"/><label for=\"carford\">Ford Motor Co</label>\n"
+ "<input type=\"radio\" name=\"car\" id=\"cartoyota\" value=\"toyota\"/><label for=\"cartoyota\">Toyota</label>\n";
assertEquals(normalize(expected), normalize(stringWriter.toString()));
}
public void testDynamicAttributesInTheme() throws Exception {
FreemarkerManager freemarkerManager = container.getInstance(FreemarkerManager.class);
Configuration freemarkerConfig = freemarkerManager.getConfiguration(ServletActionContext.getServletContext());
freemarkerConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
ServletContext servletContext = EasyMock.createNiceMock(ServletContext.class);
File file = new File(FreeMarkerResultTest.class.getResource("customTextField.ftl").toURI());
EasyMock.expect(servletContext.getRealPath("/tutorial/org/apache/struts2/views/freemarker/customTextField.ftl")).andReturn(file.getAbsolutePath());
file = new File(ClassLoaderUtil.getResource("template/test/text.ftl", getClass()).toURI());
EasyMock.expect(servletContext.getRealPath("/template/test/text.ftl")).andReturn(file.getAbsolutePath());
EasyMock.expect(servletContext.getAttribute(FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY)).andReturn(freemarkerConfig).anyTimes();
EasyMock.replay(servletContext);
freemarkerConfig.setServletContextForTemplateLoading(servletContext, null);
ServletActionContext.setServletContext(servletContext);
request.setRequestURI("/tutorial/test8.action");
Dispatcher dispatcher = Dispatcher.getInstance();
ActionMapping mapping = dispatcher.getContainer().getInstance(ActionMapper.class).getMapping(request, dispatcher.getConfigurationManager());
dispatcher.serviceAction(request, response, servletContext, mapping);
String expected = "<input type=\"text\"autofocus=\"autofocus\"/>";
String expected =
"<input type=\"radio\" name=\"client\" id=\"client_foo\" value=\"foo\"/><label for=\"client_foo\">foo</label>\n" +
"<input type=\"radio\" name=\"client\" id=\"client_bar\" value=\"bar\"/><label for=\"client_bar\">bar</label>\n";
assertEquals(expected, stringWriter.toString());
}
@@ -298,9 +266,7 @@ public class FreeMarkerResultTest extends StrutsTestCase {
super.setUp();
mgr = new FreemarkerManager();
mgr.setEncoding("UTF-8");
DefaultFileManagerFactory factory = new DefaultFileManagerFactory();
container.inject(factory);
mgr.setFileManagerFactory(factory);
mgr.setFileManager(new DefaultFileManager());
stringWriter = new StringWriter();
writer = new PrintWriter(stringWriter);
response = new StrutsMockHttpServletResponse();
@@ -21,7 +21,7 @@
package org.apache.struts2.views.freemarker;
import com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory;
import com.opensymphony.xwork2.util.fs.DefaultFileManager;
import org.apache.commons.io.FileUtils;
import org.apache.struts2.StrutsTestCase;
import org.apache.struts2.views.jsp.StrutsMockServletContext;
@@ -34,9 +34,7 @@ public class FreemarkerManagerTest extends StrutsTestCase {
public void testIfStrutsEncodingIsSetProperty() throws Exception {
FreemarkerManager mgr = new FreemarkerManager();
mgr.setEncoding("UTF-8");
DefaultFileManagerFactory factory = new DefaultFileManagerFactory();
container.inject(factory);
mgr.setFileManagerFactory(factory);
mgr.setFileManager(new DefaultFileManager());
StrutsMockServletContext servletContext = new StrutsMockServletContext();
servletContext.setAttribute(FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY, null);
freemarker.template.Configuration conf = mgr.getConfiguration(servletContext);
@@ -244,6 +244,18 @@ public abstract class AbstractUITagTest extends AbstractTagTest {
* @throws Exception if the validation failed
*/
public void verify(URL url) throws Exception {
verify(url, null);
}
/**
* Attempt to verify the contents of this.writer against the contents of the URL specified. verify() performs a
* trim on both ends
*
* @param url the HTML snippet that we want to validate against
* @param excluded
* @throws Exception if the validation failed
*/
public void verify(URL url, String[] excluded) throws Exception {
if (url == null) {
fail("unable to verify a null URL");
} else if (this.writer == null) {
@@ -71,7 +71,7 @@ public class AnchorTest extends AbstractUITagTest {
AnchorTag tag = createTag();
tag.setHref("a");
tag.setDynamicAttribute("uri", "placeholder", "%{foo}");
tag.setDynamicAttribute("uri", "placeholder", "foo");
tag.doStartTag();
tag.doEndTag();

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