mirror of
https://github.com/apache/struts.git
synced 2026-08-09 16:46:55 +00:00
Compare commits
239 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dc579c0ccc | |||
| cae7a5f25c | |||
| 62d46b62da | |||
| 43358dee85 | |||
| d9ba299412 | |||
| 26e1535b58 | |||
| a96dd31be6 | |||
| fe45511712 | |||
| 90ea4d8aa1 | |||
| d04ed76f1b | |||
| f1824b5393 | |||
| 675deff599 | |||
| 256cd14bf0 | |||
| 620b8c3a0c | |||
| 20e4529e35 | |||
| 8a26c0d753 | |||
| b2580e1d76 | |||
| a65b8d5d51 | |||
| 7e912a2985 | |||
| 1b9563d366 | |||
| ce8b75de58 | |||
| 280f25d2fe | |||
| 69669d6cf7 | |||
| 39d70e3944 | |||
| cb5e55b06c | |||
| ea23ce295a | |||
| 4cf9093cc5 | |||
| 46bae3ce68 | |||
| dfa8fb3e4c | |||
| a2df8f9890 | |||
| 7253edeada | |||
| 2efe3cec7a | |||
| 4506d5716d | |||
| 83aff6e470 | |||
| 3138dc7fbd | |||
| 4566734662 | |||
| d591b7e3b9 | |||
| 9c45d6b025 | |||
| 482af41673 | |||
| 0a75d8e8fa | |||
| 1d18e8f9a8 | |||
| f6365e7363 | |||
| 84aeb77011 | |||
| b3a9d82d58 | |||
| 828d02fcbd | |||
| 88b05cdaed | |||
| e60df05c27 | |||
| 1efcc938cf | |||
| 7b1c3b0fca | |||
| 10a834a54c | |||
| abb1ac3c99 | |||
| dcc59937a8 | |||
| 22c88faf38 | |||
| 1191ca3ed0 | |||
| bcfb769005 | |||
| d61be3e4ce | |||
| c7149ab1bc | |||
| 4504e610f1 | |||
| 9b3a23eb28 | |||
| 3220d832d2 | |||
| bd007953ea | |||
| 1b0c743e85 | |||
| 89e02a4fb4 | |||
| 8cb93ad39a | |||
| e8656d5737 | |||
| 7f10ed505f | |||
| 043814b774 | |||
| 0fabde9f97 | |||
| 4457f03c70 | |||
| 3d3512a399 | |||
| 59a6cbf6ca | |||
| 19802b0614 | |||
| e46e662a7a | |||
| 4786fba0d7 | |||
| e32bd7dba9 | |||
| 6e1d2add07 | |||
| 2eeac367fe | |||
| 30b43044a3 | |||
| 5c82f0246e | |||
| fff35cfd9d | |||
| 1526b36dd6 | |||
| 6d6a422db7 | |||
| 5cf57b9132 | |||
| f4c0135878 | |||
| 77cfae3084 | |||
| ec56290056 | |||
| 47c87bc62c | |||
| ce467b7fa5 | |||
| 73eb6ed189 | |||
| 80a91dc75f | |||
| a6edb0d5df | |||
| 3dfc5a4074 | |||
| fdfeb3233a | |||
| ae3ae2be76 | |||
| 8dface4fcb | |||
| 1348971d40 | |||
| dd6d206d78 | |||
| e2b644a4fb | |||
| 13cfba86f8 | |||
| d84d59f53c | |||
| 3651f55869 | |||
| 7ffa750c68 | |||
| 313876aa3c | |||
| 9d7a9f81db | |||
| fe98223724 | |||
| 1de94b2092 | |||
| 706bb560e4 | |||
| 12d4feaf8f | |||
| d88a8382d4 | |||
| 73809eae54 | |||
| 5b4b554d11 | |||
| fcbd29b7f9 | |||
| 220896a0cf | |||
| 632f19eab3 | |||
| 50a145152d | |||
| f7b191f782 | |||
| 4ae1a6a26d | |||
| 79e598f360 | |||
| 9216e8e22c | |||
| 651eac2c57 | |||
| a50af87644 | |||
| 9e01fbd2dd | |||
| d4dd3386cc | |||
| 0999fba8c4 | |||
| 3ac6835c5c | |||
| b0dd7c1c0d | |||
| a63beef1f8 | |||
| e74e5539dd | |||
| 2226fcc168 | |||
| 865b8a20df | |||
| 3c6956116e | |||
| bb9ce7582b | |||
| 11d373f8b4 | |||
| b23bfd42d2 | |||
| f94b681050 | |||
| fb38a919c9 | |||
| e25c826167 | |||
| 4815744eaf | |||
| f5a7776854 | |||
| f45d2752bb | |||
| 0262574095 | |||
| 30cb56a414 | |||
| 63dc85fd7a | |||
| 5b0ec3400d | |||
| d460d71498 | |||
| 53f64cdecf | |||
| aff4d46835 | |||
| a15c12a051 | |||
| e62155c460 | |||
| f7f4fbd47f | |||
| 2d81439553 | |||
| 7afe35cb96 | |||
| fdd1054070 | |||
| 32e88d1a2e | |||
| 6403de4516 | |||
| 13c517fc3c | |||
| 7242a87165 | |||
| 0323795d67 | |||
| 71267a9b4b | |||
| 5524c579d2 | |||
| 873ca8fa20 | |||
| 8988d57644 | |||
| 2e7cf63964 | |||
| 3eb68be674 | |||
| c9f279ec2e | |||
| 881e1b2580 | |||
| cb0ac7c440 | |||
| 96c38b27e4 | |||
| e9108f0feb | |||
| 3653f6e9e1 | |||
| 5a2323a19f | |||
| ea09a8828b | |||
| 17fe42c0f7 | |||
| 87fa5bddf2 | |||
| 45161e88f9 | |||
| 4456620b51 | |||
| f4a8f42ca4 | |||
| a6f8895c90 | |||
| 46dbdbe018 | |||
| 6f176cc5a7 | |||
| db085dbeef | |||
| c3205888b4 | |||
| ce9789c4c9 | |||
| b431755332 | |||
| c694c6fdfb | |||
| 1d49a06272 | |||
| 264e03b7ed | |||
| 2f99110189 | |||
| d33930f3bd | |||
| 360927931c | |||
| bff033e6a3 | |||
| 536d2db4b8 | |||
| 32c8f6f811 | |||
| 06e5dfc2ab | |||
| fe630db5f2 | |||
| b75c0ba5e1 | |||
| 8ab102209f | |||
| d7a7c909ea | |||
| 24e151143e | |||
| c5272d2a0d | |||
| 11de8810e4 | |||
| 75dc4c00d2 | |||
| 415ce3e165 | |||
| fe6257b995 | |||
| 3b81a9edaa | |||
| 478a9b8f1c | |||
| 12c3d23bdf | |||
| 8293add6aa | |||
| ecb7beef38 | |||
| bac0f2953c | |||
| 7bca98205d | |||
| 567fae9dfc | |||
| f4d7dbe88e | |||
| 289782c583 | |||
| 1e33df947a | |||
| de1a42d34a | |||
| b816cc1374 | |||
| b802baa4a9 | |||
| daac47ee62 | |||
| b1709c5208 | |||
| daf6f6f749 | |||
| 029892d656 | |||
| 65fb0d4a44 | |||
| 58d87025e9 | |||
| 83c0f1cd1e | |||
| eacc002334 | |||
| 45effc3822 | |||
| bad9a49060 | |||
| a75eddb515 | |||
| 6e87474f9a | |||
| 9fcbd912bc | |||
| fbc780e779 | |||
| 6eb83016e3 | |||
| 3ec7fa9d80 | |||
| f9806ee4e1 | |||
| d175836757 | |||
| e55ad3fb45 | |||
| 6efaf900d4 | |||
| b3bad5ea44 |
@@ -1,27 +0,0 @@
|
||||
# Documentation https://s.apache.org/asfyaml
|
||||
notifications:
|
||||
commits: commits@struts.apache.org
|
||||
# Send all issue emails (new, closed, comments) to issues@
|
||||
issues: issues@struts.apache.org
|
||||
# Send new/closed PR notifications to commits@
|
||||
pullrequests_status: notifications@struts.apache.org
|
||||
# Send individual PR comments/reviews to issues@
|
||||
pullrequests_comment: notifications@struts.apache.org
|
||||
# Link opened PRs with JIRA
|
||||
jira_options: link label worklog
|
||||
|
||||
github:
|
||||
del_branch_on_merge: true
|
||||
protected_branches:
|
||||
master:
|
||||
# contexts are the names of checks that must pass.
|
||||
contexts:
|
||||
- build
|
||||
required_pull_request_reviews:
|
||||
# it does not work because our github teams are private/secret, see INFRA-25666
|
||||
require_code_owner_reviews: false
|
||||
required_approving_review_count: 0
|
||||
autolink_jira:
|
||||
- WW
|
||||
dependabot_alerts: true
|
||||
dependabot_updates: true
|
||||
@@ -1,10 +0,0 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
- package-ecosystem: "maven"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
@@ -1,55 +0,0 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache license, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the license for the specific language governing permissions and
|
||||
# limitations under the license.
|
||||
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
# Needed to upload the results to code-scanning dashboard.
|
||||
security-events: write
|
||||
actions: read
|
||||
contents: read
|
||||
# Needed to access OIDC token.
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'java' ]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
@@ -1,46 +0,0 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: Java Maven
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
permissions: read-all
|
||||
|
||||
env:
|
||||
MAVEN_OPTS: -Xmx2048m -Xms1024m
|
||||
LANG: en_US.utf8
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and Test
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java: [ '8', '11', '17', '21' ]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: ${{ matrix.java }}
|
||||
cache: 'maven'
|
||||
- name: Build with Maven on Java ${{ matrix.java }}
|
||||
run: mvn -B -V -DskipAssembly verify --no-transfer-progress
|
||||
@@ -1,69 +0,0 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache license, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the license for the specific language governing permissions and
|
||||
# limitations under the license.
|
||||
|
||||
name: "Scorecards supply-chain security"
|
||||
|
||||
on:
|
||||
branch_protection_rule:
|
||||
schedule:
|
||||
- cron: "30 1 * * 6" # Weekly on Saturdays
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
|
||||
analysis:
|
||||
|
||||
name: "Scorecards analysis"
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
# Needed to upload the results to the code-scanning dashboard.
|
||||
security-events: write
|
||||
actions: read
|
||||
id-token: write # This is required for requesting the JWT
|
||||
contents: read # This is required for actions/checkout
|
||||
|
||||
steps:
|
||||
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v4 # 3.1.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Run analysis"
|
||||
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # 2.3.3
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
# A read-only PAT token, which is sufficient for the action to function.
|
||||
# The relevant discussion: https://github.com/ossf/scorecard-action/issues/188
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Publish the results for public repositories to enable scorecard badges.
|
||||
# For more details: https://github.com/ossf/scorecard-action#publishing-results
|
||||
publish_results: true
|
||||
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # 4.3.4
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
retention-days: 5
|
||||
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@03e7845b7bfcd5e7fb63d1ae8c61b0e791134fab # 2.22.11
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
@@ -1,47 +0,0 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: SonarCloud
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
permissions: read-all
|
||||
|
||||
env:
|
||||
MAVEN_OPTS: -Xmx2048m -Xms1024m
|
||||
LANG: en_US.utf8
|
||||
|
||||
jobs:
|
||||
sonarcloud:
|
||||
name: Scan
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ !github.event.pull_request.head.repo.fork }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 17
|
||||
cache: 'maven'
|
||||
- env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
|
||||
run: mvn -B -V -Pcoverage -DskipAssembly verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --no-transfer-progress
|
||||
+37
-20
@@ -11,9 +11,6 @@
|
||||
.metadata/
|
||||
Servers/
|
||||
|
||||
# Java annotation processor (APT)
|
||||
.factorypath
|
||||
|
||||
#VSCode
|
||||
.vscode
|
||||
|
||||
@@ -27,22 +24,42 @@ Servers/
|
||||
.java-version
|
||||
|
||||
# Maven
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
core/target
|
||||
plugins/convention/target
|
||||
plugins/embeddedjsp/target
|
||||
plugins/osgi/target
|
||||
plugins/cdi/target
|
||||
plugins/spring/target
|
||||
plugins/jfreechart/target
|
||||
apps/rest-showcase/target
|
||||
apps/mailreader/target
|
||||
apps/portlet/target
|
||||
apps/blank/target
|
||||
apps/jboss-blank/target
|
||||
apps/mailreader/target
|
||||
apps/portlet/target
|
||||
apps/showcase/target
|
||||
apps/target
|
||||
bundles/admin/target
|
||||
plugins/config-browser/target
|
||||
plugins/jasperreports/target
|
||||
plugins/json/target
|
||||
plugins/portlet-tiles/target
|
||||
plugins/portlet/target
|
||||
plugins/sitegraph/target
|
||||
plugins/sitemesh/target
|
||||
plugins/javatemplates/target
|
||||
bundles/demo/target
|
||||
plugins/rest/target
|
||||
plugins/plexus/target
|
||||
plugins/testng/target
|
||||
plugins/dwr/target
|
||||
plugins/gxp/target
|
||||
plugins/oval/target
|
||||
plugins/junit/target
|
||||
plugins/tiles/target
|
||||
bundles/target
|
||||
plugins/target
|
||||
target
|
||||
plugins/testng/test-output
|
||||
test-output
|
||||
|
||||
# Sonar
|
||||
/.sonar/
|
||||
|
||||
# Tidelift CLI scanner
|
||||
.tidelift
|
||||
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import java.nio.channels.*;
|
||||
import java.util.Properties;
|
||||
|
||||
public class MavenWrapperDownloader {
|
||||
|
||||
/**
|
||||
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
|
||||
*/
|
||||
private static final String DEFAULT_DOWNLOAD_URL =
|
||||
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar";
|
||||
|
||||
/**
|
||||
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
|
||||
* use instead of the default one.
|
||||
*/
|
||||
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
|
||||
".mvn/wrapper/maven-wrapper.properties";
|
||||
|
||||
/**
|
||||
* Path where the maven-wrapper.jar will be saved to.
|
||||
*/
|
||||
private static final String MAVEN_WRAPPER_JAR_PATH =
|
||||
".mvn/wrapper/maven-wrapper.jar";
|
||||
|
||||
/**
|
||||
* Name of the property which should be used to override the default download url for the wrapper.
|
||||
*/
|
||||
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
|
||||
|
||||
public static void main(String args[]) {
|
||||
System.out.println("- Downloader started");
|
||||
File baseDirectory = new File(args[0]);
|
||||
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
|
||||
|
||||
// If the maven-wrapper.properties exists, read it and check if it contains a custom
|
||||
// wrapperUrl parameter.
|
||||
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
|
||||
String url = DEFAULT_DOWNLOAD_URL;
|
||||
if(mavenWrapperPropertyFile.exists()) {
|
||||
FileInputStream mavenWrapperPropertyFileInputStream = null;
|
||||
try {
|
||||
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
|
||||
Properties mavenWrapperProperties = new Properties();
|
||||
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
|
||||
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
|
||||
} catch (IOException e) {
|
||||
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
|
||||
} finally {
|
||||
try {
|
||||
if(mavenWrapperPropertyFileInputStream != null) {
|
||||
mavenWrapperPropertyFileInputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// Ignore ...
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("- Downloading from: : " + url);
|
||||
|
||||
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
|
||||
if(!outputFile.getParentFile().exists()) {
|
||||
if(!outputFile.getParentFile().mkdirs()) {
|
||||
System.out.println(
|
||||
"- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
|
||||
}
|
||||
}
|
||||
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
|
||||
try {
|
||||
downloadFileFromURL(url, outputFile);
|
||||
System.out.println("Done");
|
||||
System.exit(0);
|
||||
} catch (Throwable e) {
|
||||
System.out.println("- Error downloading");
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
|
||||
URL website = new URL(urlString);
|
||||
ReadableByteChannel rbc;
|
||||
rbc = Channels.newChannel(website.openStream());
|
||||
FileOutputStream fos = new FileOutputStream(destination);
|
||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||
fos.close();
|
||||
rbc.close();
|
||||
}
|
||||
|
||||
}
|
||||
BIN
Binary file not shown.
+1
-18
@@ -1,18 +1 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
dist: trusty
|
||||
language: java
|
||||
sudo: false
|
||||
|
||||
jdk:
|
||||
- openjdk7
|
||||
- oraclejdk8
|
||||
- oraclejdk9
|
||||
- oraclejdk11
|
||||
|
||||
install: true
|
||||
script: mvn test -DskipAssembly -B
|
||||
|
||||
after_success:
|
||||
# TODO delete following if statement after fix of https://github.com/cobertura/cobertura/issues/271
|
||||
- if [ "$TRAVIS_JDK_VERSION" == "openjdk8" ] || [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ]; then
|
||||
mvn cobertura:cobertura org.eluder.coveralls:coveralls-maven-plugin:report com.updateimpact:updateimpact-maven-plugin:submit -Ptravis-coveralls,update-impact -DskipAssembly -B;
|
||||
else
|
||||
echo "Not reporting coverage for $TRAVIS_JDK_VERSION due to incompatibility or to save performance";
|
||||
fi;
|
||||
|
||||
env:
|
||||
global:
|
||||
secure: DusDFL9cuX+mj64tXQfrYVbUVYnxlXmad4nuIMj0/lgDbwJ6kxYasJmR99bdvwu08gS9D5b7a+m7WJTN0FNATzEiiGDXcM+TiDPlYDh7dcalU4QGiLmMuCCEw1r7hp2XE4BWVgDfFhCsHhStgjE4RXzHIyPowoPXr4ugPf8at6w=
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.m2
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# Request PR review from any Apache Struts committer
|
||||
* @apache/struts-committers
|
||||
Vendored
+14
-276
@@ -1,290 +1,28 @@
|
||||
#!groovy
|
||||
|
||||
pipeline {
|
||||
agent none
|
||||
agent {
|
||||
label 'ubuntu'
|
||||
}
|
||||
options {
|
||||
buildDiscarder logRotator(daysToKeepStr: '14', numToKeepStr: '10')
|
||||
timeout(80)
|
||||
disableConcurrentBuilds()
|
||||
skipStagesAfterUnstable()
|
||||
quietPeriod(30)
|
||||
}
|
||||
tools {
|
||||
jdk 'jdk_1.7_latest'
|
||||
maven 'maven_3_latest'
|
||||
}
|
||||
triggers {
|
||||
pollSCM 'H/15 * * * *'
|
||||
}
|
||||
stages {
|
||||
stage('Prepare') {
|
||||
agent {
|
||||
label 'ubuntu'
|
||||
}
|
||||
stages {
|
||||
stage('Clean up') {
|
||||
steps {
|
||||
cleanWs deleteDirs: true, patterns: [[pattern: '**/target/**', type: 'INCLUDE']]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('JDK 21') {
|
||||
agent {
|
||||
label 'ubuntu'
|
||||
}
|
||||
tools {
|
||||
jdk 'jdk_21_latest'
|
||||
maven 'maven_3_latest'
|
||||
}
|
||||
environment {
|
||||
MAVEN_OPTS = "-Xmx1024m"
|
||||
}
|
||||
stages {
|
||||
stage('Test') {
|
||||
steps {
|
||||
sh './mvnw -B -DskipAssembly verify --no-transfer-progress'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
|
||||
junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
cleanWs deleteDirs: true, patterns: [[pattern: '**/target/**', type: 'INCLUDE']]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('JDK 17') {
|
||||
agent {
|
||||
label 'ubuntu'
|
||||
}
|
||||
tools {
|
||||
jdk 'jdk_17_latest'
|
||||
maven 'maven_3_latest'
|
||||
}
|
||||
environment {
|
||||
MAVEN_OPTS = "-Xmx1024m"
|
||||
}
|
||||
stages {
|
||||
stage('Test & Coverage') {
|
||||
steps {
|
||||
sh './mvnw -B verify -Pcoverage -DskipAssembly --no-transfer-progress'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
|
||||
junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Code Quality') {
|
||||
when {
|
||||
anyOf {
|
||||
branch 'master'; branch 'release/struts-7-0-x'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
withCredentials([string(credentialsId: 'asf-struts-sonarcloud', variable: 'SONARCLOUD_TOKEN')]) {
|
||||
sh './mvnw -B -Pcoverage -DskipAssembly -Dsonar.login=${SONARCLOUD_TOKEN} verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --no-transfer-progress'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build Source & JavaDoc') {
|
||||
when {
|
||||
branch 'release/struts-7-0-x'
|
||||
}
|
||||
steps {
|
||||
dir("local-snapshots-dir/") {
|
||||
deleteDir()
|
||||
}
|
||||
sh './mvnw -B source:jar javadoc:jar -DskipTests -DskipAssembly --no-transfer-progress'
|
||||
}
|
||||
}
|
||||
stage('Deploy Snapshot') {
|
||||
when {
|
||||
branch 'release/struts-7-0-x'
|
||||
}
|
||||
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 '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)
|
||||
}
|
||||
}
|
||||
}
|
||||
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: [
|
||||
sshPublisherDesc(
|
||||
configName: 'Nightlies',
|
||||
transfers: [
|
||||
sshTransfer(
|
||||
remoteDirectory: '/struts/snapshot',
|
||||
removePrefix: 'assembly/target/assembly/out',
|
||||
sourceFiles: 'assembly/target/assembly/out/struts-*.zip'
|
||||
)
|
||||
],
|
||||
verbose: true
|
||||
)
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
cleanWs deleteDirs: true, patterns: [[pattern: '**/target/**', type: 'INCLUDE']]
|
||||
}
|
||||
}
|
||||
}
|
||||
environment {
|
||||
MAVEN_OPTS = '-Xmx1024m -XX:MaxPermSize=256m'
|
||||
}
|
||||
post {
|
||||
// If this build failed, send an email to the list.
|
||||
failure {
|
||||
script {
|
||||
emailext(
|
||||
to: "notifications@struts.apache.org",
|
||||
recipientProviders: [[$class: 'DevelopersRecipientProvider']],
|
||||
from: "Mr. Jenkins <jenkins@builds.apache.org>",
|
||||
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} failed",
|
||||
body: """
|
||||
There is a build failure in ${env.JOB_NAME}.
|
||||
|
||||
Build: ${env.BUILD_URL}
|
||||
Logs: ${env.BUILD_URL}console
|
||||
Changes: ${env.BUILD_URL}changes
|
||||
|
||||
--
|
||||
Mr. Jenkins
|
||||
Director of Continuous Integration
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// If this build didn't fail, but there were failing tests, send an email to the list.
|
||||
unstable {
|
||||
script {
|
||||
emailext(
|
||||
to: "notifications@struts.apache.org",
|
||||
recipientProviders: [[$class: 'DevelopersRecipientProvider']],
|
||||
from: "Mr. Jenkins <jenkins@builds.apache.org>",
|
||||
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} unstable",
|
||||
body: """
|
||||
Some tests have failed in ${env.JOB_NAME}.
|
||||
|
||||
Build: ${env.BUILD_URL}
|
||||
Logs: ${env.BUILD_URL}console
|
||||
Changes: ${env.BUILD_URL}changes
|
||||
|
||||
--
|
||||
Mr. Jenkins
|
||||
Director of Continuous Integration
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Send an email, if the last build was not successful and this one is.
|
||||
fixed {
|
||||
script {
|
||||
emailext(
|
||||
to: "notifications@struts.apache.org",
|
||||
recipientProviders: [[$class: 'DevelopersRecipientProvider']],
|
||||
from: 'Mr. Jenkins <jenkins@builds.apache.org>',
|
||||
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} back to normal",
|
||||
body: """
|
||||
The build for ${env.JOB_NAME} completed successfully and is back to normal.
|
||||
|
||||
Build: ${env.BUILD_URL}
|
||||
Logs: ${env.BUILD_URL}console
|
||||
Changes: ${env.BUILD_URL}changes
|
||||
|
||||
--
|
||||
Mr. Jenkins
|
||||
Director of Continuous Integration
|
||||
"""
|
||||
)
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh 'mvn --version'
|
||||
sh 'mvn clean source:jar javadoc:jar install deploy -DskipWiki -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,22 +17,20 @@
|
||||
The Apache Struts web framework
|
||||
-------------------------------
|
||||
|
||||
[](https://ci-builds.apache.org/job/Struts/job/Struts%20Core/job/master/)
|
||||
[](https://github.com/apache/struts/actions/workflows/maven.yml)
|
||||
[](https://builds.apache.org/view/S-Z/view/Struts/job/Struts-master-JDK7/)
|
||||
[](https://travis-ci.org/apache/struts)
|
||||
[](https://maven-badges.herokuapp.com/maven-central/org.apache.struts/struts2-core/)
|
||||
[](https://javadoc.io/doc/org.apache.struts/struts2-core)
|
||||
[](https://sonarcloud.io/summary/new_code?id=apache_struts)
|
||||
[](https://deps.dev/maven/org.apache.struts%3Astruts2-core)
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/6618)
|
||||
[](https://coveralls.io/github/apache/struts)
|
||||
[](https://app.updateimpact.com/latest/713283867011846144/Struts%202)
|
||||
[](http://www.apache.org/licenses/LICENSE-2.0.html)
|
||||
|
||||
The Apache Struts web framework is a free open-source solution for creating Java web applications.
|
||||
|
||||
## Documentation
|
||||
|
||||
More information can be found on the [homepage](https://struts.apache.org/). Please read the [Security Guide](https://struts.apache.org/security/),
|
||||
More information can be found on the [homepage](https://struts.apache.org/). Please read the [Security Guide](https://struts.apache.org/security/)
|
||||
and the [JavaDocs](https://struts.apache.org/maven/struts2-core/apidocs/index.html) can be browsed.
|
||||
Questions related to the usage of Apache Struts should be posted to the [user mailing list](https://struts.apache.org/mail.html).
|
||||
Questions related to the usage of the Apache Struts should be posted to the [user mailing list](https://struts.apache.org/mail.html).
|
||||
|
||||
## Description
|
||||
|
||||
@@ -45,15 +43,13 @@ In practice, we find that unless these concerns are separated, larger applicatio
|
||||
One way to separate concerns in a software application is to use a Model-View-Controller (MVC) architecture. The Model
|
||||
represents the business or database code, the View represents the page design code, and the Controller represents
|
||||
the navigational code. The Struts framework is designed to help developers create web applications that utilize
|
||||
an MVC architecture.
|
||||
a MVC architecture.
|
||||
|
||||
The framework provides three key components:
|
||||
|
||||
- A “request” handler provided by the application developer that is mapped to a standard URI.
|
||||
- A “response” handler that transfers control to another resource which completes the response.
|
||||
- A tag library that helps developers create interactive form-based applications with server pages.
|
||||
|
||||
The framework’s architecture and tags are buzzword compliant. Struts works well
|
||||
A “request” handler provided by the application developer that is mapped to a standard URI. A “response” handler that
|
||||
transfers control to another resource which completes the response. A tag library that helps developers create interactive
|
||||
form-based applications with server pages. The framework’s architecture and tags are buzzword compliant. Struts works well
|
||||
with conventional REST applications and with technologies like SOAP and AJAX.
|
||||
|
||||
## The Apache Struts Project
|
||||
@@ -69,7 +65,7 @@ platform into a coherent whole. Our goal is to leverage existing standards by pr
|
||||
enterprise-grade applications that are easy to maintain over time.
|
||||
|
||||
The Apache Struts Project offered two major versions of the Struts framework. Currently we are only maintaining the Struts 2
|
||||
version. It is recommended to upgrade all Struts 1.x applications to Struts 2. Please do not start new application development
|
||||
version. It is recommended to upgrade all Struts 1.x application to Struts 2. Please do not start new application development
|
||||
using Struts 1.x, as we are no longer issuing security patches.
|
||||
|
||||
Struts 2 was originally known as WebWork 2. After working independently for several years, the WebWork and Struts
|
||||
@@ -78,33 +74,25 @@ to difficult problems.
|
||||
|
||||
## Why should you use Apache Struts?
|
||||
|
||||
Apache Struts is a modern, maintained and full-featured web framework. As it has been around for years and grown a huge user
|
||||
base it is unlikely it will go away anytime soon. Not only that, we have dedicated users and developers
|
||||
on the project. Apache Struts is licensed under the Apache License 2.0 and this will not change. We maintain a clean IP
|
||||
Apache Struts is a modern, maintained and full-featured web framework. It has been there for years and give the huge user
|
||||
base it is unlikely it will go away anytime soon in the future. Not only that we have dedicated users and developers
|
||||
on the project. Apache Struts is licensed to the Apache License 2.0 and this will not change. We maintain a clean IP
|
||||
and you are “safe” to use the project. Sometimes you are not “safe” to use a project when a company controls the SCM.
|
||||
Access to Source Code doesn’t mean it is free. With Apache Struts, you are not only free to “do what you want with it”,
|
||||
you can even contribute (which is not always the case). And best of all: you can become a part of the core team too.
|
||||
you can even contribute (which is not always the case). And best of it: you can become a part of the core team too.
|
||||
|
||||
It is usually very easy to integrate other technologies with Apache Struts. If you are using an ORM like Apache Cayenne,
|
||||
Hibernate or JDBC, you will not have any restrictions. Apache Struts is not even tied too much to a frontend technology.
|
||||
Hibernate or JDBC you will not have any restrictions. Apache Struts is not even tied too much to a frontend technology.
|
||||
In old days it was JSP, then came Velocity and Freemarker. Nowadays you might build your web application with just static
|
||||
HTML and AngularJS. Or you might want to use Sitemesh or Tiles. This all is no problem due to Struts' elegant and easy-to-use
|
||||
HTML and AngularJS. Or you want to use Sitemesh or Tiles. This all is no problem due to Struts elegant and easy to use
|
||||
extension mechanisms.
|
||||
|
||||
Unlike other, component-oriented frameworks, we do not aim to hide the stateless nature of the web. We think it is
|
||||
Unlike other, component oriented frameworks, we do not aim to hide the stateless nature of the web. We think it is
|
||||
perfectly acceptable to build upon a Request/Response cycle. We also think the MVC pattern is not so bad, just because
|
||||
it is old. In fact, we believe the Apache Struts architecture is clean and easy to understand.
|
||||
|
||||
Of course, if you wish to build components on the server side which render on the front end side, you will most likely
|
||||
not want Struts. This is a different approach which promises to reduce the amount of HTML/JavaScript knowledge needed
|
||||
Of course, if you wish to build components on the server side which render on the front end side, you are most likely
|
||||
wrong with Struts. This is a different approach which promises to reduce the amount of HTML/JavaScript knowledge needed
|
||||
and to create reusable components for the view layer. Projects like Wicket and Tapestry serve this purpose very well.
|
||||
As with every framework, you need to decide if it makes sense for you to build components or if you prefer
|
||||
the Struts approach.
|
||||
|
||||
## Commercial Support
|
||||
|
||||
The Apache Struts community does not offer commercial support by itself.
|
||||
|
||||
Some Apache Struts maintainers are working with [Tidelift](https://tidelift.com/) to provide commercial support and
|
||||
invest paid working time in the improvement of the Apache Struts framework. For more information, visit
|
||||
the [Tidelift resources regarding Apache Struts](https://tidelift.com/subscription/pkg/maven-org-apache-struts-struts2-core?utm_source=maven-org-apache-struts-struts2-core&utm_medium=referral&utm_campaign=readme)
|
||||
As with every framework you need to decide if it makes sense for you to build components or if you are better with
|
||||
the Struts-approach.
|
||||
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Please visit the [Releases](https://struts.apache.org/releases.html#prior-releases) page to see full information about each version
|
||||
and what potential vulnerability it can have:
|
||||
|
||||
| Version | Supported |
|
||||
|---------|--------------------|
|
||||
| 6.x | :white_check_mark: |
|
||||
| 2.5.x | :white_check_mark: |
|
||||
|
||||
## Reporting New Security Issues with thr Apache Struts
|
||||
|
||||
([original](https://struts.apache.org/security.html))
|
||||
|
||||
The Apache Struts project takes a very active stance in eliminating security problems
|
||||
and denial of service attacks against applications using the Apache Struts framework.
|
||||
|
||||
**We strongly encourage folks to report such security problems to our private security mailing list first,
|
||||
before disclosing them in a public forum**.
|
||||
|
||||
We cannot accept regular bug reports or other queries at this address, we ask that you use our
|
||||
[issue tracker (JIRA)](https://issues.apache.org/jira/browse/WW) for those.
|
||||
|
||||
```
|
||||
All mail sent to this address that does not relate to security problems in the Apache Struts source code will be ignored
|
||||
```
|
||||
|
||||
Note that all networked servers are subject to denial of service attacks, and we cannot promise magic
|
||||
workarounds to generic problems (such as a client streaming lots of data to your server, or requesting
|
||||
the same URL repeatedly). In general, our philosophy is to avoid any attacks that can cause the server
|
||||
to consume resources in a non-linear relationship to the size of inputs.
|
||||
|
||||
The mailing address is: [security@struts.apache.org](mailto:security@struts.apache.org)
|
||||
|
||||
[General network server security tips](http://httpd.apache.org/docs/trunk/misc/security_tips.html)
|
||||
|
||||
[The Apache Security Team](http://www.apache.org/security/)
|
||||
@@ -1,12 +0,0 @@
|
||||
# Struts 2 Apps
|
||||
These module consists of two example applications, which were built using the Apache Struts project.
|
||||
One is an old-fashioned Web application and another is a modern REST based single page app.
|
||||
|
||||
## Installation
|
||||
Enter a given folder, either `showcase/` or `rest-showcase/` and start the app using Maven:
|
||||
|
||||
```
|
||||
mvn jetty:run
|
||||
```
|
||||
|
||||
then open your browser at http://localhost:8080 and navigate to a proper context.
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>6.5.0</version>
|
||||
<version>2.5.28</version>
|
||||
</parent>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
+17
-15
@@ -24,12 +24,12 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>6.5.0</version>
|
||||
<version>2.5.28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-rest-showcase</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>6.5.0</version>
|
||||
<version>2.5.28</version>
|
||||
<name>Struts 2 Rest Showcase Webapp</name>
|
||||
<description>Struts 2 Rest Showcase Example</description>
|
||||
|
||||
@@ -56,10 +56,12 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -71,31 +73,26 @@
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jwebunit</groupId>
|
||||
<artifactId>jwebunit-core</artifactId>
|
||||
<version>3.3</version>
|
||||
<version>1.4.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.htmlunit</groupId>
|
||||
<artifactId>htmlunit</artifactId>
|
||||
<groupId>commons-httpclient</groupId>
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
<version>3.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jwebunit</groupId>
|
||||
<artifactId>jwebunit-htmlunit-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<version>1.4.1</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xom</groupId>
|
||||
<artifactId>xom</artifactId>
|
||||
</exclusion>
|
||||
<!-- not necessary to compile and it force dependency convergence issues -->
|
||||
<exclusion>
|
||||
<groupId>net.sourceforge.htmlunit</groupId>
|
||||
<artifactId>htmlunit</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
@@ -105,12 +102,18 @@
|
||||
<finalName>struts2-rest-showcase</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>9.4.46.v20220331</version>
|
||||
<version>8.1.16.v20140903</version>
|
||||
<configuration>
|
||||
<stopKey>CTRL+C</stopKey>
|
||||
<stopPort>8999</stopPort>
|
||||
<systemProperties>
|
||||
<systemProperty>
|
||||
<name>xwork.loggerFactory</name>
|
||||
<value>com.opensymphony.xwork2.util.logging.log4j2.Log4j2LoggerFactory</value>
|
||||
</systemProperty>
|
||||
</systemProperties>
|
||||
<scanIntervalSeconds>10</scanIntervalSeconds>
|
||||
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
|
||||
<webAppConfig>
|
||||
@@ -122,7 +125,6 @@
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>@{argLine}</argLine>
|
||||
<excludes>
|
||||
<exclude>it/**</exclude>
|
||||
<exclude>**/*$*</exclude>
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
|
||||
<struts>
|
||||
@@ -41,4 +41,4 @@
|
||||
<package name="rest-showcase" extends="rest-default">
|
||||
<global-allowed-methods>index,show,create,update,destroy,deleteConfirm,edit,editNew</global-allowed-methods>
|
||||
</package>
|
||||
</struts>
|
||||
</struts>
|
||||
@@ -27,16 +27,14 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Orders</title>
|
||||
<!-- Using a standard HTML link tag with JSP EL to get the contextPath may be simpler, but this is an equivalent for s:link -->
|
||||
<s:set var="pageContextPath"><%=((HttpServletRequest)request).getContextPath()%></s:set>
|
||||
<s:link href="%{#pageContextPath}/css/bootstrap.min.css" rel="stylesheet"></s:link>
|
||||
<s:link href="%{#pageContextPath}/css/app.css" rel="stylesheet"></s:link>
|
||||
<link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="${pageContext.request.contextPath}/css/app.css" rel="stylesheet">
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<s:script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></s:script>
|
||||
<s:script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></s:script>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -27,16 +27,14 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Orders</title>
|
||||
<!-- Using a standard HTML link tag with JSP EL to get the contextPath may be simpler, but this is an equivalent for s:link -->
|
||||
<s:set var="pageContextPath"><%=((HttpServletRequest)request).getContextPath()%></s:set>
|
||||
<s:link href="%{#pageContextPath}/css/bootstrap.min.css" rel="stylesheet"></s:link>
|
||||
<s:link href="%{#pageContextPath}/css/app.css" rel="stylesheet"></s:link>
|
||||
<link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="${pageContext.request.contextPath}/css/app.css" rel="stylesheet">
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<s:script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></s:script>
|
||||
<s:script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></s:script>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -27,16 +27,13 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Orders</title>
|
||||
<!-- Using a standard HTML link tag with JSP EL to get the contextPath may be simpler, but this is an equivalent for s:link -->
|
||||
<s:set var="pageContextPath"><%=((HttpServletRequest)request).getContextPath()%></s:set>
|
||||
<s:link href="%{#pageContextPath}/css/bootstrap.min.css" rel="stylesheet"></s:link>
|
||||
<s:link href="%{#pageContextPath}/css/app.css" rel="stylesheet"></s:link>
|
||||
|
||||
<link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="${pageContext.request.contextPath}/css/app.css" rel="stylesheet">
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<s:script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></s:script>
|
||||
<s:script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></s:script>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -27,16 +27,14 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Orders</title>
|
||||
<!-- Using a standard HTML link tag with JSP EL to get the contextPath may be simpler, but this is an equivalent for s:link -->
|
||||
<s:set var="pageContextPath"><%=((HttpServletRequest)request).getContextPath()%></s:set>
|
||||
<s:link href="%{#pageContextPath}/css/bootstrap.min.css" rel="stylesheet"></s:link>
|
||||
<s:link href="%{#pageContextPath}/css/app.css" rel="stylesheet"></s:link>
|
||||
<link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="${pageContext.request.contextPath}/css/app.css" rel="stylesheet">
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<s:script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></s:script>
|
||||
<s:script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></s:script>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -27,16 +27,14 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Orders</title>
|
||||
<!-- Using a standard HTML link tag with JSP EL to get the contextPath may be simpler, but this is an equivalent for s:link -->
|
||||
<s:set var="pageContextPath"><%=((HttpServletRequest)request).getContextPath()%></s:set>
|
||||
<s:link href="%{#pageContextPath}/css/bootstrap.min.css" rel="stylesheet"></s:link>
|
||||
<s:link href="%{#pageContextPath}/css/app.css" rel="stylesheet"></s:link>
|
||||
<link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="${pageContext.request.contextPath}/css/app.css" rel="stylesheet">
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<s:script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></s:script>
|
||||
<s:script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></s:script>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -19,16 +19,16 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||
<web-app id="starter" version="2.4"
|
||||
xmlns="http://java.sun.com/xml/ns/j2ee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
|
||||
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
|
||||
version="3.1">
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
|
||||
|
||||
<display-name>Struts 2 Rest Example</display-name>
|
||||
<display-name>Struts 2 Rest Example</display-name>
|
||||
|
||||
<!-- Filters -->
|
||||
<!-- START SNIPPET: filter -->
|
||||
|
||||
<!-- Filters -->
|
||||
<!-- START SNIPPET: filter -->
|
||||
<filter>
|
||||
<filter-name>action2</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
|
||||
|
||||
+59
-42
@@ -18,16 +18,15 @@
|
||||
*/
|
||||
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.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.methods.PostMethod;
|
||||
import org.apache.commons.httpclient.methods.StringRequestEntity;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
|
||||
|
||||
public class PostOrderTest extends WebTestCase {
|
||||
|
||||
public void setUp() throws Exception {
|
||||
@@ -73,50 +72,68 @@ public class PostOrderTest extends WebTestCase {
|
||||
}
|
||||
|
||||
public void testPostOrderInXml() throws IOException {
|
||||
CloseableHttpClient client = HttpClients.createDefault();
|
||||
HttpPost httpPost = new HttpPost(ParameterUtils.getBaseUrl() + "/orders.xml");
|
||||
httpPost.setEntity(new StringEntity("<org.apache.struts2.rest.example.Order>\n" +
|
||||
"<clientName>Test3</clientName>\n" +
|
||||
"<amount>3342</amount>\n" +
|
||||
"</org.apache.struts2.rest.example.Order>"));
|
||||
CloseableHttpResponse response = client.execute(httpPost);
|
||||
assertEquals(201, response.getStatusLine().getStatusCode());
|
||||
assertTrue(response.getHeaders("Location")[0].getValue().startsWith(ParameterUtils.getBaseUrl() + "/orders/"));
|
||||
client.close();
|
||||
HttpClient client = new HttpClient();
|
||||
PostMethod method = null;
|
||||
try {
|
||||
method = new PostMethod(ParameterUtils.getBaseUrl()+"/orders.xml");
|
||||
method.setRequestEntity(new StringRequestEntity("<org.apache.struts2.rest.example.Order>\n" +
|
||||
"<clientName>Test3</clientName>\n" +
|
||||
"<amount>3342</amount>\n" +
|
||||
"</org.apache.struts2.rest.example.Order>"));
|
||||
client.executeMethod(method);
|
||||
assertEquals(201, method.getStatusCode());
|
||||
assertTrue(method.getResponseHeader("Location").getValue().startsWith(ParameterUtils.getBaseUrl()+"/orders/"));
|
||||
} finally {
|
||||
method.releaseConnection();
|
||||
}
|
||||
}
|
||||
|
||||
public void testPostOrderInXmlWithBadData() throws IOException {
|
||||
CloseableHttpClient client = HttpClients.createDefault();
|
||||
HttpPost httpPost = new HttpPost(ParameterUtils.getBaseUrl() + "/orders.xml");
|
||||
httpPost.setEntity(new StringEntity("<org.apache.struts2.rest.example.Order>\n" +
|
||||
"<amount>3342</amount>\n" +
|
||||
"</org.apache.struts2.rest.example.Order>"));
|
||||
CloseableHttpResponse response = client.execute(httpPost);
|
||||
assertEquals(400, response.getStatusLine().getStatusCode());
|
||||
assertTrue(response.toString().contains("<string>The client name is empty"));
|
||||
assertNull(response.getHeaders("Location"));
|
||||
client.close();
|
||||
HttpClient client = new HttpClient();
|
||||
PostMethod method = null;
|
||||
try {
|
||||
method = new PostMethod(ParameterUtils.getBaseUrl()+"/orders.xml");
|
||||
method.setRequestEntity(new StringRequestEntity("<org.apache.struts2.rest.example.Order>\n" +
|
||||
"<amount>3342</amount>\n" +
|
||||
"</org.apache.struts2.rest.example.Order>"));
|
||||
client.executeMethod(method);
|
||||
assertEquals(400, method.getStatusCode());
|
||||
String response = method.getResponseBodyAsString();
|
||||
assertTrue(response.contains("<string>The client name is empty"));
|
||||
assertNull(method.getResponseHeader("Location"));
|
||||
} finally {
|
||||
method.releaseConnection();
|
||||
}
|
||||
}
|
||||
|
||||
public void testPostOrderInJson() throws IOException {
|
||||
CloseableHttpClient client = HttpClients.createDefault();
|
||||
HttpPost httpPost = new HttpPost(ParameterUtils.getBaseUrl() + "/orders.json");
|
||||
httpPost.setEntity(new StringEntity("{\"amount\":33,\"clientName\":\"Test4\"}"));
|
||||
CloseableHttpResponse response = client.execute(httpPost);
|
||||
assertEquals(201, response.getStatusLine().getStatusCode());
|
||||
assertTrue(response.getHeaders("Location")[0].getValue().startsWith(ParameterUtils.getBaseUrl() + "/orders/"));
|
||||
client.close();
|
||||
HttpClient client = new HttpClient();
|
||||
PostMethod method = null;
|
||||
try {
|
||||
method = new PostMethod(ParameterUtils.getBaseUrl()+"/orders.json");
|
||||
method.setRequestEntity(new StringRequestEntity("{\"amount\":33,\"clientName\":\"Test4\"}"));
|
||||
client.executeMethod(method);
|
||||
assertEquals(201, method.getStatusCode());
|
||||
assertTrue(method.getResponseHeader("Location").getValue().startsWith(ParameterUtils.getBaseUrl()+"/orders/"));
|
||||
} finally {
|
||||
method.releaseConnection();
|
||||
}
|
||||
}
|
||||
|
||||
public void testPostOrderInJsonWithBadData() throws IOException {
|
||||
CloseableHttpClient client = HttpClients.createDefault();
|
||||
HttpPost httpPost = new HttpPost(ParameterUtils.getBaseUrl() + "/orders.json");
|
||||
httpPost.setEntity(new StringEntity("{\"amount\":33}"));
|
||||
CloseableHttpResponse response = client.execute(httpPost);
|
||||
assertEquals(400, response.getStatusLine().getStatusCode());
|
||||
assertTrue(response.toString()
|
||||
.contains("{\"actionErrors\":[],\"fieldErrors\":{\"clientName\":[\"The client name is empty\"]}}"));
|
||||
assertNull(response.getHeaders("Location"));
|
||||
client.close();
|
||||
HttpClient client = new HttpClient();
|
||||
PostMethod method = null;
|
||||
try {
|
||||
method = new PostMethod(ParameterUtils.getBaseUrl()+"/orders.json");
|
||||
method.setRequestEntity(new StringRequestEntity("{\"amount\":33}"));
|
||||
client.executeMethod(method);
|
||||
String response = method.getResponseBodyAsString();
|
||||
assertEquals(400, method.getStatusCode());
|
||||
|
||||
assertEquals("{\"actionErrors\":[],\"fieldErrors\":{\"clientName\":[\"The client name is empty\"]}}", response);
|
||||
assertNull(method.getResponseHeader("Location"));
|
||||
} finally {
|
||||
method.releaseConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
+66
-82
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>6.5.0</version>
|
||||
<version>2.5.28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-showcase</artifactId>
|
||||
@@ -68,6 +68,12 @@
|
||||
<artifactId>struts2-json-plugin</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.tiles</groupId>
|
||||
<artifactId>tiles-jsp</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-convention-plugin</artifactId>
|
||||
@@ -83,24 +89,9 @@
|
||||
<artifactId>struts2-bean-validation-plugin</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-async-plugin</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-velocity-plugin</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-xslt-plugin</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -108,18 +99,28 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-jcl</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Velocity -->
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-slf4j-impl</artifactId>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-tools</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -127,27 +128,55 @@
|
||||
<artifactId>sitemesh</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.directwebremoting</groupId>
|
||||
<groupId>uk.ltd.getahead</groupId>
|
||||
<artifactId>dwr</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.htmlunit</groupId>
|
||||
<artifactId>htmlunit</artifactId>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jwebunit</groupId>
|
||||
<artifactId>jwebunit-core</artifactId>
|
||||
<version>1.4.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-httpclient</groupId>
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
<version>3.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jwebunit</groupId>
|
||||
<artifactId>jwebunit-htmlunit-plugin</artifactId>
|
||||
<version>1.4.1</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xom</groupId>
|
||||
<artifactId>xom</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- BeanValidation Example -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate.validator</groupId>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>${hibernate-validator.version}</version>
|
||||
<version>5.4.3.Final</version>
|
||||
</dependency>
|
||||
|
||||
<!-- The Servlet API mocks in Spring Framework 4.x only supports Servlet 3.0 and higher.
|
||||
This is only necessary in tests-->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
@@ -155,48 +184,22 @@
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>it.org.apache.struts2.showcase.*Test</include>
|
||||
</includes>
|
||||
<systemPropertyVariables>
|
||||
<http.port>8090</http.port>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>integration-test</id>
|
||||
<goals>
|
||||
<goal>integration-test</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>verify</id>
|
||||
<goals>
|
||||
<goal>verify</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>9.4.46.v20220331</version>
|
||||
<version>8.1.16.v20140903</version>
|
||||
<configuration>
|
||||
<stopKey>CTRL+C</stopKey>
|
||||
<stopPort>8999</stopPort>
|
||||
<systemProperties>
|
||||
<systemProperty>
|
||||
<name>log4j.configuration</name>
|
||||
<value>file:${basedir}/src/main/resources/log4j.properties</value>
|
||||
</systemProperty>
|
||||
<systemProperty>
|
||||
<name>slf4j</name>
|
||||
<value>false</value>
|
||||
</systemProperty>
|
||||
</systemProperties>
|
||||
<httpConnector>
|
||||
<port>8090</port>
|
||||
</httpConnector>
|
||||
<scanIntervalSeconds>10</scanIntervalSeconds>
|
||||
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
|
||||
<webAppConfig>
|
||||
@@ -204,30 +207,11 @@
|
||||
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
|
||||
</webAppConfig>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>start-jetty</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<!-- stop any previous instance to free up the port -->
|
||||
<goal>stop</goal>
|
||||
<goal>start</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>stop-jetty</id>
|
||||
<phase>post-integration-test</phase>
|
||||
<goals>
|
||||
<goal>stop</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>@{argLine}</argLine>
|
||||
<excludes>
|
||||
<exclude>it/**</exclude>
|
||||
<exclude>**/*$*</exclude>
|
||||
|
||||
@@ -36,7 +36,6 @@ public class MoreSelectsAction extends ActionSupport {
|
||||
private List _prioritisedFavouriteCars;
|
||||
private List _prioritisedFavouriteCountries;
|
||||
private List favouriteNumbers;
|
||||
private List favouriteCities;
|
||||
|
||||
|
||||
// Cartoon Characters
|
||||
@@ -125,14 +124,6 @@ public class MoreSelectsAction extends ActionSupport {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List getFavouriteCities() {
|
||||
return favouriteCities;
|
||||
}
|
||||
|
||||
public void setFavouriteCities(List favouriteCities) {
|
||||
this.favouriteCities = favouriteCities;
|
||||
}
|
||||
|
||||
// actions
|
||||
|
||||
public String input() throws Exception {
|
||||
|
||||
@@ -24,15 +24,9 @@ import com.opensymphony.xwork2.ActionSupport;
|
||||
import com.opensymphony.xwork2.Validateable;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.interceptor.parameter.StrutsParameter;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -95,7 +89,6 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
return leftSideCartoonCharacters;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setLeftSideCartoonCharacters(List leftSideCartoonCharacters) {
|
||||
this.leftSideCartoonCharacters = leftSideCartoonCharacters;
|
||||
}
|
||||
@@ -105,7 +98,6 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
return rightSideCartoonCharacters;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setRightSideCartoonCharacters(List rightSideCartoonCharacters) {
|
||||
this.rightSideCartoonCharacters = rightSideCartoonCharacters;
|
||||
}
|
||||
@@ -115,7 +107,6 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
return favouriteVehicalType;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setFavouriteVehicalType(String favouriteVehicalType) {
|
||||
this.favouriteVehicalType = favouriteVehicalType;
|
||||
}
|
||||
@@ -124,7 +115,6 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
return favouriteVehicalSpecific;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setFavouriteVehicalSpecific(String favouriteVehicalSpecific) {
|
||||
this.favouriteVehicalSpecific = favouriteVehicalSpecific;
|
||||
}
|
||||
@@ -155,7 +145,6 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
return name;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
@@ -164,7 +153,6 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setBirthday(Date birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
@@ -173,7 +161,6 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
return bio;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setBio(String bio) {
|
||||
this.bio = bio;
|
||||
}
|
||||
@@ -182,7 +169,6 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
return favouriteColor;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setFavouriteColor(String favoriteColor) {
|
||||
this.favouriteColor = favoriteColor;
|
||||
}
|
||||
@@ -191,7 +177,6 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
return friends;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setFriends(List friends) {
|
||||
this.friends = friends;
|
||||
}
|
||||
@@ -208,7 +193,6 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
return legalAge;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setLegalAge(boolean legalAge) {
|
||||
this.legalAge = legalAge;
|
||||
}
|
||||
@@ -217,7 +201,6 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
return state;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
@@ -226,7 +209,6 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
return region;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
@@ -247,7 +229,6 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
this.pictureFileName = pictureFileName;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setFavouriteLanguage(String favouriteLanguage) {
|
||||
this.favouriteLanguage = favouriteLanguage;
|
||||
}
|
||||
@@ -256,7 +237,7 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
return favouriteLanguage;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
|
||||
public void setThoughts(String thoughts) {
|
||||
this.thoughts = thoughts;
|
||||
}
|
||||
@@ -269,7 +250,6 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
return wakeup;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setWakeup(Date wakeup) {
|
||||
this.wakeup = wakeup;
|
||||
}
|
||||
|
||||
-133
@@ -1,133 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.showcase.action;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.interceptor.parameter.StrutsParameter;
|
||||
import org.apache.struts2.showcase.model.MyDto;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
import static java.util.Collections.singletonMap;
|
||||
|
||||
/**
|
||||
* This class supports {@link com.atlassian.confluence.stateless.webdriver.selenium3.security.StrutsParametersTest}
|
||||
* which prevents critical security regressions. Do NOT modify without understanding the motivation behind the tests and
|
||||
* the implications of any changes.
|
||||
*/
|
||||
public class ParamsAnnotationAction extends ActionSupport {
|
||||
|
||||
@StrutsParameter
|
||||
public String varToPrint;
|
||||
|
||||
public String publicField = "no";
|
||||
|
||||
@StrutsParameter
|
||||
public String publicFieldAnnotated = "no";
|
||||
|
||||
private String privateField = "no";
|
||||
|
||||
public int[] publicArray = new int[]{0};
|
||||
|
||||
@StrutsParameter(depth = 1)
|
||||
public int[] publicArrayAnnotated = new int[]{0};
|
||||
|
||||
public List<String> publicList = new ArrayList<>(singletonList("no"));
|
||||
|
||||
@StrutsParameter(depth = 1)
|
||||
public List<String> publicListAnnotated = new ArrayList<>(singletonList("no"));
|
||||
|
||||
private List<String> privateList = new ArrayList<>(singletonList("no"));
|
||||
|
||||
public Map<String, String> publicMap = new HashMap<>(singletonMap("key", "no"));
|
||||
|
||||
@StrutsParameter(depth = 1)
|
||||
public Map<String, String> publicMapAnnotated = new HashMap<>(singletonMap("key", "no"));
|
||||
|
||||
public MyDto publicMyDto = new MyDto();
|
||||
|
||||
@StrutsParameter(depth = 2)
|
||||
public MyDto publicMyDtoAnnotated = new MyDto();
|
||||
|
||||
@StrutsParameter(depth = 1)
|
||||
public MyDto publicMyDtoAnnotatedDepthOne = new MyDto();
|
||||
|
||||
private MyDto privateMyDto = new MyDto();
|
||||
|
||||
public void setPrivateFieldMethod(String privateField) {
|
||||
this.privateField = privateField;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setPrivateFieldMethodAnnotated(String privateField) {
|
||||
this.privateField = privateField;
|
||||
}
|
||||
|
||||
public List<String> getPrivateListMethod() {
|
||||
return privateList;
|
||||
}
|
||||
|
||||
@StrutsParameter(depth = 1)
|
||||
public List<String> getPrivateListMethodAnnotated() {
|
||||
return privateList;
|
||||
}
|
||||
|
||||
public MyDto getUnsafeMethodMyDto() {
|
||||
return privateMyDto;
|
||||
}
|
||||
|
||||
@StrutsParameter(depth = 2)
|
||||
public MyDto getSafeMethodMyDto() {
|
||||
return privateMyDto;
|
||||
}
|
||||
|
||||
@StrutsParameter(depth = 1)
|
||||
public MyDto getSafeMethodMyDtoDepthOne() {
|
||||
return privateMyDto;
|
||||
}
|
||||
|
||||
public String renderVarToPrint() throws ReflectiveOperationException {
|
||||
if (varToPrint == null) {
|
||||
return "null";
|
||||
}
|
||||
Field field = this.getClass().getDeclaredField(varToPrint);
|
||||
field.setAccessible(true);
|
||||
try {
|
||||
return String.format("%s{%s}", varToPrint,
|
||||
field.getType().isArray() ? stringifyArray(field.get(this)) : field.get(this));
|
||||
} finally {
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
|
||||
private String stringifyArray(Object array) {
|
||||
switch (array.getClass().getComponentType().getName()) {
|
||||
case "int":
|
||||
return Arrays.toString((int[]) array);
|
||||
default:
|
||||
return "TODO";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ package org.apache.struts2.showcase.action;
|
||||
import com.opensymphony.xwork2.Preparable;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.struts2.interceptor.parameter.StrutsParameter;
|
||||
import org.apache.struts2.showcase.dao.Dao;
|
||||
import org.apache.struts2.showcase.dao.SkillDao;
|
||||
import org.apache.struts2.showcase.model.Skill;
|
||||
@@ -72,7 +71,6 @@ public class SkillAction extends AbstractCRUDAction implements Preparable {
|
||||
return skillDao;
|
||||
}
|
||||
|
||||
@StrutsParameter(depth = 1)
|
||||
public Skill getCurrentSkill() {
|
||||
return currentSkill;
|
||||
}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.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 java.io.IOException;
|
||||
|
||||
/**
|
||||
* Filters async actions directly to Struts servlet
|
||||
*/
|
||||
public class AsyncFilter implements Filter {
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
|
||||
String requestURI = ((HttpServletRequest) servletRequest).getRequestURI();
|
||||
if (!requestURI.contains("/async/receiveNewMessages")) {
|
||||
filterChain.doFilter(servletRequest, servletResponse); // Just continue chain.
|
||||
} else {
|
||||
servletRequest.getRequestDispatcher("/async/receiveNewMessages").forward(servletRequest, servletResponse);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.showcase.async;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.interceptor.parameter.StrutsParameter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
/**
|
||||
* Example to illustrate the <code>async</code> plugin.
|
||||
*/
|
||||
public class ChatRoomAction extends ActionSupport {
|
||||
private String message;
|
||||
private Integer lastIndex;
|
||||
private List<String> newMessages;
|
||||
|
||||
private static final List<String> messages = new ArrayList<>();
|
||||
|
||||
@StrutsParameter
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setLastIndex(Integer lastIndex) {
|
||||
this.lastIndex = lastIndex;
|
||||
}
|
||||
|
||||
public List<String> getNewMessages() {
|
||||
return newMessages;
|
||||
}
|
||||
|
||||
public Callable<String> receiveNewMessages() throws Exception {
|
||||
return new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
while (lastIndex >= messages.size()) {
|
||||
Thread.sleep(3000);
|
||||
}
|
||||
newMessages = messages.subList(lastIndex, messages.size());
|
||||
return SUCCESS;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public String sendMessage() {
|
||||
synchronized (messages) {
|
||||
messages.add(message);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
+14
-15
@@ -25,28 +25,27 @@ import com.opensymphony.xwork2.Action;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.Map;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.struts2.dispatcher.SessionMap;
|
||||
|
||||
public class ChatAuthenticationInterceptor extends AbstractInterceptor {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger LOG = LogManager.getLogger(ChatAuthenticationInterceptor.class);
|
||||
public static final String USER_SESSION_KEY = "chatUserSessionKey";
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger LOG = LogManager.getLogger(ChatAuthenticationInterceptor.class);
|
||||
public static final String USER_SESSION_KEY = "chatUserSessionKey";
|
||||
|
||||
public String intercept(ActionInvocation invocation) throws Exception {
|
||||
public String intercept(ActionInvocation invocation) throws Exception {
|
||||
|
||||
LOG.debug("Authenticating chat user");
|
||||
LOG.debug("Authenticating chat user");
|
||||
|
||||
Map<String, Object> session = ActionContext.getContext().getSession();
|
||||
User user = (User) session.get(USER_SESSION_KEY);
|
||||
SessionMap session = (SessionMap) ActionContext.getContext().get(ActionContext.SESSION);
|
||||
User user = (User) session.get(USER_SESSION_KEY);
|
||||
|
||||
if (user == null) {
|
||||
return Action.LOGIN;
|
||||
}
|
||||
return invocation.invoke();
|
||||
}
|
||||
if (user == null) {
|
||||
return Action.LOGIN;
|
||||
}
|
||||
return invocation.invoke();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,31 +24,31 @@ import com.opensymphony.xwork2.Action;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
/**
|
||||
* Authenticate showcase chat example, make sure everyone have a username.
|
||||
*/
|
||||
public class ChatInterceptor extends AbstractInterceptor {
|
||||
|
||||
private static final Logger LOG = LogManager.getLogger(ChatInterceptor.class);
|
||||
private static final Logger LOG = LogManager.getLogger(ChatInterceptor.class);
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final String CHAT_USER_SESSION_KEY = "ChatUserSessionKey";
|
||||
public static final String CHAT_USER_SESSION_KEY = "ChatUserSessionKey";
|
||||
|
||||
public String intercept(ActionInvocation invocation) throws Exception {
|
||||
Map<String, Object> session = ActionContext.getContext().getSession();
|
||||
User chatUser = (User) session.get(CHAT_USER_SESSION_KEY);
|
||||
if (chatUser == null) {
|
||||
LOG.debug("Chat user not logged in");
|
||||
return Action.LOGIN;
|
||||
}
|
||||
return invocation.invoke();
|
||||
}
|
||||
public String intercept(ActionInvocation invocation) throws Exception {
|
||||
HttpSession session = (HttpSession) ActionContext.getContext().get(ActionContext.SESSION);
|
||||
User chatUser = (User) session.getAttribute(CHAT_USER_SESSION_KEY);
|
||||
if (chatUser == null) {
|
||||
LOG.debug("Chat user not logged in");
|
||||
return Action.LOGIN;
|
||||
}
|
||||
return invocation.invoke();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,17 +21,16 @@
|
||||
package org.apache.struts2.showcase.chat;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.interceptor.SessionAware;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.struts2.action.SessionAware;
|
||||
|
||||
public class ChatLoginAction extends ActionSupport implements SessionAware {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private ChatService chatService;
|
||||
private Map<String, Object> session;
|
||||
private Map session;
|
||||
|
||||
private String name;
|
||||
|
||||
@@ -61,8 +60,8 @@ public class ChatLoginAction extends ActionSupport implements SessionAware {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void withSession(Map<String, Object> session) {
|
||||
this.session = session;
|
||||
}
|
||||
// === SessionAware ===
|
||||
public void setSession(Map session) {
|
||||
this.session = session;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,18 +21,17 @@
|
||||
package org.apache.struts2.showcase.chat;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.interceptor.SessionAware;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.struts2.action.SessionAware;
|
||||
|
||||
public class ChatLogoutAction extends ActionSupport implements SessionAware {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private ChatService chatService;
|
||||
|
||||
private Map<String, Object> session;
|
||||
private Map session;
|
||||
|
||||
|
||||
public ChatLogoutAction(ChatService chatService) {
|
||||
@@ -51,8 +50,8 @@ public class ChatLogoutAction extends ActionSupport implements SessionAware {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void withSession(Map<String, Object> session) {
|
||||
this.session = session;
|
||||
}
|
||||
// === SessionAware ===
|
||||
public void setSession(Map session) {
|
||||
this.session = session;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
*/
|
||||
package org.apache.struts2.showcase.chat;
|
||||
|
||||
import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.struts2.util.StrutsTypeConverter;
|
||||
@@ -35,13 +33,6 @@ public class DateConverter extends StrutsTypeConverter {
|
||||
|
||||
private static final Logger LOG = LogManager.getLogger(DateConverter.class);
|
||||
|
||||
private XWorkConverter fallbackConverter;
|
||||
|
||||
@Inject
|
||||
public void setXWorkConverter(XWorkConverter fallbackConverter) {
|
||||
this.fallbackConverter = fallbackConverter;
|
||||
}
|
||||
|
||||
public Object convertFromString(Map context, String[] values, Class toClass) {
|
||||
|
||||
if (values.length > 0 && values[0] != null && values[0].trim().length() > 0) {
|
||||
@@ -49,8 +40,7 @@ public class DateConverter extends StrutsTypeConverter {
|
||||
try {
|
||||
return sdf.parse(values[0]);
|
||||
} catch (ParseException e) {
|
||||
LOG.warn("error converting value [" + values[0] + "] to Date. Trying fallback converter.");
|
||||
return this.fallbackConverter.convertValue(context, values[0], toClass);
|
||||
LOG.error("error converting value [" + values[0] + "] to Date ", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -21,17 +21,16 @@
|
||||
package org.apache.struts2.showcase.chat;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.interceptor.SessionAware;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.struts2.action.SessionAware;
|
||||
|
||||
public class EnterRoomAction extends ActionSupport implements SessionAware {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private ChatService chatService;
|
||||
private Map<String, Object> session;
|
||||
private Map session;
|
||||
private String roomName;
|
||||
|
||||
public String getRoomName() {
|
||||
@@ -57,9 +56,10 @@ public class EnterRoomAction extends ActionSupport implements SessionAware {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withSession(Map<String, Object> session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
// === SessionAware ===
|
||||
public void setSession(Map session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,18 +21,17 @@
|
||||
package org.apache.struts2.showcase.chat;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.interceptor.SessionAware;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.struts2.action.SessionAware;
|
||||
|
||||
public class ExitRoomAction extends ActionSupport implements SessionAware {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String roomName;
|
||||
|
||||
private Map<String, Object> session;
|
||||
private Map session;
|
||||
|
||||
public String getRoomName() {
|
||||
return roomName;
|
||||
@@ -55,9 +54,9 @@ public class ExitRoomAction extends ActionSupport implements SessionAware {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withSession(Map<String, Object> session) {
|
||||
this.session = session;
|
||||
}
|
||||
// === SessionAware ===
|
||||
public void setSession(Map session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-7
@@ -21,11 +21,10 @@
|
||||
package org.apache.struts2.showcase.chat;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.interceptor.SessionAware;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.struts2.action.SessionAware;
|
||||
|
||||
public class SendMessageToRoomAction extends ActionSupport implements SessionAware {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -34,7 +33,7 @@ public class SendMessageToRoomAction extends ActionSupport implements SessionAwa
|
||||
|
||||
private String roomName;
|
||||
private String message;
|
||||
private Map<String, Object> session;
|
||||
private Map session;
|
||||
|
||||
|
||||
public SendMessageToRoomAction(ChatService chatService) {
|
||||
@@ -68,10 +67,9 @@ public class SendMessageToRoomAction extends ActionSupport implements SessionAwa
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withSession(Map<String, Object> session) {
|
||||
this.session = session;
|
||||
}
|
||||
public void setSession(Map session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-3
@@ -21,7 +21,6 @@
|
||||
package org.apache.struts2.showcase.conversion;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.interceptor.parameter.StrutsParameter;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
@@ -31,7 +30,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class AddressAction extends ActionSupport {
|
||||
|
||||
private Set<Address> addresses = new LinkedHashSet<>();
|
||||
private Set<Address> addresses = new LinkedHashSet<Address>();
|
||||
|
||||
public String input() throws Exception {
|
||||
return SUCCESS;
|
||||
@@ -42,7 +41,6 @@ public class AddressAction extends ActionSupport {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@StrutsParameter(depth = 2)
|
||||
public Set<Address> getAddresses() {
|
||||
return addresses;
|
||||
}
|
||||
|
||||
-2
@@ -21,7 +21,6 @@
|
||||
package org.apache.struts2.showcase.conversion;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.interceptor.parameter.StrutsParameter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
@@ -48,7 +47,6 @@ public class OperationsEnumAction extends ActionSupport {
|
||||
return this.selectedOperations;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setSelectedOperations(List<OperationsEnum> selectedOperations) {
|
||||
this.selectedOperations = selectedOperations;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
package org.apache.struts2.showcase.conversion;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.interceptor.parameter.StrutsParameter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -37,7 +36,6 @@ public class PersonAction extends ActionSupport {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@StrutsParameter(depth = 2)
|
||||
public List<Person> getPersons() {
|
||||
return persons;
|
||||
}
|
||||
|
||||
-2
@@ -22,7 +22,6 @@ package org.apache.struts2.showcase.filedownload;
|
||||
|
||||
import com.opensymphony.xwork2.Action;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.interceptor.parameter.StrutsParameter;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
@@ -39,7 +38,6 @@ public class FileDownloadAction implements Action {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setInputPath(String value) {
|
||||
inputPath = sanitizeInputPath(value);
|
||||
}
|
||||
|
||||
+55
-49
@@ -21,69 +21,75 @@
|
||||
package org.apache.struts2.showcase.fileupload;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.action.UploadedFilesAware;
|
||||
import org.apache.struts2.dispatcher.multipart.UploadedFile;
|
||||
import org.apache.struts2.interceptor.parameter.StrutsParameter;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Show case File Upload example's action. <code>FileUploadAction</code>
|
||||
*/
|
||||
public class FileUploadAction extends ActionSupport implements UploadedFilesAware {
|
||||
public class FileUploadAction extends ActionSupport {
|
||||
|
||||
private String contentType;
|
||||
private UploadedFile uploadedFile;
|
||||
private String fileName;
|
||||
private String caption;
|
||||
private String originalName;
|
||||
private static final long serialVersionUID = 5156288255337069381L;
|
||||
|
||||
public String input() throws Exception {
|
||||
return SUCCESS;
|
||||
}
|
||||
private String contentType;
|
||||
private File upload;
|
||||
private String fileName;
|
||||
private String caption;
|
||||
|
||||
public String upload() throws Exception {
|
||||
return SUCCESS;
|
||||
}
|
||||
public String input() throws Exception {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
public String upload() throws Exception {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
// since we are using <s:file name="upload" .../> the file name will be
|
||||
// obtained through getter/setter of <file-tag-name>FileName
|
||||
public String getUploadFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public String getOriginalName() {
|
||||
return originalName;
|
||||
}
|
||||
public void setUploadFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public Object getUploadedFile() {
|
||||
return uploadedFile.getContent();
|
||||
}
|
||||
|
||||
public String getCaption() {
|
||||
return caption;
|
||||
}
|
||||
// since we are using <s:file name="upload" ... /> the content type will be
|
||||
// obtained through getter/setter of <file-tag-name>ContentType
|
||||
public String getUploadContentType() {
|
||||
return contentType;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setCaption(String caption) {
|
||||
this.caption = caption;
|
||||
}
|
||||
public void setUploadContentType(String contentType) {
|
||||
this.contentType = contentType;
|
||||
}
|
||||
|
||||
public long getUploadSize() {
|
||||
if (uploadedFile != null) {
|
||||
return uploadedFile.length();
|
||||
} else {
|
||||
return 0;
|
||||
|
||||
// since we are using <s:file name="upload" ... /> the File itself will be
|
||||
// obtained through getter/setter of <file-tag-name>
|
||||
public File getUpload() {
|
||||
return upload;
|
||||
}
|
||||
|
||||
public void setUpload(File upload) {
|
||||
this.upload = upload;
|
||||
}
|
||||
|
||||
|
||||
public String getCaption() {
|
||||
return caption;
|
||||
}
|
||||
|
||||
public void setCaption(String caption) {
|
||||
this.caption = caption;
|
||||
}
|
||||
|
||||
public long getUploadSize() {
|
||||
if (upload != null) {
|
||||
return upload.length();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withUploadedFiles(List<UploadedFile> uploadedFiles) {
|
||||
this.uploadedFile = uploadedFiles.get(0);
|
||||
this.fileName = uploadedFile.getName();
|
||||
this.contentType = uploadedFile.getContentType();
|
||||
this.originalName = uploadedFile.getOriginalName();
|
||||
}
|
||||
}
|
||||
|
||||
+46
-36
@@ -22,51 +22,61 @@
|
||||
package org.apache.struts2.showcase.fileupload;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.action.UploadedFilesAware;
|
||||
import org.apache.struts2.dispatcher.multipart.UploadedFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Showcase action - mutiple file upload using array.
|
||||
*
|
||||
* @version $Date$ $Id$
|
||||
*/
|
||||
public class MultipleFileUploadUsingArrayAction extends ActionSupport implements UploadedFilesAware {
|
||||
public class MultipleFileUploadUsingArrayAction extends ActionSupport {
|
||||
|
||||
private List<UploadedFile> uploadedFiles;
|
||||
private File[] uploads;
|
||||
private String[] uploadFileNames;
|
||||
private String[] uploadContentTypes;
|
||||
|
||||
public String upload() throws Exception {
|
||||
System.out.println("\n\n upload2");
|
||||
System.out.println("files:");
|
||||
for (UploadedFile u : uploadedFiles) {
|
||||
System.out.println("*** " + u + "\t" + u.length());
|
||||
}
|
||||
System.out.println("filenames:");
|
||||
for (String n : getUploadFileNames()) {
|
||||
System.out.println("*** " + n);
|
||||
}
|
||||
System.out.println("content types:");
|
||||
for (String c : getUploadContentTypes()) {
|
||||
System.out.println("*** " + c);
|
||||
}
|
||||
System.out.println("\n\n");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withUploadedFiles(List<UploadedFile> uploadedFiles) {
|
||||
this.uploadedFiles = uploadedFiles;
|
||||
}
|
||||
public String upload() throws Exception {
|
||||
System.out.println("\n\n upload2");
|
||||
System.out.println("files:");
|
||||
for (File u : uploads) {
|
||||
System.out.println("*** " + u + "\t" + u.length());
|
||||
}
|
||||
System.out.println("filenames:");
|
||||
for (String n : uploadFileNames) {
|
||||
System.out.println("*** " + n);
|
||||
}
|
||||
System.out.println("content types:");
|
||||
for (String c : uploadContentTypes) {
|
||||
System.out.println("*** " + c);
|
||||
}
|
||||
System.out.println("\n\n");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
private String[] getUploadFileNames() {
|
||||
return this.uploadedFiles.stream()
|
||||
.map(UploadedFile::getOriginalName)
|
||||
.toArray(String[]::new);
|
||||
}
|
||||
public File[] getUpload() {
|
||||
return this.uploads;
|
||||
}
|
||||
|
||||
private String[] getUploadContentTypes() {
|
||||
return this.uploadedFiles.stream()
|
||||
.map(UploadedFile::getContentType)
|
||||
.toArray(String[]::new);
|
||||
}
|
||||
public void setUpload(File[] upload) {
|
||||
this.uploads = upload;
|
||||
}
|
||||
|
||||
public String[] getUploadFileName() {
|
||||
return this.uploadFileNames;
|
||||
}
|
||||
|
||||
public void setUploadFileName(String[] uploadFileName) {
|
||||
this.uploadFileNames = uploadFileName;
|
||||
}
|
||||
|
||||
public String[] getUploadContentType() {
|
||||
return this.uploadContentTypes;
|
||||
}
|
||||
|
||||
public void setUploadContentType(String[] uploadContentType) {
|
||||
this.uploadContentTypes = uploadContentType;
|
||||
}
|
||||
}
|
||||
// END SNIPPET: entire-file
|
||||
+48
-40
@@ -22,56 +22,64 @@
|
||||
package org.apache.struts2.showcase.fileupload;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.action.UploadedFilesAware;
|
||||
import org.apache.struts2.dispatcher.multipart.UploadedFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Showcase action - multiple file upload using List
|
||||
*
|
||||
* @version $Date$ $Id$
|
||||
*/
|
||||
public class MultipleFileUploadUsingListAction extends ActionSupport implements UploadedFilesAware {
|
||||
public class MultipleFileUploadUsingListAction extends ActionSupport {
|
||||
|
||||
private List<UploadedFile> uploads = new ArrayList<>();
|
||||
private List<File> uploads = new ArrayList<>();
|
||||
private List<String> uploadFileNames = new ArrayList<>();
|
||||
private List<String> uploadContentTypes = new ArrayList<>();
|
||||
|
||||
public List<UploadedFile> getUpload() {
|
||||
return this.uploads;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withUploadedFiles(List<UploadedFile> uploads) {
|
||||
this.uploads = uploads;
|
||||
}
|
||||
public List<File> getUpload() {
|
||||
return this.uploads;
|
||||
}
|
||||
|
||||
private List<String> getUploadFileNames() {
|
||||
return this.uploads.stream()
|
||||
.map(UploadedFile::getOriginalName)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
public void setUpload(List<File> uploads) {
|
||||
this.uploads = uploads;
|
||||
}
|
||||
|
||||
private List<String> getUploadContentTypes() {
|
||||
return this.uploads.stream()
|
||||
.map(UploadedFile::getContentType)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
public List<String> getUploadFileName() {
|
||||
return this.uploadFileNames;
|
||||
}
|
||||
|
||||
public String upload() throws Exception {
|
||||
System.out.println("\n\n upload1");
|
||||
System.out.println("files:");
|
||||
for (UploadedFile u : uploads) {
|
||||
System.out.println("*** " + u + "\t" + u.length());
|
||||
}
|
||||
System.out.println("filenames:");
|
||||
for (String n : getUploadFileNames()) {
|
||||
System.out.println("*** " + n);
|
||||
}
|
||||
System.out.println("content types:");
|
||||
for (String c : getUploadContentTypes()) {
|
||||
System.out.println("*** " + c);
|
||||
}
|
||||
System.out.println("\n\n");
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
public void setUploadFileName(List<String> uploadFileNames) {
|
||||
this.uploadFileNames = uploadFileNames;
|
||||
}
|
||||
|
||||
public List<String> getUploadContentType() {
|
||||
return this.uploadContentTypes;
|
||||
}
|
||||
|
||||
public void setUploadContentType(List<String> contentTypes) {
|
||||
this.uploadContentTypes = contentTypes;
|
||||
}
|
||||
|
||||
public String upload() throws Exception {
|
||||
|
||||
System.out.println("\n\n upload1");
|
||||
System.out.println("files:");
|
||||
for (File u : uploads) {
|
||||
System.out.println("*** " + u + "\t" + u.length());
|
||||
}
|
||||
System.out.println("filenames:");
|
||||
for (String n : uploadFileNames) {
|
||||
System.out.println("*** " + n);
|
||||
}
|
||||
System.out.println("content types:");
|
||||
for (String c : uploadContentTypes) {
|
||||
System.out.println("*** " + c);
|
||||
}
|
||||
System.out.println("\n\n");
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
// END SNIPPET: entire-file
|
||||
+6
-8
@@ -21,16 +21,15 @@
|
||||
package org.apache.struts2.showcase.hangman;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.interceptor.SessionAware;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.struts2.action.SessionAware;
|
||||
|
||||
public class GetUpdatedHangmanAction extends ActionSupport implements SessionAware {
|
||||
|
||||
private static final long serialVersionUID = 5506025785406043027L;
|
||||
|
||||
private Map<String, Object> session;
|
||||
private Map session;
|
||||
private Hangman hangman;
|
||||
|
||||
|
||||
@@ -46,6 +45,10 @@ public class GetUpdatedHangmanAction extends ActionSupport implements SessionAwa
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
public void setSession(Map session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
public Hangman getHangman() {
|
||||
return hangman;
|
||||
}
|
||||
@@ -53,9 +56,4 @@ public class GetUpdatedHangmanAction extends ActionSupport implements SessionAwa
|
||||
public void setHangman(Hangman hangman) {
|
||||
this.hangman = hangman;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withSession(Map<String, Object> session) {
|
||||
this.session = session;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-8
@@ -21,16 +21,15 @@
|
||||
package org.apache.struts2.showcase.hangman;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.interceptor.SessionAware;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.struts2.action.SessionAware;
|
||||
|
||||
public class GuessCharacterAction extends ActionSupport implements SessionAware {
|
||||
|
||||
private static final long serialVersionUID = 9050915577007590674L;
|
||||
|
||||
private Map<String, Object> session;
|
||||
private Map session;
|
||||
private Character character;
|
||||
private Hangman hangman;
|
||||
|
||||
@@ -45,6 +44,10 @@ public class GuessCharacterAction extends ActionSupport implements SessionAware
|
||||
return hangman;
|
||||
}
|
||||
|
||||
public void setSession(Map session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
public void setCharacter(Character character) {
|
||||
this.character = character;
|
||||
}
|
||||
@@ -52,9 +55,4 @@ public class GuessCharacterAction extends ActionSupport implements SessionAware
|
||||
public Character getCharacter() {
|
||||
return this.character;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withSession(Map<String, Object> session) {
|
||||
this.session = session;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-7
@@ -21,11 +21,10 @@
|
||||
package org.apache.struts2.showcase.hangman;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.interceptor.SessionAware;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.struts2.action.SessionAware;
|
||||
|
||||
import static org.apache.struts2.showcase.hangman.HangmanConstants.HANGMAN_SESSION_KEY;
|
||||
|
||||
public class StartHangmanAction extends ActionSupport implements SessionAware {
|
||||
@@ -34,7 +33,7 @@ public class StartHangmanAction extends ActionSupport implements SessionAware {
|
||||
|
||||
private HangmanService service;
|
||||
private Hangman hangman;
|
||||
private Map<String, Object> session;
|
||||
private Map session;
|
||||
|
||||
|
||||
public StartHangmanAction(HangmanService service) {
|
||||
@@ -54,8 +53,8 @@ public class StartHangmanAction extends ActionSupport implements SessionAware {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void withSession(Map<String, Object> session) {
|
||||
this.session = session;
|
||||
}
|
||||
// === SessionAware ===
|
||||
public void setSession(Map session) {
|
||||
this.session = session;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
package org.apache.struts2.showcase.model;
|
||||
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
+164
-159
@@ -22,13 +22,15 @@ package org.apache.struts2.showcase.source;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import com.opensymphony.xwork2.util.ClassLoaderUtil;
|
||||
import org.apache.struts2.action.ServletContextAware;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.util.ServletContextAware;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -39,192 +41,195 @@ import java.util.List;
|
||||
*/
|
||||
public class ViewSourceAction extends ActionSupport implements ServletContextAware {
|
||||
|
||||
private String page;
|
||||
private String className;
|
||||
private String config;
|
||||
private String page;
|
||||
private String className;
|
||||
private String config;
|
||||
|
||||
private List<String> pageLines;
|
||||
private List<String> classLines;
|
||||
private List<String> configLines;
|
||||
private List pageLines;
|
||||
private List classLines;
|
||||
private List configLines;
|
||||
|
||||
private int configLine;
|
||||
private int padding = 10;
|
||||
private int configLine;
|
||||
private int padding = 10;
|
||||
|
||||
private ServletContext servletContext;
|
||||
private ServletContext servletContext;
|
||||
|
||||
public String execute() throws IOException {
|
||||
public String execute() throws MalformedURLException, IOException {
|
||||
|
||||
if (page != null) {
|
||||
if (page != null) {
|
||||
|
||||
InputStream in = ClassLoaderUtil.getResourceAsStream(page.substring(page.indexOf("//") + 1), getClass());
|
||||
page = page.replace("//", "/");
|
||||
InputStream in = ClassLoaderUtil.getResourceAsStream(page.substring(page.indexOf("//") + 1), getClass());
|
||||
page = page.replace("//", "/");
|
||||
|
||||
if (in == null) {
|
||||
in = servletContext.getResourceAsStream(page);
|
||||
while (in == null && page.indexOf('/', 1) > 0) {
|
||||
page = page.substring(page.indexOf('/', 1));
|
||||
in = servletContext.getResourceAsStream(page);
|
||||
}
|
||||
}
|
||||
pageLines = read(in, -1);
|
||||
if (in == null) {
|
||||
in = servletContext.getResourceAsStream(page);
|
||||
while (in == null && page.indexOf('/', 1) > 0) {
|
||||
page = page.substring(page.indexOf('/', 1));
|
||||
in = servletContext.getResourceAsStream(page);
|
||||
}
|
||||
}
|
||||
pageLines = read(in, -1);
|
||||
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
if (className != null) {
|
||||
className = "/" + className.replace('.', '/') + ".java";
|
||||
InputStream in = getClass().getResourceAsStream(className);
|
||||
if (in == null) {
|
||||
in = servletContext.getResourceAsStream("/WEB-INF/src/java" + className);
|
||||
}
|
||||
classLines = read(in, -1);
|
||||
if (className != null) {
|
||||
className = "/" + className.replace('.', '/') + ".java";
|
||||
InputStream in = getClass().getResourceAsStream(className);
|
||||
if (in == null) {
|
||||
in = servletContext.getResourceAsStream("/WEB-INF/src" + className);
|
||||
}
|
||||
classLines = read(in, -1);
|
||||
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
if (config != null && config.startsWith("file:/")) {
|
||||
int pos = config.lastIndexOf(':');
|
||||
configLine = Integer.parseInt(config.substring(pos + 1));
|
||||
configLines = read(new URL(config.substring(0, pos)).openStream(), configLine);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
String rootPath = ServletActionContext.getServletContext().getRealPath("/");
|
||||
|
||||
if (config != null && (rootPath == null || config.startsWith(rootPath))) {
|
||||
int pos = config.lastIndexOf(':');
|
||||
configLine = Integer.parseInt(config.substring(pos + 1));
|
||||
config = config.substring(0, pos).replace("//", "/");
|
||||
configLines = read(new URL(config).openStream(), configLine);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param className the className to set
|
||||
*/
|
||||
public void setClassName(String className) {
|
||||
if (className != null && className.trim().length() > 0) {
|
||||
this.className = className;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param className the className to set
|
||||
*/
|
||||
public void setClassName(String className) {
|
||||
if (className != null && className.trim().length() > 0) {
|
||||
this.className = className;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param config the config to set
|
||||
*/
|
||||
public void setConfig(String config) {
|
||||
if (config != null && config.trim().length() > 0) {
|
||||
this.config = config;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param config the config to set
|
||||
*/
|
||||
public void setConfig(String config) {
|
||||
if (config != null && config.trim().length() > 0) {
|
||||
this.config = config;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param page the page to set
|
||||
*/
|
||||
public void setPage(String page) {
|
||||
if (page != null && page.trim().length() > 0) {
|
||||
this.page = page;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param page the page to set
|
||||
*/
|
||||
public void setPage(String page) {
|
||||
if (page != null && page.trim().length() > 0) {
|
||||
this.page = page;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param padding the padding to set
|
||||
*/
|
||||
public void setPadding(int padding) {
|
||||
this.padding = padding;
|
||||
}
|
||||
/**
|
||||
* @param padding the padding to set
|
||||
*/
|
||||
public void setPadding(int padding) {
|
||||
this.padding = padding;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the classLines
|
||||
*/
|
||||
public List<String> getClassLines() {
|
||||
return classLines;
|
||||
}
|
||||
/**
|
||||
* @return the classLines
|
||||
*/
|
||||
public List getClassLines() {
|
||||
return classLines;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the configLines
|
||||
*/
|
||||
public List<String> getConfigLines() {
|
||||
return configLines;
|
||||
}
|
||||
/**
|
||||
* @return the configLines
|
||||
*/
|
||||
public List getConfigLines() {
|
||||
return configLines;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the pageLines
|
||||
*/
|
||||
public List<String> getPageLines() {
|
||||
return pageLines;
|
||||
}
|
||||
/**
|
||||
* @return the pageLines
|
||||
*/
|
||||
public List getPageLines() {
|
||||
return pageLines;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the className
|
||||
*/
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
/**
|
||||
* @return the className
|
||||
*/
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the config
|
||||
*/
|
||||
public String getConfig() {
|
||||
return config;
|
||||
}
|
||||
/**
|
||||
* @return the config
|
||||
*/
|
||||
public String getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the page
|
||||
*/
|
||||
public String getPage() {
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* @return the page
|
||||
*/
|
||||
public String getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the configLine
|
||||
*/
|
||||
public int getConfigLine() {
|
||||
return configLine;
|
||||
}
|
||||
/**
|
||||
* @return the configLine
|
||||
*/
|
||||
public int getConfigLine() {
|
||||
return configLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the padding
|
||||
*/
|
||||
public int getPadding() {
|
||||
return padding;
|
||||
}
|
||||
/**
|
||||
* @return the padding
|
||||
*/
|
||||
public int getPadding() {
|
||||
return padding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads in a stream, optionally only including the target line number
|
||||
* and its padding
|
||||
*
|
||||
* @param in The input stream
|
||||
* @param targetLineNumber The target line number, negative to read all
|
||||
* @return A list of lines
|
||||
*/
|
||||
private List<String> read(InputStream in, int targetLineNumber) {
|
||||
List<String> snippet = null;
|
||||
if (in != null) {
|
||||
snippet = new ArrayList<>();
|
||||
int startLine = 0;
|
||||
int endLine = Integer.MAX_VALUE;
|
||||
if (targetLineNumber > 0) {
|
||||
startLine = targetLineNumber - padding;
|
||||
endLine = targetLineNumber + padding;
|
||||
}
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
|
||||
/**
|
||||
* Reads in a strea, optionally only including the target line number
|
||||
* and its padding
|
||||
*
|
||||
* @param in The input stream
|
||||
* @param targetLineNumber The target line number, negative to read all
|
||||
* @return A list of lines
|
||||
*/
|
||||
private List read(InputStream in, int targetLineNumber) {
|
||||
List snippet = null;
|
||||
if (in != null) {
|
||||
snippet = new ArrayList();
|
||||
int startLine = 0;
|
||||
int endLine = Integer.MAX_VALUE;
|
||||
if (targetLineNumber > 0) {
|
||||
startLine = targetLineNumber - padding;
|
||||
endLine = targetLineNumber + padding;
|
||||
}
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
|
||||
|
||||
int lineno = 0;
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
lineno++;
|
||||
if (lineno >= startLine && lineno <= endLine) {
|
||||
snippet.add(line);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
// ignoring as snippet not available isn't a big deal
|
||||
}
|
||||
}
|
||||
return snippet;
|
||||
}
|
||||
int lineno = 0;
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
lineno++;
|
||||
if (lineno >= startLine && lineno <= endLine) {
|
||||
snippet.add(line);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
// ignoring as snippet not available isn't a big deal
|
||||
}
|
||||
}
|
||||
return snippet;
|
||||
}
|
||||
|
||||
public void withServletContext(ServletContext arg0) {
|
||||
this.servletContext = arg0;
|
||||
}
|
||||
public void setServletContext(ServletContext arg0) {
|
||||
this.servletContext = arg0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+16
-14
@@ -27,24 +27,22 @@ import org.apache.struts2.convention.annotation.Namespace;
|
||||
import org.apache.struts2.convention.annotation.ParentPackage;
|
||||
import org.apache.struts2.convention.annotation.Result;
|
||||
import org.apache.struts2.interceptor.validation.SkipValidation;
|
||||
import org.hibernate.validator.constraints.Email;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
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 javax.validation.constraints.*;
|
||||
import java.util.Date;
|
||||
|
||||
// <!-- START SNIPPET: beanValidationExample -->
|
||||
/**
|
||||
* <!-- START SNIPPET: beanValidatationExample -->
|
||||
*/
|
||||
@Namespace("/bean-validation")
|
||||
@ParentPackage("bean-validation")
|
||||
@Action(results = {
|
||||
@Result(name = "input", location = "bean-validation.jsp"),
|
||||
@Result(name = "success", location = "/WEB-INF/validation/successFieldValidatorsExample.jsp")
|
||||
@Result(name = "input", location = "bean-validation.jsp"),
|
||||
@Result(name = "success", location = "/WEB-INF/validation/successFieldValidatorsExample.jsp")
|
||||
})
|
||||
@FieldMatch(first = "fieldExpressionValidatorField", second = "requiredValidatorField", message = "requiredValidatorField and fieldExpressionValidatorField are not matching")
|
||||
@ScriptAssert(lang = "javascript", script = "_this.dateValidatorField != null && _this.dateValidatorField.before(new java.util.Date())", message = "Date need to before now")
|
||||
@@ -84,10 +82,10 @@ public class BeanValidationExampleAction extends ActionSupport {
|
||||
private String fieldExpressionValidatorField = null;
|
||||
|
||||
@Action(value = "bean-validation", results = {
|
||||
@Result(name = "success", location = "bean-validation.jsp")
|
||||
@Result(name = "success", location = "bean-validation.jsp")
|
||||
})
|
||||
@SkipValidation
|
||||
public String beanValidation() {
|
||||
public String beanValidation(){
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -152,7 +150,7 @@ public class BeanValidationExampleAction extends ActionSupport {
|
||||
}
|
||||
|
||||
public void setFieldExpressionValidatorField(
|
||||
String fieldExpressionValidatorField) {
|
||||
String fieldExpressionValidatorField) {
|
||||
this.fieldExpressionValidatorField = fieldExpressionValidatorField;
|
||||
}
|
||||
|
||||
@@ -165,4 +163,8 @@ public class BeanValidationExampleAction extends ActionSupport {
|
||||
}
|
||||
}
|
||||
|
||||
// <!-- END SNIPPET: beanValidationExample -->
|
||||
/**
|
||||
* <!-- END SNIPPET: beanValidatationExample -->
|
||||
*/
|
||||
|
||||
|
||||
|
||||
-11
@@ -20,8 +20,6 @@
|
||||
*/
|
||||
package org.apache.struts2.showcase.validation;
|
||||
|
||||
import org.apache.struts2.interceptor.parameter.StrutsParameter;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
/**
|
||||
@@ -46,7 +44,6 @@ public class FieldValidatorsExampleAction extends AbstractValidationActionSuppor
|
||||
return dateValidatorField;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setDateValidatorField(Date dateValidatorField) {
|
||||
this.dateValidatorField = dateValidatorField;
|
||||
}
|
||||
@@ -55,7 +52,6 @@ public class FieldValidatorsExampleAction extends AbstractValidationActionSuppor
|
||||
return emailValidatorField;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setEmailValidatorField(String emailValidatorField) {
|
||||
this.emailValidatorField = emailValidatorField;
|
||||
}
|
||||
@@ -64,7 +60,6 @@ public class FieldValidatorsExampleAction extends AbstractValidationActionSuppor
|
||||
return integerValidatorField;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setIntegerValidatorField(Integer integerValidatorField) {
|
||||
this.integerValidatorField = integerValidatorField;
|
||||
}
|
||||
@@ -73,7 +68,6 @@ public class FieldValidatorsExampleAction extends AbstractValidationActionSuppor
|
||||
return regexValidatorField;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setRegexValidatorField(String regexValidatorField) {
|
||||
this.regexValidatorField = regexValidatorField;
|
||||
}
|
||||
@@ -82,7 +76,6 @@ public class FieldValidatorsExampleAction extends AbstractValidationActionSuppor
|
||||
return requiredStringValidatorField;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setRequiredStringValidatorField(String requiredStringValidatorField) {
|
||||
this.requiredStringValidatorField = requiredStringValidatorField;
|
||||
}
|
||||
@@ -91,7 +84,6 @@ public class FieldValidatorsExampleAction extends AbstractValidationActionSuppor
|
||||
return requiredValidatorField;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setRequiredValidatorField(String requiredValidatorField) {
|
||||
this.requiredValidatorField = requiredValidatorField;
|
||||
}
|
||||
@@ -100,7 +92,6 @@ public class FieldValidatorsExampleAction extends AbstractValidationActionSuppor
|
||||
return stringLengthValidatorField;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setStringLengthValidatorField(String stringLengthValidatorField) {
|
||||
this.stringLengthValidatorField = stringLengthValidatorField;
|
||||
}
|
||||
@@ -109,7 +100,6 @@ public class FieldValidatorsExampleAction extends AbstractValidationActionSuppor
|
||||
return fieldExpressionValidatorField;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setFieldExpressionValidatorField(
|
||||
String fieldExpressionValidatorField) {
|
||||
this.fieldExpressionValidatorField = fieldExpressionValidatorField;
|
||||
@@ -119,7 +109,6 @@ public class FieldValidatorsExampleAction extends AbstractValidationActionSuppor
|
||||
return urlValidatorField;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setUrlValidatorField(String urlValidatorField) {
|
||||
this.urlValidatorField = urlValidatorField;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
package org.apache.struts2.showcase.wait;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.interceptor.parameter.StrutsParameter;
|
||||
|
||||
/**
|
||||
* Example to illustrate the <code>execAndWait</code> interceptor.
|
||||
@@ -42,7 +41,6 @@ public class LongProcessAction extends ActionSupport {
|
||||
return time;
|
||||
}
|
||||
|
||||
@StrutsParameter
|
||||
public void setTime(int time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.showcase.wait;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.struts2.interceptor.exec.ExecutorProvider;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ThreadPoolExecutorProvider implements ExecutorProvider {
|
||||
|
||||
private static final Logger LOG = LogManager.getLogger(ThreadPoolExecutorProvider.class);
|
||||
|
||||
private final ExecutorService executor;
|
||||
|
||||
public ThreadPoolExecutorProvider() {
|
||||
this.executor = new ThreadPoolExecutor(1, 2, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingDeque<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Runnable task) {
|
||||
LOG.info("Executing task: {}", task);
|
||||
executor.execute(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShutdown() {
|
||||
return executor.isShutdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
LOG.info("Shutting down executor");
|
||||
executor.shutdown();
|
||||
}
|
||||
}
|
||||
@@ -21,11 +21,9 @@
|
||||
package org.apache.struts2.showcase.xslt;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.struts2.interceptor.ServletRequestAware;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.struts2.action.ServletRequestAware;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
@@ -55,6 +53,10 @@ public class JVMAction implements ServletRequestAware {
|
||||
return servletRequest;
|
||||
}
|
||||
|
||||
public void setServletRequest(HttpServletRequest servletRequest) {
|
||||
this.servletRequest = servletRequest;
|
||||
}
|
||||
|
||||
public Map<String, String> getEnvironment() {
|
||||
return environment;
|
||||
}
|
||||
@@ -98,9 +100,4 @@ public class JVMAction implements ServletRequestAware {
|
||||
this.systemProperties = systemProperties;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withServletRequest(HttpServletRequest request) {
|
||||
this.servletRequest = request;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,14 +22,15 @@
|
||||
<Configuration>
|
||||
<Appenders>
|
||||
<Console name="STDOUT" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="[%-5p] %C{2} (%F:%L) - %m%n"/>
|
||||
<PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Logger name="com.opensymphony.xwork2" level="info"/>
|
||||
<Logger name="org.apache.struts2" level="info"/>
|
||||
<Logger name="org.springframework" level="info"/>
|
||||
<Root level="info">
|
||||
<AppenderRef ref="STDOUT"/>
|
||||
</Root>
|
||||
<Logger name="org.apache.struts2" level="info"/>
|
||||
<Logger name="com.opensymphony.xwork2" level="info"/>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
</Configuration>
|
||||
+7
-7
@@ -21,31 +21,31 @@
|
||||
-->
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//Apache Struts//XWork Validator 1.0.2//EN"
|
||||
"https://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="description1">
|
||||
<field-validator type="requiredstring">
|
||||
<message>Description1 Is Required !!!</message>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
|
||||
<field name="description2">
|
||||
<field-validator type="requiredstring">
|
||||
<message>Description2 Is Required !!!</message>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
|
||||
<field name="description3">
|
||||
<field-validator type="requiredstring">
|
||||
<message>Description3 Is Required !!!</message>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
|
||||
<field name="description4">
|
||||
<field-validator type="requiredstring">
|
||||
<message>Description4 Is Required !!!</message>
|
||||
</field-validator>
|
||||
</field>
|
||||
</validators>
|
||||
|
||||
</validators>
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0//EN" "https://struts.apache.org/dtds/xwork-validator-1.0.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.dtd">
|
||||
<validators>
|
||||
<!-- Field-Validator Syntax -->
|
||||
<field name="currentEmployee.empId">
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0//EN" "https://struts.apache.org/dtds/xwork-validator-1.0.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.dtd">
|
||||
<validators>
|
||||
<!-- Field-Validator Syntax -->
|
||||
<field name="currentSkill.name">
|
||||
|
||||
+3
-2
@@ -21,7 +21,7 @@
|
||||
-->
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//Apache Struts//XWork Validator 1.0.2//EN"
|
||||
"https://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="upload">
|
||||
@@ -35,4 +35,5 @@
|
||||
<message>Caption cannot be empty</message>
|
||||
</field-validator>
|
||||
</field>
|
||||
</validators>
|
||||
</validators>
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0//EN" "https://struts.apache.org/dtds/xwork-validator-1.0.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.dtd">
|
||||
<validators>
|
||||
<field name="person">
|
||||
<field-validator type="visitor">
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0//EN" "https://struts.apache.org/dtds/xwork-validator-1.0.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.dtd">
|
||||
<validators>
|
||||
<field name="name">
|
||||
<field-validator type="requiredstring">
|
||||
|
||||
+6
-6
@@ -21,8 +21,8 @@
|
||||
-->
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//Apache Struts//XWork Validator 1.0.2//EN"
|
||||
"https://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="value">
|
||||
<field-validator type="requiredstring">
|
||||
@@ -30,13 +30,13 @@
|
||||
<message>Value must not be empty</message>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="count">
|
||||
<field-validator type="int">
|
||||
<message>Count must be an integer</message>
|
||||
</field-validator>
|
||||
</field-validator>
|
||||
</field>
|
||||
</validators>
|
||||
</validators>
|
||||
|
||||
|
||||
|
||||
+4
-4
@@ -21,10 +21,10 @@
|
||||
-->
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//Apache Struts//XWork Validator 1.0//EN"
|
||||
"https://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<!-- START SNIPPET: fieldValidatorsExample -->
|
||||
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<!-- START SNIPPET: fieldValidatorsExample -->
|
||||
|
||||
<validators>
|
||||
<field name="requiredValidatorField">
|
||||
<field-validator type="required">
|
||||
|
||||
+6
-6
@@ -19,12 +19,12 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE validators PUBLIC
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//Apache Struts//XWork Validator 1.0//EN"
|
||||
"https://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<!-- START SNIPPET: fieldValidatorsExample -->
|
||||
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<!-- START SNIPPET: fieldValidatorsExample -->
|
||||
|
||||
<validators>
|
||||
<field name="requiredValidatorField">
|
||||
<field-validator type="required">
|
||||
@@ -71,7 +71,7 @@
|
||||
</field>
|
||||
<field name="regexValidatorField">
|
||||
<field-validator type="regex">
|
||||
<param name="regex"><![CDATA[ .*\.txt ]]></param>
|
||||
<param name="regex"><![CDATA[ [^<>]+ ]]></param>
|
||||
<message><![CDATA[ regexValidatorField must match a regexp (.*\.txt) if specified ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
+6
-6
@@ -19,13 +19,13 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE validators PUBLIC
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//Apache Struts//XWork Validator 1.0//EN"
|
||||
"https://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
|
||||
<!-- START SNIPPET: nonFieldValidatorsExample -->
|
||||
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
|
||||
<!-- START SNIPPET: nonFieldValidatorsExample -->
|
||||
|
||||
<validators>
|
||||
<validator type="expression">
|
||||
<param name="expression"><![CDATA[ ( (someText == someTextRetype) && (someTextRetype == someTextRetypeAgain) ) ]]></param>
|
||||
|
||||
+2
-2
@@ -19,11 +19,11 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "https://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
<!-- START SNIPPET: quizValidators -->
|
||||
<!--
|
||||
Add the following DOCTYPE declaration as first line of your XXX-validation.xml file:
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "https://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
-->
|
||||
<validators>
|
||||
<field name="name">
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
-->
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//Apache Struts//XWork Validator 1.0//EN"
|
||||
"https://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="name">
|
||||
|
||||
+5
-5
@@ -19,17 +19,17 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE validators PUBLIC
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//Apache Struts//XWork Validator 1.0//EN"
|
||||
"https://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="name">
|
||||
<field-validator type="requiredstring">
|
||||
<message>Name Required</message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="age">
|
||||
<field name="age">
|
||||
<field-validator type="int">
|
||||
<param name="min">1</param>
|
||||
<param name="max">100</param>
|
||||
@@ -41,6 +41,6 @@
|
||||
<message>Birthday Required</message>
|
||||
</field-validator>
|
||||
</field>
|
||||
</validators>
|
||||
</validators>
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -19,10 +19,10 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE validators PUBLIC
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//Apache Struts//XWork Validator 1.0//EN"
|
||||
"https://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<!-- START SNIPPET: visitorValidatorsExample -->
|
||||
|
||||
<validators>
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="actionchaining" extends="struts-default" namespace="/actionchaining">
|
||||
<action name="actionChain1" class="org.apache.struts2.showcase.actionchaining.ActionChain1">
|
||||
<result type="chain">actionChain2</result>
|
||||
<result type="chain">actionChain2</result>
|
||||
</action>
|
||||
<action name="actionChain2" class="org.apache.struts2.showcase.actionchaining.ActionChain2">
|
||||
<result type="chain">actionChain3</result>
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!--
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="async" extends="json-default" namespace="/async">
|
||||
|
||||
<action name="receiveNewMessages" class="org.apache.struts2.showcase.async.ChatRoomAction" method="receiveNewMessages">
|
||||
<result name="success" type="json">
|
||||
<param name="root">newMessages</param>
|
||||
</result>
|
||||
<result name="timeout" type="json">
|
||||
<param name="root">newMessages</param>
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="sendMessage" class="org.apache.struts2.showcase.async.ChatRoomAction" method="sendMessage">
|
||||
<result name="success" type="json">
|
||||
<param name="root">newMessages</param>
|
||||
</result>
|
||||
<result name="timeout" type="json">
|
||||
<param name="root">newMessages</param>
|
||||
</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
|
||||
</struts>
|
||||
@@ -20,16 +20,16 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="conversion" namespace="/conversion" extends="struts-default">
|
||||
|
||||
|
||||
<action name="index">
|
||||
<result>/WEB-INF/conversion/index.jsp</result>
|
||||
</action>
|
||||
|
||||
|
||||
<!-- Example populating a List inside an Action -->
|
||||
<action name="enterPersonsInfo" method="input"
|
||||
class="org.apache.struts2.showcase.conversion.PersonAction">
|
||||
@@ -49,8 +49,8 @@
|
||||
<action name="showPersonJavaCode">
|
||||
<result type="plainText">/WEB-INF/conversion/Person.java.txt</result>
|
||||
</action>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Example populating a Set inside an Action -->
|
||||
<action name="enterAddressesInfo" class="org.apache.struts2.showcase.conversion.AddressAction" method="input">
|
||||
<result>/WEB-INF/conversion/enterAddressInfo.jsp</result>
|
||||
@@ -68,9 +68,9 @@
|
||||
<action name="showAddressJavaCode">
|
||||
<result type="plainText">/WEB-INF/conversion/Address.java.txt</result>
|
||||
</action>
|
||||
|
||||
|
||||
<!-- Example populating a List with Tiger 5 Enum -->
|
||||
|
||||
|
||||
<!-- Example populating a List with Tiger 5 Enum -->
|
||||
<action name="enterOperationEnumInfo" class="org.apache.struts2.showcase.conversion.OperationsEnumAction" method="input">
|
||||
<result>/WEB-INF/conversion/enterOperations.jsp</result>
|
||||
</action>
|
||||
@@ -93,6 +93,6 @@
|
||||
<action name="showOperationsEnumActionConversionProperties">
|
||||
<result type="plainText">/WEB-INF/conversion/OperationsEnumActionConversion.txt</result>
|
||||
</action>
|
||||
|
||||
|
||||
</package>
|
||||
</struts>
|
||||
</struts>
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!--
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="dispatcher" extends="struts-default" namespace="/dispatcher">
|
||||
|
||||
<action name="dispatch">
|
||||
<result type="dispatcher">
|
||||
/WEB-INF/dispatcher/dispatch-result.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="forward">
|
||||
<result type="dispatcher">/dispatcher/dispatch.action</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
</struts>
|
||||
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="filedownload" extends="struts-default" namespace="/filedownload">
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="fileupload" extends="struts-default" namespace="/fileupload">
|
||||
|
||||
|
||||
<action name="upload" class="org.apache.struts2.showcase.fileupload.FileUploadAction" method="input">
|
||||
<result>/WEB-INF/fileupload/upload.jsp</result>
|
||||
</action>
|
||||
@@ -34,11 +34,11 @@
|
||||
<result name="input">/WEB-INF/fileupload/upload.jsp</result>
|
||||
<result>/WEB-INF/fileupload/upload-success.jsp</result>
|
||||
</action>
|
||||
|
||||
|
||||
<action name="multipleUploadUsingList">
|
||||
<result>/WEB-INF/fileupload/multipleUploadUsingList.jsp</result>
|
||||
</action>
|
||||
|
||||
|
||||
<action name="doMultipleUploadUsingList" class="org.apache.struts2.showcase.fileupload.MultipleFileUploadUsingListAction" method="upload">
|
||||
<result name="input">/WEB-INF/fileupload/multipleUploadUsingList.jsp</result>
|
||||
<result>/WEB-INF/fileupload/multiple-success.jsp</result>
|
||||
|
||||
@@ -20,17 +20,17 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="freemarker" namespace="/freemarker" extends="struts-default">
|
||||
<action name="customFreemarkerManagerDemo">
|
||||
<result type="freemarker">/WEB-INF/freemarker/customFreemarkerManagerUsage.ftl</result>
|
||||
</action>
|
||||
|
||||
|
||||
<action name="standardTags" class="org.apache.struts2.showcase.freemarker.StandardTagsAction">
|
||||
<result type="freemarker">/WEB-INF/freemarker/standardTags.ftl</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
</struts>
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="hangman" extends="struts-default" namespace="/hangman">
|
||||
@@ -41,9 +41,9 @@
|
||||
<result type="freemarker">/WEB-INF/hangman/hangmanNonAjax.ftl</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<package name="hangman-ajax" extends="struts-default" namespace="/hangman/ajax">
|
||||
<action name="blank">
|
||||
<result type="freemarker">/WEB-INF/hangman/blank.ftl</result>
|
||||
@@ -61,4 +61,4 @@
|
||||
<result type="freemarker">/WEB-INF/hangman/updateGuessLeft.ftl</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
</struts>
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="interactive" namespace="/interactive" extends="struts-default">
|
||||
@@ -38,4 +38,4 @@
|
||||
</action>
|
||||
<action name="example" class="org.apache.struts2.showcase.action.ExampleAction" />
|
||||
</package>
|
||||
</struts>
|
||||
</struts>
|
||||
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="modelDriven" extends="struts-default" namespace="/modelDriven">
|
||||
@@ -29,10 +29,11 @@
|
||||
<action name="modelDriven" class="org.apache.struts2.showcase.modelDriven.ModelDrivenAction" method="input">
|
||||
<result>/WEB-INF/modelDriven/modelDriven.jsp</result>
|
||||
</action>
|
||||
|
||||
|
||||
<!-- Display the result page whose content is populated using the Model-Driven technique -->
|
||||
<action name="modelDrivenResult" class="org.apache.struts2.showcase.modelDriven.ModelDrivenAction">
|
||||
<result>/WEB-INF/modelDriven/modelDrivenResult.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
</struts>
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!--
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="params-annotation" extends="velocity-default" namespace="/paramsannotation">
|
||||
<action name="test" class="org.apache.struts2.showcase.action.ParamsAnnotationAction">
|
||||
<result type="velocity">/WEB-INF/paramsannotation.vm</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<!-- START SNIPPET: xworkSample -->
|
||||
|
||||
|
||||
@@ -20,15 +20,15 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
|
||||
|
||||
<!-- ================================== -->
|
||||
<!-- === Package for ActionTag Demo === -->
|
||||
<!-- ================================== -->
|
||||
|
||||
|
||||
<package name="actionTag" extends="struts-default" namespace="/tags/non-ui/actionTag">
|
||||
<action name="showActionTagDemo" class="org.apache.struts2.showcase.tag.nonui.actiontag.ActionTagDemo" method="show">
|
||||
<result>/WEB-INF/tags/non-ui/actionTag/showActionTagDemo.jsp</result>
|
||||
@@ -46,11 +46,11 @@
|
||||
<result type="plainText">/WEB-INF/tags/non-ui/actionTag/showActionTagDemo.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
|
||||
<!-- ==================================== -->
|
||||
<!-- === Package for IteratorGeneratorTag Demo === -->
|
||||
<!-- ==================================== -->
|
||||
|
||||
|
||||
<package name="iteratorGeneratorTag" extends="struts-default" namespace="/tags/non-ui/iteratorGeneratorTag">
|
||||
<action name="showGeneratorTagDemo" class="org.apache.struts2.showcase.tag.nonui.iteratortag.IteratorGeneratorTagDemo" method="input">
|
||||
<result>/WEB-INF/tags/non-ui/iteratorTag/showIteratorGeneratorTagDemo.jsp</result>
|
||||
@@ -60,8 +60,8 @@
|
||||
<result>/WEB-INF/tags/non-ui/iteratorTag/iteratorGeneratorTagDemoResult.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ===================================== -->
|
||||
<!-- === Package for AppendIteratorTag Demo === -->
|
||||
<!-- ========================================== -->
|
||||
@@ -74,8 +74,8 @@
|
||||
<result>/WEB-INF/tags/non-ui/iteratorTag/appendIteratorTagDemoResult.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ====================================== -->
|
||||
<!-- === Package for MergeIteratorTag Demo === -->
|
||||
<!-- ========================================= -->
|
||||
@@ -88,7 +88,7 @@
|
||||
<result>/WEB-INF/tags/non-ui/iteratorTag/mergeIteratorTagDemoResult.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
|
||||
<!-- ============================================= -->
|
||||
<!-- === Package for SubsetIteratorTag Demo === -->
|
||||
<!-- =========================================== -->
|
||||
@@ -101,14 +101,14 @@
|
||||
<result>/WEB-INF/tags/non-ui/iteratorTag/subsetIteratorTagDemoResult.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
|
||||
<!-- ========================================= -->
|
||||
<!-- === Package for Action Prefix Example === -->
|
||||
<!-- ========================================= -->
|
||||
<package name="actionPrefix" extends="struts-default" namespace="/tags/non-ui/actionPrefix">
|
||||
<action name="actionPrefixExampleUsingFreemarker">
|
||||
<result type="freemarker">/WEB-INF/tags/non-ui/actionPrefix/actionPrefixExample.ftl</result>
|
||||
</action>
|
||||
</action>
|
||||
<action name="submit" class="org.apache.struts2.showcase.tag.nonui.actionPrefix.SubmitAction">
|
||||
<result type="freemarker">/WEB-INF/tags/non-ui/actionPrefix/normalSubmit.ftl</result>
|
||||
</action>
|
||||
@@ -131,7 +131,7 @@
|
||||
<result type="plainText">/WEB-INF/tags/non-ui/actionPrefix/actionPrefixExample.ftl</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
|
||||
<!-- ========================================== -->
|
||||
<!-- === Package for If Tag Test / Examples === -->
|
||||
<!-- ========================================== -->
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="ui-tags" extends="velocity-default" namespace="/tags/ui">
|
||||
<package name="ui-tags" extends="struts-default" namespace="/tags/ui">
|
||||
<action name="example" class="org.apache.struts2.showcase.UITagExample">
|
||||
<result>/WEB-INF/tags/ui/example.jsp</result>
|
||||
<result name="input">/WEB-INF/tags/ui/example.jsp</result>
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<include file="struts-tags-ui.xml"/>
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="tiles" extends="tiles-default" namespace="/tiles">
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
<struts>
|
||||
<package name="token" extends="struts-default" namespace="/token">
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
|
||||
<constant name="struts.beanValidation.providerClass" value="org.hibernate.validator.HibernateValidator"/>
|
||||
@@ -47,11 +47,6 @@
|
||||
<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">
|
||||
<result name="input">/WEB-INF/validation/quiz-client-css.jsp</result>
|
||||
<result>/WEB-INF/validation/quiz-success.jsp</result>
|
||||
@@ -74,7 +69,7 @@
|
||||
<action name="ajaxFormSubmitSuccess" class="org.apache.struts2.showcase.validation.AjaxFormSubmitSuccessAction">
|
||||
<result>/WEB-INF/validation/ajaxFormSubmitSuccess.jsp</result>
|
||||
</action>
|
||||
|
||||
|
||||
</package>
|
||||
|
||||
|
||||
@@ -83,46 +78,46 @@
|
||||
<action name="list">
|
||||
<result>index.jsp</result>
|
||||
</action>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ======================== -->
|
||||
<!-- === Field Validators === -->
|
||||
<!-- ======================== -->
|
||||
|
||||
|
||||
<action name="showFieldValidatorsExamples" class="org.apache.struts2.showcase.validation.FieldValidatorsExampleAction" method="input">
|
||||
<result name="input" type="dispatcher">/WEB-INF/validation/fieldValidatorsExample.jsp</result>
|
||||
</action>
|
||||
|
||||
|
||||
<action name="submitFieldValidatorsExamples" class="org.apache.struts2.showcase.validation.FieldValidatorsExampleAction" method="submit">
|
||||
<result name="input" type="dispatcher">/WEB-INF/validation/fieldValidatorsExample.jsp</result>
|
||||
<result type="dispatcher">/WEB-INF/validation/successFieldValidatorsExample.jsp</result>
|
||||
</action>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ============================ -->
|
||||
<!-- === Non Field Validators === -->
|
||||
<!-- ============================ -->
|
||||
|
||||
|
||||
<action name="showNonFieldValidatorsExamples" class="org.apache.struts2.showcase.validation.NonFieldValidatorsExampleAction" method="input">
|
||||
<result name="input">/WEB-INF/validation/nonFieldValidatorsExample.jsp</result>
|
||||
</action>
|
||||
|
||||
|
||||
<action name="submitNonFieldValidatorsExamples" class="org.apache.struts2.showcase.validation.NonFieldValidatorsExampleAction" method="submit">
|
||||
<result name="input">/WEB-INF/validation/nonFieldValidatorsExample.jsp</result>
|
||||
<result>/WEB-INF/validation/successNonFieldValidatorsExample.jsp</result>
|
||||
</action>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ========================== -->
|
||||
<!-- === Visitor Validators === -->
|
||||
<!-- ========================== -->
|
||||
|
||||
|
||||
<action name="showVisitorValidatorsExamples" class="org.apache.struts2.showcase.validation.VisitorValidatorsExampleAction" method="input">
|
||||
<result name="input">/WEB-INF/validation/visitorValidatorsExample.jsp</result>
|
||||
</action>
|
||||
|
||||
|
||||
<action name="submitVisitorValidatorsExamples" class="org.apache.struts2.showcase.validation.VisitorValidatorsExampleAction" method="submit">
|
||||
<result name="input">/WEB-INF/validation/visitorValidatorsExample.jsp</result>
|
||||
<result>/WEB-INF/validation/successVisitorValidatorsExample.jsp</result>
|
||||
@@ -146,7 +141,7 @@
|
||||
<!-- =========================================== -->
|
||||
<!-- === Store Error Messages Across Request === -->
|
||||
<!-- =========================================== -->
|
||||
|
||||
|
||||
<action name="submitApplication" class="org.apache.struts2.showcase.validation.SubmitApplication" method="submitApplication">
|
||||
<interceptor-ref name="store">
|
||||
<param name="operationMode">STORE</param>
|
||||
@@ -173,7 +168,7 @@
|
||||
<action name="cancelApplication" class="org.apache.struts2.showcase.validation.SubmitApplication" method="cancelApplication">
|
||||
<result>/WEB-INF/validation/storeErrorsAcrossRequestCancel.jsp</result>
|
||||
</action>
|
||||
|
||||
|
||||
</package>
|
||||
</struts>
|
||||
|
||||
|
||||
|
||||
@@ -20,21 +20,11 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
|
||||
<bean type="org.apache.struts2.interceptor.exec.ExecutorProvider" name="threadPool"
|
||||
class="org.apache.struts2.showcase.wait.ThreadPoolExecutorProvider"/>
|
||||
|
||||
<constant name="struts.executor.provider" value="threadPool"/>
|
||||
|
||||
<package name="wait" extends="struts-default" namespace="/wait">
|
||||
<default-action-ref name="index"/>
|
||||
<action name="index">
|
||||
<result>/WEB-INF/wait/index.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="example1">
|
||||
<result>/WEB-INF/wait/example1.jsp</result>
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="xslt" extends="xslt-default" namespace="/xslt">
|
||||
<package name="xslt" extends="struts-default" namespace="/xslt">
|
||||
<default-action-ref name="index"/>
|
||||
|
||||
<action name="index">
|
||||
@@ -36,7 +36,7 @@
|
||||
<param name="exposedValue">info.classpath</param>
|
||||
</result>
|
||||
</action>
|
||||
|
||||
|
||||
<action name="jvmInfoRaw" class="org.apache.struts2.showcase.xslt.JVMAction">
|
||||
<result type="xslt">
|
||||
<param name="exposedValue">info</param>
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
|
||||
"https://struts.apache.org/dtds/struts-6.0.dtd">
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.5.dtd">
|
||||
|
||||
<!-- START SNIPPET: xworkSample -->
|
||||
<struts>
|
||||
@@ -34,9 +34,6 @@
|
||||
<constant name="struts.custom.i18n.resources" value="globalMessages" />
|
||||
<constant name="struts.action.extension" value="action,," />
|
||||
|
||||
<constant name="struts.allowlist.enable" value="true" />
|
||||
<constant name="struts.parameters.requireAnnotations" value="true" />
|
||||
|
||||
<constant name="struts.convention.package.locators.basePackage" value="org.apache.struts2.showcase" />
|
||||
<constant name="struts.convention.result.path" value="/WEB-INF" />
|
||||
|
||||
@@ -47,8 +44,6 @@
|
||||
<constant name="struts.serve.static" value="true" />
|
||||
<constant name="struts.serve.static.browserCache" value="false" />
|
||||
|
||||
<constant name="struts.action.excludePattern" value=".*/images/.*\.gif,.*/img/.*\.gif,.*/styles/.*\.css,.*/js/.*\.js,/testServlet/.*"/>
|
||||
|
||||
<include file="struts-interactive.xml" />
|
||||
|
||||
<include file="struts-hangman.xml" />
|
||||
@@ -79,12 +74,6 @@
|
||||
|
||||
<include file="struts-xslt.xml" />
|
||||
|
||||
<include file="struts-async.xml" />
|
||||
|
||||
<include file="struts-dispatcher.xml" />
|
||||
|
||||
<include file="struts-params-annotation.xml" />
|
||||
|
||||
<package name="default" extends="struts-default">
|
||||
<interceptors>
|
||||
<interceptor-stack name="crudStack">
|
||||
|
||||
@@ -23,21 +23,21 @@
|
||||
-->
|
||||
<ul<#rt/>
|
||||
<#if parameters.id??>
|
||||
id="${parameters.id}"<#rt/>
|
||||
id="${parameters.id?html}"<#rt/>
|
||||
</#if>
|
||||
<#if parameters.cssClass??>
|
||||
class="${parameters.cssClass}"<#rt/>
|
||||
class="${parameters.cssClass?html}"<#rt/>
|
||||
<#else>
|
||||
class="errorMessage"<#rt/>
|
||||
</#if>
|
||||
<#if parameters.cssStyle??>
|
||||
style="${parameters.cssStyle}"<#rt/>
|
||||
style="${parameters.cssStyle?html}"<#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 parameters.escape>${error!?html}<#else>${error!}</#if></span><#rt/></li><#rt/>
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
|
||||
@@ -28,7 +28,7 @@ ${parameters.after!}<#t/>
|
||||
<td class="tdErrorMessage" colspan="2"><#rt/>
|
||||
<#if hasFieldErrors>
|
||||
<#list fieldErrors.get(parameters.name) as error>
|
||||
<div class="errorMessage">${error}</div><#t/>
|
||||
<div class="errorMessage">${error?html}</div><#t/>
|
||||
</#list>
|
||||
</#if>
|
||||
</td><#lt/>
|
||||
|
||||
+4
-4
@@ -27,7 +27,7 @@
|
||||
<td class="tdErrorMessage" colspan="2" data-error-for-fieldname="${parameters.name}"><#rt/>
|
||||
<#if hasFieldErrors>
|
||||
<#list fieldErrors.get(parameters.name) as error>
|
||||
<div class="errorMessage">${error}</div><#t/>
|
||||
<div class="errorMessage">${error?html}</div><#t/>
|
||||
</#list>
|
||||
</#if>
|
||||
</td><#lt/>
|
||||
@@ -51,7 +51,7 @@
|
||||
<#if parameters.label??>
|
||||
<label <#t/>
|
||||
<#if parameters.id??>
|
||||
for="${parameters.id}" <#t/>
|
||||
for="${parameters.id?html}" <#t/>
|
||||
</#if>
|
||||
<#if hasFieldErrors>
|
||||
class="errorLabel"<#t/>
|
||||
@@ -62,11 +62,11 @@
|
||||
<#if parameters.required!false && parameters.requiredPosition!"right" != 'right'>
|
||||
<span class="required">*</span><#t/>
|
||||
</#if>
|
||||
${parameters.label}<#t/>
|
||||
${parameters.label?html}<#t/>
|
||||
<#if parameters.required!false && parameters.requiredPosition!"right" == 'right'>
|
||||
<span class="required">*</span><#t/>
|
||||
</#if>
|
||||
${parameters.labelseparator!":"}<#t/>
|
||||
${parameters.labelseparator!":"?html}<#t/>
|
||||
<#include "/${parameters.templateDir}/${parameters.expandTheme}/tooltip.ftl" />
|
||||
</label><#t/>
|
||||
</#if>
|
||||
|
||||
@@ -45,46 +45,66 @@
|
||||
</bean>
|
||||
|
||||
<bean id="chatLoginAction" class="org.apache.struts2.showcase.chat.ChatLoginAction" scope="prototype">
|
||||
<constructor-arg index="0" ref="chatService"/>
|
||||
<constructor-arg index="0">
|
||||
<ref local="chatService"/>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="chatLogoutAction" class="org.apache.struts2.showcase.chat.ChatLogoutAction" scope="prototype">
|
||||
<constructor-arg index="0" ref="chatService"/>
|
||||
<constructor-arg index="0">
|
||||
<ref local="chatService"/>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="usersAvailableAction" class="org.apache.struts2.showcase.chat.UsersAvailableAction" scope="prototype">
|
||||
<constructor-arg index="0" ref="chatService"/>
|
||||
<constructor-arg index="0">
|
||||
<ref local="chatService"/>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="roomsAvailableAction" class="org.apache.struts2.showcase.chat.RoomsAvailableAction" scope="prototype">
|
||||
<constructor-arg index="0" ref="chatService"/>
|
||||
<constructor-arg index="0">
|
||||
<ref local="chatService"/>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="crudRoomAction" class="org.apache.struts2.showcase.chat.CrudRoomAction" scope="prototype">
|
||||
<constructor-arg index="0" ref="chatService"/>
|
||||
<constructor-arg index="0">
|
||||
<ref local="chatService"/>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="enterRoomAction" class="org.apache.struts2.showcase.chat.EnterRoomAction" scope="prototype">
|
||||
<constructor-arg index="0" ref="chatService"/>
|
||||
<constructor-arg index="0">
|
||||
<ref local="chatService"/>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="messagesAvailableInRoomAction" class="org.apache.struts2.showcase.chat.MessagesAvailableInRoomAction"
|
||||
scope="prototype">
|
||||
<constructor-arg index="0" ref="chatService"/>
|
||||
<constructor-arg index="0">
|
||||
<ref local="chatService"/>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="sendMessageToRoomAction" class="org.apache.struts2.showcase.chat.SendMessageToRoomAction"
|
||||
scope="prototype">
|
||||
<constructor-arg index="0" ref="chatService"/>
|
||||
<constructor-arg index="0">
|
||||
<ref local="chatService"/>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="usersAvailableInRoomAction" class="org.apache.struts2.showcase.chat.UsersAvailableInRoomAction"
|
||||
scope="prototype">
|
||||
<constructor-arg index="0" ref="chatService"/>
|
||||
<constructor-arg index="0">
|
||||
<ref local="chatService"/>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="exitRoomAction" class="org.apache.struts2.showcase.chat.ExitRoomAction" scope="prototype">
|
||||
<constructor-arg index="0" ref="chatService"/>
|
||||
<constructor-arg index="0">
|
||||
<ref local="chatService"/>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -109,7 +129,9 @@
|
||||
</bean>
|
||||
|
||||
<bean id="startHangmanAction" class="org.apache.struts2.showcase.hangman.StartHangmanAction" scope="prototype">
|
||||
<constructor-arg index="0" ref="hangmanService"/>
|
||||
<constructor-arg index="0">
|
||||
<ref local="hangmanService"/>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="guessCharacterAction" class="org.apache.struts2.showcase.hangman.GuessCharacterAction" scope="prototype"/>
|
||||
|
||||
@@ -63,41 +63,32 @@
|
||||
|
||||
<title><decorator:title default="Struts2 Showcase"/></title>
|
||||
|
||||
<s:url var="bootstrapCss" value='/styles/bootstrap.css' encode='false' includeParams='none'/>
|
||||
<s:link href="%{bootstrapCss}" rel="stylesheet" type="text/css" media="all"/>
|
||||
<s:url var="mainCss" value='/styles/main.css' encode='false' includeParams='none'/>
|
||||
<s:link href="%{mainCss}" rel="stylesheet" type="text/css" media="all"/>
|
||||
<link href="<s:url value='/styles/bootstrap.css' encode='false' includeParams='none'/>" rel="stylesheet" type="text/css" media="all">
|
||||
<link href="<s:url value='/styles/main.css' encode='false' includeParams='none'/>" rel="stylesheet" type="text/css" media="all"/>
|
||||
|
||||
<s:url var="jqueryJs" value='/js/jquery-2.1.4.min.js' encode='false' includeParams='none'/>
|
||||
<s:script src="%{jqueryJs}"/>
|
||||
<s:url var="bootstrapJs" value='/js/bootstrap.min.js' encode='false' includeParams='none'/>
|
||||
<s:script src="%{bootstrapJs}"/>
|
||||
<s:script>
|
||||
<script src="<s:url value='/js/jquery-2.1.4.min.js' encode='false' includeParams='none'/>"></script>
|
||||
<script src="<s:url value='/js/bootstrap.min.js' encode='false' includeParams='none'/>"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var alerts = $('ul.alert').wrap('<div />');
|
||||
alerts.prepend('<a class="close" data-dismiss="alert" href="#">×</a>');
|
||||
alerts.alert();
|
||||
});
|
||||
</s:script>
|
||||
</script>
|
||||
|
||||
<!-- Prettify -->
|
||||
<s:url var="prettifyCss" value='/styles/prettify.css' encode='false' includeParams='none'/>
|
||||
<s:link href="%{prettifyCss}" rel="stylesheet"/>
|
||||
<s:url var="prettifyJs" value='/js/prettify.js' encode='false' includeParams='none'/>
|
||||
<s:script src="%{prettifyJs}"/>
|
||||
<link href="<s:url value='/styles/prettify.css' encode='false' includeParams='none'/>" rel="stylesheet">
|
||||
<script src="<s:url value='/js/prettify.js' encode='false' includeParams='none'/>"></script>
|
||||
|
||||
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
|
||||
<!--[if lt IE 9]>
|
||||
<s:script src="http://html5shim.googlecode.com/svn/trunk/html5.js"/>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<s:script>
|
||||
jQuery(document).ready(function() { prettyPrint(); } );
|
||||
</s:script>
|
||||
<decorator:head/>
|
||||
</head>
|
||||
|
||||
<body id="page-home">
|
||||
<body id="page-home" onload="prettyPrint();">
|
||||
|
||||
<nav class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="container-fluid">
|
||||
@@ -210,7 +201,6 @@
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<s:url var="quizBasic" namespace="/validation" action="quizBasic" method="input"/>
|
||||
<s:url var="quizClient" namespace="/validation" action="quizClient" method="input"/>
|
||||
<s:url var="quizDwr" namespace="/validation" action="quizDwr" method="input"/>
|
||||
<s:url var="quizClientCss" namespace="/validation" action="quizClientCss" method="input"/>
|
||||
<s:url var="fieldValidatorUrl" action="showFieldValidatorsExamples" namespace="/validation"/>
|
||||
<s:url var="nonFieldValidatorUrl" action="showNonFieldValidatorsExamples" namespace="/validation"/>
|
||||
@@ -226,7 +216,6 @@
|
||||
<li><s:a href="%{storeMessageAcrossRequestExample}">Store across request using MessageStoreInterceptor (Example)</s:a></li>
|
||||
<li><s:a href="%{quizBasic}">Validation (basic)</s:a></li>
|
||||
<li><s:a href="%{quizClient}">Validation (client)</s:a></li>
|
||||
<li><s:a href="%{quizDwr}">Validation (DWR)</s:a></li>
|
||||
<li><s:a href="%{quizClientCss}">Validation (client using css_xhtml theme)</s:a></li>
|
||||
<li><s:a href="%{visitorValidatorUrl}">Visitor Validator</s:a></li>
|
||||
<li><s:a href="%{ajaxFormSubmitUrl}">AJAX Form Submit</s:a></li>
|
||||
@@ -242,13 +231,10 @@
|
||||
</li>
|
||||
<li><s:a value="/person/index.html">Person Manager</s:a></li>
|
||||
<li><s:a value="/skill/index.html">CRUD</s:a></li>
|
||||
<li><s:a value="/wait/index">Execute & Wait</s:a></li>
|
||||
<li><s:a value="/wait/index.html">Execute & Wait</s:a></li>
|
||||
<li><s:a value="/token/index.html">Token</s:a></li>
|
||||
<li><s:url var="url" namespace="/modelDriven" action="modelDriven"/><s:a
|
||||
href="%{url}">Model Driven</s:a></li>
|
||||
<li><s:a value="/async/index.html">Async</s:a></li>
|
||||
<li><s:a value="/dispatcher/dispatch.action">Dispatcher result - dispatch</s:a></li>
|
||||
<li><s:a value="/dispatcher/forward.action">Dispatcher result - forward</s:a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
<!--
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Struts2 Showcase - Dispatcher result Example</title>
|
||||
<s:head theme="xhtml"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Dispatcher Result Example</h1>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div id="dispatcher-result" class="col-md-12">
|
||||
This page is a result of "dispatching" to it from an action
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user