Merge pull request #792 from apache/release/struts-7-0-x

Struts 7.0.x
This commit is contained in:
Lukasz Lenart
2024-11-30 08:55:09 +01:00
committed by GitHub
2367 changed files with 15505 additions and 116279 deletions
+9 -1
View File
@@ -17,7 +17,9 @@ name: "CodeQL"
on:
push:
branches: [ "master" ]
branches:
- master
- release/struts-7-0-x
pull_request:
permissions:
@@ -43,6 +45,12 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java JDK
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: 'maven'
- name: Initialize CodeQL
uses: github/codeql-action/init@v3.27.4
with:
+2 -1
View File
@@ -20,6 +20,7 @@ on:
push:
branches:
- master
- release/struts-7-0-x
permissions: read-all
@@ -33,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11', '17', '21' ]
java: [ '17', '21' ]
steps:
- name: Checkout code
uses: actions/checkout@v4
+2 -1
View File
@@ -20,7 +20,8 @@ on:
schedule:
- cron: "30 1 * * 6" # Weekly on Saturdays
push:
branches: [ "master" ]
branches:
- master
permissions: read-all
+1
View File
@@ -20,6 +20,7 @@ on:
push:
branches:
- master
- release/struts-7-0-x
permissions: read-all
Vendored
+9 -80
View File
@@ -92,7 +92,9 @@ pipeline {
}
stage('Build Source & JavaDoc') {
when {
branch 'release/struts-7-0-x'
anyOf {
branch 'master'; branch 'release/struts-7-0-x'
}
}
steps {
dir("local-snapshots-dir/") {
@@ -103,7 +105,9 @@ pipeline {
}
stage('Deploy Snapshot') {
when {
branch 'release/struts-7-0-x'
anyOf {
branch 'master'; branch 'release/struts-7-0-x'
}
}
steps {
withCredentials([file(credentialsId: 'lukaszlenart-repository-access-token', variable: 'CUSTOM_SETTINGS')]) {
@@ -113,86 +117,11 @@ pipeline {
}
stage('Upload nightlies') {
when {
branch 'release/struts-7-0-x'
}
steps {
sh './mvnw -B package -DskipTests --no-transfer-progress'
sshPublisher(publishers: [
sshPublisherDesc(
configName: 'Nightlies',
transfers: [
sshTransfer(
remoteDirectory: '/struts/snapshot',
removePrefix: 'assembly/target/assembly/out',
sourceFiles: 'assembly/target/assembly/out/struts-*.zip',
cleanRemote: true
)
],
verbose: true
)
])
}
}
}
post {
always {
cleanWs deleteDirs: true, patterns: [[pattern: '**/target/**', type: 'INCLUDE']]
}
}
}
stage('JDK 8') {
agent {
label 'ubuntu'
}
tools {
jdk 'jdk_1.8_latest'
maven 'maven_3_latest'
}
environment {
MAVEN_OPTS = "-Xmx1024m"
}
stages {
stage('Build') {
steps {
sh './mvnw -B clean install -DskipTests -DskipAssembly --no-transfer-progress'
}
}
stage('Test') {
steps {
sh './mvnw -B verify --no-transfer-progress'
}
post {
always {
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
anyOf {
branch 'master'
branch 'release/struts-7-0-x'
}
}
}
stage('Build Source & JavaDoc') {
when {
branch 'master'
}
steps {
dir("local-snapshots-dir/") {
deleteDir()
}
sh './mvnw -B source:jar javadoc:jar -DskipTests -DskipAssembly --no-transfer-progress'
}
}
stage('Deploy Snapshot') {
when {
branch 'master'
}
steps {
withCredentials([file(credentialsId: 'lukaszlenart-repository-access-token', variable: 'CUSTOM_SETTINGS')]) {
sh './mvnw -s \${CUSTOM_SETTINGS} deploy -DskipTests -DskipAssembly --no-transfer-progress'
}
}
}
stage('Upload nightlies') {
when {
branch 'master'
}
steps {
sh './mvnw -B package -DskipTests --no-transfer-progress'
sshPublisher(publishers: [
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>6.7.1-SNAPSHOT</version>
<version>7.0.0-M11-SNAPSHOT</version>
</parent>
<artifactId>struts2-apps</artifactId>
<packaging>pom</packaging>
+4 -4
View File
@@ -24,12 +24,12 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>6.7.1-SNAPSHOT</version>
<version>7.0.0-M11-SNAPSHOT</version>
</parent>
<artifactId>struts2-rest-showcase</artifactId>
<packaging>war</packaging>
<version>6.7.1-SNAPSHOT</version>
<version>7.0.0-M11-SNAPSHOT</version>
<name>Struts 2 Rest Showcase Webapp</name>
<description>Struts 2 Rest Showcase Example</description>
@@ -76,7 +76,7 @@
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<groupId>org.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<scope>test</scope>
</dependency>
@@ -107,7 +107,7 @@
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.46.v20220331</version>
<version>11.0.18</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
@@ -18,9 +18,9 @@
*/
package org.demo.rest.example;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Validateable;
import com.opensymphony.xwork2.ValidationAwareSupport;
import org.apache.struts2.ModelDriven;
import org.apache.struts2.Validateable;
import org.apache.struts2.ValidationAwareSupport;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.convention.annotation.Result;
@@ -26,7 +26,6 @@
</Console>
</Appenders>
<Loggers>
<Logger name="com.opensymphony.xwork2" level="info"/>
<Logger name="org.apache.struts2" level="info"/>
<Logger name="org.demo.rest" level="debug"/>
<Root level="warn">
@@ -18,31 +18,41 @@
*/
package it.org.apache.struts2.rest.example;
import net.sourceforge.jwebunit.junit.WebTestCase;
import org.junit.Before;
import org.junit.Test;
public class GetOrdersTest extends WebTestCase {
import static net.sourceforge.jwebunit.junit.JWebUnit.assertTextNotPresent;
import static net.sourceforge.jwebunit.junit.JWebUnit.assertTextPresent;
import static net.sourceforge.jwebunit.junit.JWebUnit.beginAt;
import static net.sourceforge.jwebunit.junit.JWebUnit.getTestContext;
public class GetOrdersTest {
@Before
public void setUp() throws Exception {
getTestContext().setBaseUrl(ParameterUtils.getBaseUrl());
}
@Test
public void testGetOrders() {
beginAt("/orders/3");
assertTextPresent("Bob");
assertTextNotPresent("Sarah");
}
@Test
public void testGetOrdersInHtml() {
beginAt("/orders/3.xhtml");
assertTextPresent("Bob");
}
@Test
public void testGetOrdersInXml() {
beginAt("/orders/3.xml");
assertTextPresent("<clientName>Bob");
}
@Test
public void testGetOrdersInJson() {
beginAt("/orders/3.json");
assertTextPresent("\"clientName\":\"Bob\"");
@@ -18,15 +18,21 @@
*/
package it.org.apache.struts2.rest.example;
import net.sourceforge.jwebunit.junit.WebTestCase;
import org.junit.Before;
import org.junit.Test;
public class ListOrdersTest extends WebTestCase {
import static net.sourceforge.jwebunit.junit.JWebUnit.assertTextPresent;
import static net.sourceforge.jwebunit.junit.JWebUnit.beginAt;
import static net.sourceforge.jwebunit.junit.JWebUnit.getTestContext;
public class ListOrdersTest {
@Before
public void setUp() throws Exception {
getTestContext().setBaseUrl(ParameterUtils.getBaseUrl());
}
@Test
public void testListOrders() {
beginAt("/orders");
assertTextPresent("Bob");
@@ -34,6 +40,7 @@ public class ListOrdersTest extends WebTestCase {
assertTextPresent("Jim");
}
@Test
public void testListOrdersInHtml() {
beginAt("/orders.xhtml");
assertTextPresent("Bob");
@@ -41,6 +48,7 @@ public class ListOrdersTest extends WebTestCase {
assertTextPresent("Jim");
}
@Test
public void testListOrdersInXml() {
beginAt("/orders.xml");
assertTextPresent("<clientName>Bob");
@@ -48,6 +56,7 @@ public class ListOrdersTest extends WebTestCase {
assertTextPresent("<clientName>Jim");
}
@Test
public void testListOrdersInJson() {
beginAt("/orders.json");
assertTextPresent("\"clientName\":\"Bob\"");
@@ -18,23 +18,37 @@
*/
package it.org.apache.struts2.rest.example;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import net.sourceforge.jwebunit.junit.WebTestCase;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.htmlunit.FailingHttpStatusCodeException;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
public class PostOrderTest extends WebTestCase {
import static net.sourceforge.jwebunit.junit.JWebUnit.assertLinkNotPresentWithText;
import static net.sourceforge.jwebunit.junit.JWebUnit.assertTextFieldEquals;
import static net.sourceforge.jwebunit.junit.JWebUnit.assertTextPresent;
import static net.sourceforge.jwebunit.junit.JWebUnit.beginAt;
import static net.sourceforge.jwebunit.junit.JWebUnit.getTestContext;
import static net.sourceforge.jwebunit.junit.JWebUnit.setTextField;
import static net.sourceforge.jwebunit.junit.JWebUnit.setWorkingForm;
import static net.sourceforge.jwebunit.junit.JWebUnit.submit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
public class PostOrderTest {
@Before
public void setUp() throws Exception {
getTestContext().setBaseUrl(ParameterUtils.getBaseUrl());
}
@Test
public void testPostOrder() {
beginAt("/orders/new");
setWorkingForm(0);
@@ -45,6 +59,7 @@ public class PostOrderTest extends WebTestCase {
assertLinkNotPresentWithText("Back to Orders");
}
@Test
public void testPostOrderWithErrors() {
beginAt("/orders/new");
setWorkingForm(0);
@@ -58,6 +73,7 @@ public class PostOrderTest extends WebTestCase {
assertTextFieldEquals("amount", "321");
}
@Test
public void testPostOrderInHtml() {
beginAt("/orders/new.xhtml");
setWorkingForm(0);
@@ -72,6 +88,7 @@ public class PostOrderTest extends WebTestCase {
assertLinkNotPresentWithText("Back to Orders");
}
@Test
public void testPostOrderInXml() throws IOException {
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(ParameterUtils.getBaseUrl() + "/orders.xml");
@@ -85,6 +102,7 @@ public class PostOrderTest extends WebTestCase {
client.close();
}
@Test
public void testPostOrderInXmlWithBadData() throws IOException {
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(ParameterUtils.getBaseUrl() + "/orders.xml");
@@ -98,6 +116,7 @@ public class PostOrderTest extends WebTestCase {
client.close();
}
@Test
public void testPostOrderInJson() throws IOException {
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(ParameterUtils.getBaseUrl() + "/orders.json");
@@ -108,6 +127,7 @@ public class PostOrderTest extends WebTestCase {
client.close();
}
@Test
public void testPostOrderInJsonWithBadData() throws IOException {
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(ParameterUtils.getBaseUrl() + "/orders.json");
+77 -30
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>6.7.1-SNAPSHOT</version>
<version>7.0.0-M11-SNAPSHOT</version>
</parent>
<artifactId>struts2-showcase</artifactId>
@@ -48,21 +48,11 @@
<artifactId>struts2-config-browser-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-tiles-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-dwr-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-json-plugin</artifactId>
@@ -92,6 +82,14 @@
<groupId>org.apache.struts</groupId>
<artifactId>struts2-velocity-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-velocity-tools-view-jakarta</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-velocity-tools-jsp-jakarta</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
@@ -99,8 +97,8 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
@@ -123,12 +121,9 @@
</dependency>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>sitemesh</artifactId>
</dependency>
<dependency>
<groupId>org.directwebremoting</groupId>
<artifactId>dwr</artifactId>
<groupId>org.sitemesh</groupId>
<artifactId>sitemesh</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
@@ -144,22 +139,71 @@
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<scope>test</scope>
</dependency>
<groupId>org.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<scope>test</scope>
</dependency>
<!-- BeanValidation Example -->
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate-validator.version}</version>
<exclusions>
<exclusion>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--
Nashorn (the built-in JDK javascript engine) was deprecated in JDK 11 and removed in JDK 15
As a result attempting to use @ScriptAssert on JDK 17 leads to the exception
See more details
https://stackoverflow.com/questions/78008950/resolve-org-hibernate-validator-spi-scripting-scriptevaluatornotfoundexception
-->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-jsr223</artifactId>
<version>3.0.22</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<?m2e ignore?>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/extraclasspath</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-velocity-tools-view-jakarta</artifactId>
<destFileName>struts2-velocity-tools-view-jakarta.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-velocity-tools-jsp-jakarta</artifactId>
<destFileName>struts2-velocity-tools-jsp-jakarta.jar</destFileName>
</artifactItem>
</artifactItems>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
@@ -190,7 +234,7 @@
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.46.v20220331</version>
<version>11.0.18</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
@@ -203,12 +247,15 @@
<httpConnector>
<port>8090</port>
</httpConnector>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
<webAppConfig>
<contextPath>/struts2-showcase</contextPath>
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webAppConfig>
<scan>10</scan>
<webApp>
<extraClasspath>
${project.build.directory}/extraclasspath/struts2-velocity-tools-view-jakarta.jar,
${project.build.directory}/extraclasspath/struts2-velocity-tools-jsp-jakarta
</extraClasspath>
<contextPath>/struts2-showcase</contextPath>
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webApp>
</configuration>
<executions>
<execution>
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import java.text.DateFormat;
import java.util.Calendar;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import org.apache.struts2.showcase.ajax.tree.Category;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.ArrayList;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.ArrayList;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import org.apache.struts2.showcase.ajax.tree.Category;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.showcase.ajax.tree.Category;
// START SNIPPET: treeExampleDynamicJavaShow
@@ -20,9 +20,9 @@
*/
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Validateable;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.Validateable;
import org.apache.struts2.util.ValueStack;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
@@ -18,7 +18,7 @@
*/
package org.apache.struts2.showcase.action;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
@@ -18,7 +18,7 @@
*/
package org.apache.struts2.showcase.action;
import com.opensymphony.xwork2.Preparable;
import org.apache.struts2.Preparable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
@@ -18,7 +18,7 @@
*/
package org.apache.struts2.showcase.action;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import java.util.Arrays;
import java.util.Date;
@@ -18,8 +18,8 @@
*/
package org.apache.struts2.showcase.action;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.interceptor.annotations.After;
import org.apache.struts2.action.Action;
import org.apache.struts2.interceptor.annotations.After;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
@@ -18,7 +18,7 @@
*/
package org.apache.struts2.showcase.action;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import org.apache.struts2.showcase.model.MyDto;
@@ -18,7 +18,7 @@
*/
package org.apache.struts2.showcase.action;
import com.opensymphony.xwork2.Preparable;
import org.apache.struts2.Preparable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
@@ -18,7 +18,7 @@
*/
package org.apache.struts2.showcase.actionchaining;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
public class ActionChain1 extends ActionSupport {
@@ -18,7 +18,7 @@
*/
package org.apache.struts2.showcase.actionchaining;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
public class ActionChain2 extends ActionSupport {
@@ -18,7 +18,7 @@
*/
package org.apache.struts2.showcase.actionchaining;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
public class ActionChain3 extends ActionSupport {
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.ajax;
import com.opensymphony.xwork2.Action;
import org.apache.struts2.action.Action;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.io.Serializable;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.ajax;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.ArrayList;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.ajax;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.text.SimpleDateFormat;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.ajax;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
public class Example5Action extends ActionSupport {
@@ -46,8 +46,7 @@ public class Category {
new Category(15, "Dojo"),
new Category(16, "Prototype"),
new Category(17, "Scriptaculous"),
new Category(18, "OpenRico"),
new Category(19, "DWR")));
new Category(18, "OpenRico")));
}
public static Category getById(long id) {
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.ajax.tree;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
@@ -31,9 +31,10 @@ import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.Serial;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* TestDataProvider.
@@ -41,74 +42,76 @@ import java.util.Date;
@Service
public class TestDataProvider implements Serializable, InitializingBean {
private static final long serialVersionUID = 1L;
private static final Logger log = LogManager.getLogger(TestDataProvider.class);
@Serial
private static final long serialVersionUID = 1L;
private static final Logger log = LogManager.getLogger(TestDataProvider.class);
public static final String[] POSITIONS = {
"Developer",
"System Architect",
"Sales Manager",
"CEO"
};
public static final String[] POSITIONS = {
"Developer",
"System Architect",
"Sales Manager",
"CEO"
};
public static final String[] LEVELS = {
"Junior",
"Senior",
"Master"
};
public static final String[] LEVELS = {
"Junior",
"Senior",
"Master"
};
private static final Skill[] TEST_SKILLS = {
new Skill("WW-SEN", "Struts Senior Developer"),
new Skill("WW-JUN", "Struts Junior Developer"),
new Skill("SPRING-DEV", "Spring Developer")
};
private static final Skill[] TEST_SKILLS = {
new Skill("WW-SEN", "Struts Senior Developer"),
new Skill("WW-JUN", "Struts Junior Developer"),
new Skill("SPRING-DEV", "Spring Developer")
};
public static final Employee[] TEST_EMPLOYEES = {
new Employee(new Long(1), "Alan", "Smithee", new Date(), new Float(2000f), true, POSITIONS[0],
TEST_SKILLS[0], null, "alan", LEVELS[0], "Nice guy"),
new Employee(new Long(2), "Robert", "Robson", new Date(), new Float(10000f), false, POSITIONS[1],
TEST_SKILLS[1], Arrays.asList(TEST_SKILLS).subList(1, TEST_SKILLS.length), "rob", LEVELS[1], "Smart guy")
};
public static final Employee[] TEST_EMPLOYEES = {
new Employee(1L, "Alan", "Smithee", new Date(), 2000f, true, POSITIONS[0],
TEST_SKILLS[0], null, "alan", LEVELS[0], "Nice guy"),
new Employee(2L, "Robert", "Robson", new Date(), 10000f, false, POSITIONS[1],
TEST_SKILLS[1], List.of(TEST_SKILLS).subList(1, TEST_SKILLS.length), "rob", LEVELS[1], "Smart guy")
};
@Autowired
private SkillDao skillDao;
@Autowired
private SkillDao skillDao;
@Autowired
private EmployeeDao employeeDao;
@Autowired
private EmployeeDao employeeDao;
protected void addTestSkills() {
try {
for (int i = 0, j = TEST_SKILLS.length; i < j; i++) {
skillDao.merge(TEST_SKILLS[i]);
}
if (log.isInfoEnabled()) {
log.info("TestDataProvider - [addTestSkills]: Added test skill data.");
}
} catch (StorageException e) {
log.error("TestDataProvider - [addTestSkills]: Exception catched: " + e.getMessage());
}
}
protected void addTestSkills() {
try {
for (Skill testSkill : TEST_SKILLS) {
skillDao.merge(testSkill);
}
if (log.isInfoEnabled()) {
log.info("TestDataProvider - [addTestSkills]: Added test skill data.");
}
} catch (StorageException e) {
log.error("TestDataProvider - [addTestSkills]: Exception caught: {}", e.getMessage());
}
}
protected void addTestEmployees() {
try {
for (int i = 0, j = TEST_EMPLOYEES.length; i < j; i++) {
employeeDao.merge(TEST_EMPLOYEES[i]);
}
if (log.isInfoEnabled()) {
log.info("TestDataProvider - [addTestEmployees]: Added test employee data.");
}
} catch (StorageException e) {
log.error("TestDataProvider - [addTestEmployees]: Exception catched: " + e.getMessage());
}
}
protected void addTestEmployees() {
try {
for (Employee testEmployee : TEST_EMPLOYEES) {
employeeDao.merge(testEmployee);
}
if (log.isInfoEnabled()) {
log.info("TestDataProvider - [addTestEmployees]: Added test employee data.");
}
} catch (StorageException e) {
log.error("TestDataProvider - [addTestEmployees]: Exception caught: {}", e.getMessage());
}
}
protected void addTestData() {
addTestSkills();
addTestEmployees();
}
protected void addTestData() {
addTestSkills();
addTestEmployees();
}
public void afterPropertiesSet() throws Exception {
addTestData();
}
@Override
public void afterPropertiesSet() throws Exception {
addTestData();
}
}
@@ -18,13 +18,13 @@
*/
package org.apache.struts2.showcase.async;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
@@ -18,7 +18,7 @@
*/
package org.apache.struts2.showcase.async;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.ArrayList;
@@ -21,10 +21,10 @@
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import org.apache.struts2.action.Action;
import org.apache.struts2.ActionContext;
import org.apache.struts2.ActionInvocation;
import org.apache.struts2.interceptor.AbstractInterceptor;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -20,10 +20,10 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import org.apache.struts2.action.Action;
import org.apache.struts2.ActionContext;
import org.apache.struts2.ActionInvocation;
import org.apache.struts2.interceptor.AbstractInterceptor;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.action.SessionAware;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import java.util.Map;
@@ -25,9 +25,9 @@ import org.apache.logging.log4j.LogManager;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import jakarta.servlet.http.HttpSession;
import jakarta.servlet.http.HttpSessionEvent;
import jakarta.servlet.http.HttpSessionListener;
public class ChatSessionListener implements HttpSessionListener {
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
public class CrudRoomAction extends ActionSupport {
@@ -20,8 +20,8 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
import com.opensymphony.xwork2.inject.Inject;
import org.apache.struts2.conversion.impl.XWorkConverter;
import org.apache.struts2.inject.Inject;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.struts2.util.StrutsTypeConverter;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.action.SessionAware;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.action.SessionAware;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.ArrayList;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import java.util.ArrayList;
import java.util.List;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.action.SessionAware;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import java.util.ArrayList;
import java.util.List;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.chat;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.ArrayList;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.conversion;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.LinkedHashSet;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.conversion;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.Arrays;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.conversion;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.List;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.filedownload;
import com.opensymphony.xwork2.Action;
import org.apache.struts2.action.Action;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.fileupload;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.action.UploadedFilesAware;
import org.apache.struts2.dispatcher.multipart.UploadedFile;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
@@ -21,7 +21,7 @@
// START SNIPPET: entire-file
package org.apache.struts2.showcase.fileupload;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.action.UploadedFilesAware;
import org.apache.struts2.dispatcher.multipart.UploadedFile;
@@ -21,7 +21,7 @@
// START SNIPPET: entire-file
package org.apache.struts2.showcase.fileupload;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.action.UploadedFilesAware;
import org.apache.struts2.dispatcher.multipart.UploadedFile;
@@ -20,12 +20,12 @@
*/
package org.apache.struts2.showcase.freemarker;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.util.ValueStack;
import org.apache.struts2.views.freemarker.FreemarkerManager;
import org.apache.struts2.views.freemarker.ScopesHashModel;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
/**
* <p>
@@ -20,8 +20,8 @@
*/
package org.apache.struts2.showcase.freemarker;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.Preparable;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.text.DateFormatSymbols;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.hangman;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import java.util.Map;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.hangman;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.action.SessionAware;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
@@ -20,40 +20,34 @@
*/
package org.apache.struts2.showcase.hangman;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Hangman implements Serializable {
private static final Logger log = LogManager.getLogger(Hangman.class);
@Serial
private static final long serialVersionUID = 8566954355839652509L;
private Vocab vocab;
private final Vocab vocab;
private Boolean win = false;
private int guessLeft = 5;
public List<Character> charactersAvailable;
public final List<Character> charactersAvailable;
public List<Character> charactersGuessed;
public Hangman(Vocab vocab) {
// Arrays.asList(...) returns List that doesn't support remove(), hence
// we wrap it with an ArrayList to avoid UnsupportedOperationException
// when doing a remove()
charactersAvailable = new ArrayList<Character>(Arrays.asList(
new Character[]{
Character.valueOf('A'), Character.valueOf('B'), Character.valueOf('C'),
Character.valueOf('D'), Character.valueOf('E'), Character.valueOf('F'),
Character.valueOf('G'), Character.valueOf('H'), Character.valueOf('I'),
Character.valueOf('J'), Character.valueOf('K'), Character.valueOf('L'),
Character.valueOf('M'), Character.valueOf('N'), Character.valueOf('O'),
Character.valueOf('P'), Character.valueOf('Q'), Character.valueOf('R'),
Character.valueOf('S'), Character.valueOf('T'), Character.valueOf('U'),
Character.valueOf('V'), Character.valueOf('W'), Character.valueOf('X'),
Character.valueOf('Y'), Character.valueOf('Z')
}));
charactersGuessed = new ArrayList<Character>();
charactersAvailable = new ArrayList<>(List.of(
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'));
charactersGuessed = new ArrayList<>();
this.vocab = vocab;
}
@@ -75,8 +69,8 @@ public class Hangman implements Serializable {
}
if (vocab.containsAllCharacter(charactersGuessed)) {
win = true;
log.info("Game won");
}
System.out.println(" *********************************** " + win);
}
}
@@ -98,7 +92,7 @@ public class Hangman implements Serializable {
public List<Character> getCharactersAvailable() {
synchronized (charactersAvailable) {
return new ArrayList<Character>(charactersAvailable);
return new ArrayList<>(charactersAvailable);
//return charactersAvailable;
}
}
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.hangman;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import java.util.Map;
@@ -20,17 +20,19 @@
*/
package org.apache.struts2.showcase.hangman;
import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
public class Vocab implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private String vocab;
private String hint;
private final String vocab;
private final String hint;
private Character[] characters; // character this vocab is made up of
public Vocab(String vocab, String hint) {
@@ -52,7 +54,7 @@ public class Vocab implements Serializable {
public Boolean containCharacter(Character character) {
assert (character != null);
return (vocab.contains(character.toString())) ? true : false;
return vocab.contains(character.toString());
}
public Character[] inCharacters() {
@@ -60,32 +62,21 @@ public class Vocab implements Serializable {
char[] c = vocab.toCharArray();
characters = new Character[c.length];
for (int a = 0; a < c.length; a++) {
characters[a] = Character.valueOf(c[a]);
characters[a] = c[a];
}
}
return characters;
}
public boolean containsAllCharacter(List<Character> charactersGuessed) {
Character[] chars = inCharacters();
List<Character> tmpChars = Arrays.asList(chars);
return charactersGuessed.containsAll(tmpChars);
return new HashSet<>(charactersGuessed).containsAll(Arrays.asList(inCharacters()));
}
public static void main(String args[]) throws Exception {
public static void main(String[] args) throws Exception {
Vocab v = new Vocab("JAVA", "a java word");
List<Character> list1 = new ArrayList<Character>();
list1.add(new Character('J'));
list1.add(new Character('V'));
List<Character> list2 = new ArrayList<Character>();
list2.add(new Character('J'));
list2.add(new Character('V'));
list2.add(new Character('A'));
System.out.println(v.containsAllCharacter(list1));
System.out.println(v.containsAllCharacter(list2));
System.out.println(v.containsAllCharacter(List.of('J', 'V')));
System.out.println(v.containsAllCharacter(List.of('J', 'V', 'A')));
}
}
@@ -20,8 +20,8 @@
*/
package org.apache.struts2.showcase.modelDriven;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.ModelDriven;
import org.apache.struts2.showcase.modelDriven.model.Gangster;
/**
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.person;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.person;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.person;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
@@ -20,10 +20,10 @@
*/
package org.apache.struts2.showcase.servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
public class TestServlet extends HttpServlet {
@@ -20,12 +20,12 @@
*/
package org.apache.struts2.showcase.source;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.util.ClassLoaderUtil;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.util.ClassLoaderUtil;
import org.apache.struts2.action.ServletContextAware;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import javax.servlet.ServletContext;
import jakarta.servlet.ServletContext;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.tag.nonui.actionPrefix;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
public class SubmitAction extends ActionSupport {
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.tag.nonui.actiontag;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
/**
*/
@@ -18,7 +18,7 @@
*/
package org.apache.struts2.showcase.tag.nonui.debugtag;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.dispatcher.PrepareOperations;
public class DebugTagAction extends ActionSupport {
@@ -20,8 +20,8 @@
*/
package org.apache.struts2.showcase.tag.nonui.iteratortag;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Validateable;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.Validateable;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.tag.nonui.iteratortag;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
@@ -20,8 +20,8 @@
*/
package org.apache.struts2.showcase.tag.nonui.iteratortag;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Validateable;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.Validateable;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
@@ -20,8 +20,8 @@
*/
package org.apache.struts2.showcase.tag.nonui.iteratortag;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Validateable;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.Validateable;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
@@ -24,7 +24,7 @@ import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.tiles.annotation.TilesDefinition;
import org.apache.struts2.tiles.annotation.TilesPutAttribute;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
@Namespace("/tiles")
@ParentPackage("tiles")
@@ -20,8 +20,8 @@
*/
package org.apache.struts2.showcase.token;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionContext;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.util.Date;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.validation;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
/**
*/
@@ -18,15 +18,15 @@
*/
package org.apache.struts2.showcase.validation;
import com.opensymphony.xwork2.validator.annotations.DateRangeFieldValidator;
import com.opensymphony.xwork2.validator.annotations.EmailValidator;
import com.opensymphony.xwork2.validator.annotations.FieldExpressionValidator;
import com.opensymphony.xwork2.validator.annotations.IntRangeFieldValidator;
import com.opensymphony.xwork2.validator.annotations.RegexFieldValidator;
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator;
import com.opensymphony.xwork2.validator.annotations.RequiredStringValidator;
import com.opensymphony.xwork2.validator.annotations.StringLengthFieldValidator;
import com.opensymphony.xwork2.validator.annotations.UrlValidator;
import org.apache.struts2.validator.annotations.DateRangeFieldValidator;
import org.apache.struts2.validator.annotations.EmailValidator;
import org.apache.struts2.validator.annotations.FieldExpressionValidator;
import org.apache.struts2.validator.annotations.IntRangeFieldValidator;
import org.apache.struts2.validator.annotations.RegexFieldValidator;
import org.apache.struts2.validator.annotations.RequiredFieldValidator;
import org.apache.struts2.validator.annotations.RequiredStringValidator;
import org.apache.struts2.validator.annotations.StringLengthFieldValidator;
import org.apache.struts2.validator.annotations.UrlValidator;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
import java.sql.Date;
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.validation;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts.beanvalidation.constraints.FieldMatch;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
@@ -31,13 +31,13 @@ import org.apache.struts2.interceptor.validation.SkipValidation;
import org.hibernate.validator.constraints.ScriptAssert;
import org.hibernate.validator.constraints.URL;
import javax.validation.constraints.Email;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import java.util.Date;
// <!-- START SNIPPET: beanValidationExample -->
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.validation;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.validation;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
@@ -20,7 +20,7 @@
*/
package org.apache.struts2.showcase.wait;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import org.apache.struts2.interceptor.parameter.StrutsParameter;
/**
@@ -20,10 +20,12 @@
*/
package org.apache.struts2.showcase.xslt;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
import jakarta.servlet.http.HttpServletRequest;
import org.apache.struts2.action.ServletRequestAware;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import java.util.Properties;
@@ -30,6 +30,5 @@
<AppenderRef ref="STDOUT"/>
</Root>
<Logger name="org.apache.struts2" level="info"/>
<Logger name="com.opensymphony.xwork2" level="info"/>
</Loggers>
</Configuration>
@@ -21,6 +21,6 @@
<div style="background-color:yellow;">
<p>
Freemarker Custom Template -
parameter 'paramName' - ${parameters.paramName}
parameter 'paramName' - ${attributes.paramName}
</p>
</div>
@@ -24,6 +24,9 @@
"https://struts.apache.org/dtds/struts-6.0.dtd">
<struts>
<constant name="struts.multipart.maxSize" value="10240" />
<package name="fileupload" extends="struts-default" namespace="/fileupload">
<action name="upload" class="org.apache.struts2.showcase.fileupload.FileUploadAction" method="input">
@@ -47,12 +47,7 @@
<result>/WEB-INF/validation/quiz-success.jsp</result>
</action>
<action name="quizDwr" class="org.apache.struts2.showcase.validation.QuizAction">
<result name="input">/WEB-INF/validation/quiz-dwr.jsp</result>
<result>/WEB-INF/validation/quiz-success.jsp</result>
</action>
<action name="quizClientCss" class="org.apache.struts2.showcase.validation.QuizAction">
<action name="quizClientCss" class="org.apache.struts2.showcase.validation.QuizAction">
<result name="input">/WEB-INF/validation/quiz-client-css.jsp</result>
<result>/WEB-INF/validation/quiz-success.jsp</result>
</action>
@@ -42,7 +42,6 @@
"/>
<constant name="struts.allowlist.classes" value="
org.apache.struts2.showcase.hangman.Hangman,
org.apache.struts2.showcase.hangman.HangmanConstants,
org.apache.struts2.showcase.hangman.Vocab
"/>
@@ -22,22 +22,22 @@
Make sure element is always present. To be filled later via JS.
-->
<ul<#rt/>
<#if parameters.id??>
id="${parameters.id}"<#rt/>
</#if>
<#if parameters.cssClass??>
class="${parameters.cssClass}"<#rt/>
<#if attributes.id??>
id="${attributes.id}"<#rt/>
</#if>
<#if attributes.cssClass??>
class="${attributes.cssClass}"<#rt/>
<#else>
class="errorMessage"<#rt/>
</#if>
<#if parameters.cssStyle??>
style="${parameters.cssStyle}"<#rt/>
<#if attributes.cssStyle??>
style="${attributes.cssStyle}"<#rt/>
</#if>
>
<#if (actionErrors?? && actionErrors?size > 0)>
<#list actionErrors as error>
<#if error??>
<li><span><#if parameters.escape>${error!}<#else>${error!}</#if></span><#rt/></li><#rt/>
<li><span><#if attributes.escape>${error!}<#else>${error!}</#if></span><#rt/></li><#rt/>
</#if>
</#list>
</#if>
@@ -18,16 +18,16 @@
* under the License.
*/
-->
${parameters.after!}<#t/>
${attributes.after!}<#t/>
</td><#lt/>
</tr>
<#if (parameters.errorposition!"top") == 'bottom'>
<#assign hasFieldErrors = parameters.name?? && fieldErrors?? && fieldErrors.get(parameters.name)??/>
<#if (attributes.errorposition!"top") == 'bottom'>
<#assign hasFieldErrors = attributes.name?? && fieldErrors?? && fieldErrors.get(attributes.name)??/>
<#if hasFieldErrors>
<tr errorFor="${parameters.id}">
<tr errorFor="${attributes.id}">
<td class="tdErrorMessage" colspan="2"><#rt/>
<#if hasFieldErrors>
<#list fieldErrors.get(parameters.name) as error>
<#list fieldErrors.get(attributes.name) as error>
<div class="errorMessage">${error}</div><#t/>
</#list>
</#if>
@@ -21,22 +21,22 @@
<#--
Always include elements to show errors. They may be filled later via AJAX.
-->
<#assign hasFieldErrors = parameters.name?? && fieldErrors?? && fieldErrors.get(parameters.name)??/>
<#if (parameters.errorposition!"top") == 'top'>
<tr errorFor="${parameters.id}">
<td class="tdErrorMessage" colspan="2" data-error-for-fieldname="${parameters.name}"><#rt/>
<#assign hasFieldErrors = attributes.name?? && fieldErrors?? && fieldErrors.get(attributes.name)??/>
<#if (attributes.errorposition!"top") == 'top'>
<tr errorFor="${attributes.id}">
<td class="tdErrorMessage" colspan="2" data-error-for-fieldname="${attributes.name}"><#rt/>
<#if hasFieldErrors>
<#list fieldErrors.get(parameters.name) as error>
<#list fieldErrors.get(attributes.name) as error>
<div class="errorMessage">${error}</div><#t/>
</#list>
</#if>
</td><#lt/>
</tr>
</#if>
<#if !parameters.labelPosition?? && (parameters.form.labelPosition)??>
<#assign labelPos = parameters.form.labelPosition/>
<#elseif parameters.labelPosition??>
<#assign labelpos = parameters.labelPosition/>
<#if !attributes.labelPosition?? && (attributes.form.labelPosition)??>
<#assign labelPos = attributes.form.labelPosition/>
<#elseif attributes.labelPosition??>
<#assign labelpos = attributes.labelPosition/>
</#if>
<#--
if the label position is top,
@@ -48,10 +48,10 @@
<#else>
<td class="tdLabel"><#rt/>
</#if>
<#if parameters.label??>
<#if attributes.label??>
<label <#t/>
<#if parameters.id??>
for="${parameters.id}" <#t/>
<#if attributes.id??>
for="${attributes.id}" <#t/>
</#if>
<#if hasFieldErrors>
class="errorLabel"<#t/>
@@ -59,15 +59,15 @@
class="label"<#t/>
</#if>
><#t/>
<#if parameters.required!false && parameters.requiredPosition!"right" != 'right'>
<#if attributes.required!false && attributes.requiredPosition!"right" != 'right'>
<span class="required">*</span><#t/>
</#if>
${parameters.label}<#t/>
<#if parameters.required!false && parameters.requiredPosition!"right" == 'right'>
${attributes.label}<#t/>
<#if attributes.required!false && attributes.requiredPosition!"right" == 'right'>
<span class="required">*</span><#t/>
</#if>
${parameters.labelseparator!":"}<#t/>
<#include "/${parameters.templateDir}/${parameters.expandTheme}/tooltip.ftl" />
${attributes.labelseparator!":"}<#t/>
<#include "/${attributes.templateDir}/${attributes.expandTheme}/tooltip.ftl" />
</label><#t/>
</#if>
</td><#lt/>
@@ -20,7 +20,7 @@ package org.apache.struts2.showcase.conversion;
import java.util.LinkedHashSet;
import java.util.Set;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
/**
* @version $Date$ $Id$
@@ -28,15 +28,15 @@ import com.opensymphony.xwork2.ActionSupport;
public class AddressAction extends ActionSupport {
private Set addresses = new LinkedHashSet();
public Set getAddresses() { return addresses; }
public void setAddresses(Set addresses) { this.addresses = addresses; }
public String input() throws Exception {
return SUCCESS;
}
public String submit() throws Exception {
System.out.println(addresses);
return SUCCESS;
@@ -21,28 +21,28 @@ import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
/**
*
*
* @version $Date$ $Id$
*/
public class OperationsEnumAction extends ActionSupport {
private static final long serialVersionUID = -2229489704988870318L;
private List<OperationsEnum> selectedOperations = new LinkedList<OperationsEnum>();
public List<OperationsEnum> getSelectedOperations() { return this.selectedOperations; }
public void setSelectedOperations(List<OperationsEnum> selectedOperations) {
this.selectedOperations = selectedOperations;
}
public List<OperationsEnum> getAvailableOperations() {
return Arrays.asList(OperationsEnum.values());
}
public String input() throws Exception {
return SUCCESS;
}
@@ -19,24 +19,24 @@ package org.apache.struts2.showcase.conversion;
import java.util.List;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ActionSupport;
/**
*
*
*/
public class PersonAction extends ActionSupport {
private List persons;
public List getPersons() { return persons; }
public void setPersons(List persons) { this.persons = persons; }
public String input() throws Exception {
return SUCCESS;
}
public String submit() throws Exception {
return SUCCESS;
}

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