mirror of
https://github.com/apache/struts.git
synced 2026-08-07 15:46:57 +00:00
Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8fb9aba74b | |||
| c45664a330 | |||
| 91c9314176 | |||
| a4e9902d94 | |||
| fe5b197738 | |||
| 87e322dbe2 | |||
| 7909f43237 | |||
| 1fe822cca0 | |||
| ef90b3ba3c | |||
| d35ec15c76 | |||
| 583b174fe6 | |||
| 9b044377ac | |||
| 58f37babbf | |||
| fe3dd6ba9f | |||
| 7a77c7a82c | |||
| 5038a9209f | |||
| 2135ebf651 | |||
| c0dd8dd80c | |||
| c36eafa37a | |||
| 07603b9591 | |||
| 3227d5929a | |||
| 4a8ddbb274 | |||
| 67ba458d03 | |||
| 959b2182b2 | |||
| 6de93e77db | |||
| 59dc9301e0 | |||
| 2fc4a822a4 | |||
| 6a6270f62a | |||
| 9153228b6a | |||
| 5713a74edc | |||
| 32071c71ad | |||
| 7e4791985b | |||
| 3c1e44ca2d | |||
| 2ba8d97ad0 | |||
| cba0db0b07 | |||
| 688162cae2 | |||
| a33c162f53 | |||
| c7a6daf5ce | |||
| 370c7ce17a | |||
| 55989befce | |||
| 2e4a4b5e36 | |||
| 9d07c3b4c3 | |||
| 575e4e8c9b | |||
| 74388dfba7 | |||
| 4ee8b02262 | |||
| c8febc2050 | |||
| 3ea126388c | |||
| 09993e3476 | |||
| f5688e680b | |||
| 60a3db0a63 | |||
| 4714d27678 | |||
| 4feceee5f1 |
@@ -11,9 +11,19 @@ notifications:
|
||||
jira_options: link label worklog
|
||||
|
||||
github:
|
||||
description: "Apache Struts is a free, open-source, MVC framework for creating elegant, modern Java web applications"
|
||||
homepage: https://struts.apache.org/
|
||||
del_branch_on_merge: true
|
||||
protected_branches:
|
||||
master:
|
||||
main:
|
||||
# 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
|
||||
release/*:
|
||||
# contexts are the names of checks that must pass.
|
||||
contexts:
|
||||
- build
|
||||
|
||||
@@ -17,7 +17,8 @@ name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches:
|
||||
- 'release/*'
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
@@ -41,15 +42,21 @@ jobs:
|
||||
matrix:
|
||||
language: [ 'java' ]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3.27.1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3.27.1
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3.27.1
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Java JDK
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 17
|
||||
cache: 'maven'
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3.28.8
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3.28.8
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3.28.8
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
|
||||
Vendored
+11
-54
@@ -69,7 +69,7 @@ pipeline {
|
||||
stages {
|
||||
stage('Test & Coverage') {
|
||||
steps {
|
||||
sh './mvnw -B verify -Pcoverage -DskipAssembly --no-transfer-progress'
|
||||
sh './mvnw -B verify -Pcoverage -DskipAssembly'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
@@ -81,58 +81,15 @@ pipeline {
|
||||
stage('Code Quality') {
|
||||
when {
|
||||
anyOf {
|
||||
branch 'master'; branch 'release/struts-7-0-x'
|
||||
branch 'release/struts-6-7-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'
|
||||
sh './mvnw -B -Pcoverage -DskipAssembly -Dsonar.login=${SONARCLOUD_TOKEN} verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar'
|
||||
}
|
||||
}
|
||||
}
|
||||
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 {
|
||||
@@ -154,12 +111,12 @@ pipeline {
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh './mvnw -B clean install -DskipTests -DskipAssembly --no-transfer-progress'
|
||||
sh './mvnw -B clean install -DskipTests -DskipAssembly'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
sh './mvnw -B verify --no-transfer-progress'
|
||||
sh './mvnw -B verify -DskipAssembly'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
@@ -170,31 +127,31 @@ pipeline {
|
||||
}
|
||||
stage('Build Source & JavaDoc') {
|
||||
when {
|
||||
branch 'master'
|
||||
branch 'release/struts-6-7-x'
|
||||
}
|
||||
steps {
|
||||
dir("local-snapshots-dir/") {
|
||||
deleteDir()
|
||||
}
|
||||
sh './mvnw -B source:jar javadoc:jar -DskipTests -DskipAssembly --no-transfer-progress'
|
||||
sh './mvnw -B source:jar javadoc:jar -DskipTests -DskipAssembly'
|
||||
}
|
||||
}
|
||||
stage('Deploy Snapshot') {
|
||||
when {
|
||||
branch 'master'
|
||||
branch 'release/struts-6-7-x'
|
||||
}
|
||||
steps {
|
||||
withCredentials([file(credentialsId: 'lukaszlenart-repository-access-token', variable: 'CUSTOM_SETTINGS')]) {
|
||||
sh './mvnw -s \${CUSTOM_SETTINGS} deploy -DskipTests -DskipAssembly --no-transfer-progress'
|
||||
sh './mvnw -s \${CUSTOM_SETTINGS} deploy -DskipTests -DskipAssembly'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Upload nightlies') {
|
||||
when {
|
||||
branch 'master'
|
||||
branch 'release/struts-6-7-x'
|
||||
}
|
||||
steps {
|
||||
sh './mvnw -B package -DskipTests --no-transfer-progress'
|
||||
sh './mvnw -B package -DskipTests'
|
||||
sshPublisher(publishers: [
|
||||
sshPublisherDesc(
|
||||
configName: 'Nightlies',
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-rest-showcase</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
<name>Struts 2 Rest Showcase Webapp</name>
|
||||
<description>Struts 2 Rest Showcase Example</description>
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-showcase</artifactId>
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-assembly</artifactId>
|
||||
|
||||
+4
-4
@@ -25,11 +25,11 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-bom</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Struts 2 Bill of Materials</name>
|
||||
@@ -44,7 +44,7 @@
|
||||
</licenses>
|
||||
|
||||
<properties>
|
||||
<struts-version.version>6.7.0</struts-version.version>
|
||||
<struts-version.version>6.7.4</struts-version.version>
|
||||
<maven.site.skip>true</maven.site.skip>
|
||||
<maven.site.deploy.skip>true</maven.site.deploy.skip>
|
||||
</properties>
|
||||
@@ -190,7 +190,7 @@
|
||||
</dependencyManagement>
|
||||
|
||||
<scm>
|
||||
<tag>STRUTS_6_7_0</tag>
|
||||
<tag>STRUTS_6_7_4</tag>
|
||||
<connection>scm:git:https://gitbox.apache.org/repos/asf/struts.git</connection>
|
||||
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/struts.git</developerConnection>
|
||||
<url>https://github.com/apache/struts/</url>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-osgi-bundles</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-osgi-admin-bundle</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-osgi-bundles</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-osgi-demo-bundle</artifactId>
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-osgi-bundles</artifactId>
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
<artifactId>struts2-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -242,6 +242,41 @@ class ContainerImpl implements Container {
|
||||
return toArray(parameterInjectors);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets parameter injectors with nulls for optional dependencies.
|
||||
*
|
||||
* @param member to which the parameters belong
|
||||
* @param annotations on the parameters
|
||||
* @param parameterTypes parameter types
|
||||
* @return injections
|
||||
*/
|
||||
<M extends AccessibleObject & Member> ParameterInjector<?>[] getParametersInjectorsWithNulls(
|
||||
M member,
|
||||
Annotation[][] annotations,
|
||||
Class<?>[] parameterTypes,
|
||||
String defaultName
|
||||
) throws MissingDependencyException {
|
||||
final List<ParameterInjector<?>> parameterInjectors = new ArrayList<>();
|
||||
|
||||
final Iterator<Annotation[]> annotationsIterator = Arrays.asList(annotations).iterator();
|
||||
for (Class<?> parameterType : parameterTypes) {
|
||||
Inject annotation = findInject(annotationsIterator.next());
|
||||
String name = annotation == null ? defaultName : annotation.value();
|
||||
Key<?> key = Key.newInstance(parameterType, name);
|
||||
try {
|
||||
parameterInjectors.add(createParameterInjector(key, member));
|
||||
} catch (MissingDependencyException e) {
|
||||
if (annotation != null && annotation.required()) {
|
||||
throw e;
|
||||
} else {
|
||||
parameterInjectors.add(createNullParameterInjector(key, member));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return toArray(parameterInjectors);
|
||||
}
|
||||
|
||||
<T> ParameterInjector<T> createParameterInjector(Key<T> key, Member member) throws MissingDependencyException {
|
||||
final InternalFactory<? extends T> factory = getFactory(key);
|
||||
if (factory == null) {
|
||||
@@ -252,6 +287,23 @@ class ContainerImpl implements Container {
|
||||
return new ParameterInjector<>(externalContext, factory);
|
||||
}
|
||||
|
||||
<T> ParameterInjector<T> createNullParameterInjector(Key<T> key, Member member) throws MissingDependencyException {
|
||||
final InternalFactory<? extends T> factory = new InternalFactory<T>() {
|
||||
@Override
|
||||
public T create(InternalContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends T> type() {
|
||||
return key.getType();
|
||||
}
|
||||
};
|
||||
|
||||
final ExternalContext<T> externalContext = ExternalContext.newInstance(member, key, this);
|
||||
return new ParameterInjector<>(externalContext, factory);
|
||||
}
|
||||
|
||||
private ParameterInjector<?>[] toArray(List<ParameterInjector<?>> parameterInjections) {
|
||||
return parameterInjections.toArray(new ParameterInjector[0]);
|
||||
}
|
||||
@@ -361,7 +413,7 @@ class ContainerImpl implements Container {
|
||||
Inject inject, ContainerImpl container, Constructor<T> constructor) throws MissingDependencyException {
|
||||
return constructor.getParameterTypes().length == 0
|
||||
? null // default constructor.
|
||||
: container.getParametersInjectors(
|
||||
: container.getParametersInjectorsWithNulls(
|
||||
constructor,
|
||||
constructor.getParameterAnnotations(),
|
||||
constructor.getParameterTypes(),
|
||||
|
||||
@@ -160,6 +160,9 @@ public class SecurityMemberAccess implements MemberAccess {
|
||||
public boolean isAccessible(Map context, Object target, Member member, String propertyName) {
|
||||
LOG.debug("Checking access for [target: {}, member: {}, property: {}]", target, member, propertyName);
|
||||
|
||||
if (member == null) {
|
||||
throw new IllegalArgumentException("Member cannot be null!");
|
||||
}
|
||||
if (target != null) {
|
||||
// Special case: Target is a Class object but not Class.class
|
||||
if (Class.class.equals(target.getClass()) && !Class.class.equals(target)) {
|
||||
@@ -228,7 +231,7 @@ public class SecurityMemberAccess implements MemberAccess {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!disallowProxyObjectAccess && target != null && ProxyUtil.isProxy(target)) {
|
||||
if (!disallowProxyObjectAccess && ProxyUtil.isProxy(target)) {
|
||||
// If `disallowProxyObjectAccess` is not set, allow resolving Hibernate entities to their underlying
|
||||
// classes/members. This allows the allowlist capability to continue working and offer some level of
|
||||
// protection in applications where the developer has accepted the risk of allowing OGNL access to Hibernate
|
||||
|
||||
+1
@@ -36,6 +36,7 @@ public class DefaultExcludedPatternsChecker implements ExcludedPatternsChecker {
|
||||
private static final Logger LOG = LogManager.getLogger(DefaultExcludedPatternsChecker.class);
|
||||
|
||||
public static final String[] EXCLUDED_PATTERNS = {
|
||||
"(^|\\%\\{)(#?top\\.)[^\\s]*",
|
||||
"(^|\\%\\{)((#?)(top(\\.|\\['|\\[\")|\\[\\d\\]\\.)?)(dojo|struts|session|request|response|application|servlet(Request|Response|Context)|parameters|context|_memberAccess)(\\.|\\[).*",
|
||||
".*(^|\\.|\\[|\\'|\"|get)class(\\(\\.|\\[|\\'|\").*",
|
||||
"actionErrors|actionMessages|fieldErrors"
|
||||
|
||||
@@ -35,7 +35,7 @@ public final class DebugUtils {
|
||||
log.error(message);
|
||||
if (action instanceof ValidationAware) {
|
||||
ValidationAware validationAware = (ValidationAware) action;
|
||||
validationAware.addActionError(message);
|
||||
validationAware.addActionMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ public class ProxyUtil {
|
||||
* @param object the object to check
|
||||
*/
|
||||
public static boolean isProxy(Object object) {
|
||||
if (object == null) return false;
|
||||
Class<?> clazz = object.getClass();
|
||||
Boolean flag = isProxyCache.get(clazz);
|
||||
if (flag != null) {
|
||||
@@ -121,7 +122,7 @@ public class ProxyUtil {
|
||||
*/
|
||||
public static boolean isHibernateProxy(Object object) {
|
||||
try {
|
||||
return HibernateProxy.class.isAssignableFrom(object.getClass());
|
||||
return object != null && HibernateProxy.class.isAssignableFrom(object.getClass());
|
||||
} catch (NoClassDefFoundError ignored) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -215,8 +215,8 @@ public class ActionComponent extends ContextBean {
|
||||
|
||||
HttpParameters.Builder builder = HttpParameters.create().withParent(parentParams);
|
||||
|
||||
if (attributes != null) {
|
||||
builder = builder.withExtraParams(attributes);
|
||||
if (getAttributes() != null) {
|
||||
builder = builder.withExtraParams(getAttributes());
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,11 @@ public class Component {
|
||||
protected boolean devMode = false;
|
||||
protected boolean escapeHtmlBody = false;
|
||||
protected ValueStack stack;
|
||||
protected Map<String, Object> attributes;
|
||||
/**
|
||||
* @deprecated use {@link #getAttributes} instead of directly depending on this field
|
||||
*/
|
||||
@Deprecated
|
||||
protected Map<String, Object> parameters;
|
||||
protected ActionMapper actionMapper;
|
||||
protected boolean throwExceptionOnELFailure;
|
||||
protected boolean performClearTagStateForTagPoolingServers = false;
|
||||
@@ -86,7 +90,7 @@ public class Component {
|
||||
*/
|
||||
public Component(ValueStack stack) {
|
||||
this.stack = stack;
|
||||
this.attributes = new LinkedHashMap<>();
|
||||
this.parameters = new LinkedHashMap<>();
|
||||
getComponentStack().push(this);
|
||||
}
|
||||
|
||||
@@ -279,7 +283,7 @@ public class Component {
|
||||
*/
|
||||
protected StrutsException fieldError(String field, String errorMsg, Exception e) {
|
||||
String msg = "tag '" + getComponentName() + "', field '" + field +
|
||||
(attributes != null && attributes.containsKey("name") ? "', name '" + attributes.get("name") : "") +
|
||||
(getAttributes() != null && getAttributes().containsKey("name") ? "', name '" + getAttributes().get("name") : "") +
|
||||
"': " + errorMsg;
|
||||
throw new StrutsException(msg, e);
|
||||
}
|
||||
@@ -457,7 +461,7 @@ public class Component {
|
||||
* @param params the parameters to copy.
|
||||
*/
|
||||
public void copyParams(Map<String, Object> params) {
|
||||
stack.push(attributes);
|
||||
stack.push(getAttributes());
|
||||
stack.push(this);
|
||||
try {
|
||||
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
||||
@@ -467,7 +471,7 @@ public class Component {
|
||||
// UI component attributes may contain hypens (e.g. data-ajax), but ognl
|
||||
// can't handle that, and there can't be a component property with a hypen
|
||||
// so into the parameters map it goes. See WW-4493
|
||||
attributes.put(key, entry.getValue());
|
||||
getAttributes().put(key, entry.getValue());
|
||||
} else {
|
||||
stack.setValue(key, entry.getValue());
|
||||
}
|
||||
@@ -500,7 +504,7 @@ public class Component {
|
||||
*/
|
||||
@Deprecated
|
||||
public Map<String, Object> getParameters() {
|
||||
return attributes;
|
||||
return parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -509,7 +513,7 @@ public class Component {
|
||||
* @return the parameters. Is never <tt>null</tt>.
|
||||
*/
|
||||
public Map<String, Object> getAttributes() {
|
||||
return attributes;
|
||||
return parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -518,7 +522,7 @@ public class Component {
|
||||
* @param params the parameters to add.
|
||||
*/
|
||||
public void addAllParameters(Map<String, Object> params) {
|
||||
attributes.putAll(params);
|
||||
getAttributes().putAll(params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -204,7 +204,7 @@ public class Form extends ClosingUIBean {
|
||||
|
||||
// keep a collection of the tag names for anything special the templates might want to do (such as pure client
|
||||
// side validation)
|
||||
if (!attributes.containsKey("tagNames")) {
|
||||
if (!getAttributes().containsKey("tagNames")) {
|
||||
// we have this if check so we don't do this twice (on open and close of the template)
|
||||
addParameter("tagNames", new ArrayList());
|
||||
}
|
||||
|
||||
@@ -137,14 +137,13 @@ public class Include extends Component {
|
||||
urlBuf.append(page);
|
||||
|
||||
// Add request parameters
|
||||
if (attributes.size() > 0) {
|
||||
if (!getAttributes().isEmpty()) {
|
||||
urlBuf.append('?');
|
||||
|
||||
String concat = "";
|
||||
|
||||
// Set parameters
|
||||
for (Object next : attributes.entrySet()) {
|
||||
Map.Entry entry = (Map.Entry) next;
|
||||
for (Map.Entry<String, Object> entry : getAttributes().entrySet()) {
|
||||
Object name = entry.getKey();
|
||||
List values = (List) entry.getValue();
|
||||
|
||||
@@ -234,11 +233,11 @@ public class Include extends Component {
|
||||
// instead, include tag requires that each parameter be a list of objects,
|
||||
// just like the HTTP servlet interfaces are (String[])
|
||||
if (value != null) {
|
||||
List currentValues = (List) attributes.get(key);
|
||||
List currentValues = (List) getAttributes().get(key);
|
||||
|
||||
if (currentValues == null) {
|
||||
currentValues = new ArrayList();
|
||||
attributes.put(key, currentValues);
|
||||
getAttributes().put(key, currentValues);
|
||||
}
|
||||
|
||||
currentValues.add(value);
|
||||
|
||||
@@ -81,8 +81,8 @@ public class Label extends UIBean {
|
||||
if (value != null) {
|
||||
addParameter("nameValue", findString(value));
|
||||
} else if (key != null) {
|
||||
Object nameValue = attributes.get("nameValue");
|
||||
if (nameValue == null || nameValue.toString().length() == 0) {
|
||||
Object nameValue = getAttributes().get("nameValue");
|
||||
if (nameValue == null || nameValue.toString().isEmpty()) {
|
||||
// get the label from a TextProvider (default value is the key)
|
||||
String providedLabel = TextProviderHelper.getText(key, key, stack);
|
||||
addParameter("nameValue", providedLabel);
|
||||
|
||||
@@ -67,7 +67,7 @@ public abstract class ListUIBean extends UIBean {
|
||||
Object value = null;
|
||||
|
||||
if (list == null) {
|
||||
list = attributes.get("list");
|
||||
list = getAttributes().get("list");
|
||||
}
|
||||
|
||||
if (list instanceof String) {
|
||||
|
||||
@@ -174,7 +174,7 @@ public class ServletUrlRenderer implements UrlRenderer {
|
||||
namespace, actionName);
|
||||
if (actionConfig != null) {
|
||||
|
||||
ActionMapping mapping = new ActionMapping(actionName, namespace, actionMethod, formComponent.attributes);
|
||||
ActionMapping mapping = new ActionMapping(actionName, namespace, actionMethod, formComponent.getAttributes());
|
||||
String result = urlHelper.buildUrl(formComponent.actionMapper.getUriFromActionMapping(mapping),
|
||||
formComponent.request, formComponent.response, queryStringResult.getQueryParams(), scheme, formComponent.includeContext, true, false, false);
|
||||
formComponent.addParameter("action", result);
|
||||
|
||||
@@ -50,17 +50,16 @@ import javax.servlet.http.HttpServletResponse;
|
||||
* </pre>
|
||||
*/
|
||||
@StrutsTag(
|
||||
name="textfield",
|
||||
tldTagClass="org.apache.struts2.views.jsp.ui.TextFieldTag",
|
||||
description="Render an HTML input field of type text",
|
||||
allowDynamicAttributes=true)
|
||||
name = "textfield",
|
||||
tldTagClass = "org.apache.struts2.views.jsp.ui.TextFieldTag",
|
||||
description = "Render an HTML input field of type text",
|
||||
allowDynamicAttributes = true)
|
||||
public class TextField extends UIBean {
|
||||
/**
|
||||
* The name of the default template for the TextFieldTag
|
||||
*/
|
||||
final public static String TEMPLATE = "text";
|
||||
|
||||
|
||||
protected String maxlength;
|
||||
protected String readonly;
|
||||
protected String size;
|
||||
@@ -95,27 +94,22 @@ public class TextField extends UIBean {
|
||||
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="HTML maxlength attribute", type="Integer")
|
||||
@StrutsTagAttribute(description = "HTML maxlength attribute", type = "Integer")
|
||||
public void setMaxlength(String maxlength) {
|
||||
this.maxlength = maxlength;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Deprecated. Use maxlength instead.", type="Integer")
|
||||
public void setMaxLength(String maxlength) {
|
||||
this.maxlength = maxlength;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Whether the input is readonly", type="Boolean", defaultValue="false")
|
||||
@StrutsTagAttribute(description = "Whether the input is readonly", type = "Boolean", defaultValue = "false")
|
||||
public void setReadonly(String readonly) {
|
||||
this.readonly = readonly;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="HTML size attribute", type="Integer")
|
||||
@StrutsTagAttribute(description = "HTML size attribute", type = "Integer")
|
||||
public void setSize(String size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Specifies the html5 type element to display. e.g. text, email, url", defaultValue="text")
|
||||
@StrutsTagAttribute(description = "Specifies the html5 type element to display. e.g. text, email, url", defaultValue = "text")
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.util.TextParseUtil;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
@@ -32,6 +31,7 @@ import org.apache.struts2.components.template.Template;
|
||||
import org.apache.struts2.components.template.TemplateEngine;
|
||||
import org.apache.struts2.components.template.TemplateEngineManager;
|
||||
import org.apache.struts2.components.template.TemplateRenderingContext;
|
||||
import org.apache.struts2.dispatcher.AttributeMap;
|
||||
import org.apache.struts2.dispatcher.StaticContentLoader;
|
||||
import org.apache.struts2.util.ComponentUtils;
|
||||
import org.apache.struts2.util.TextProviderHelper;
|
||||
@@ -48,6 +48,10 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.struts2.dispatcher.DispatcherConstants.ATTRIBUTES;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* UIBean is the standard superclass of all Struts UI components.
|
||||
@@ -440,6 +444,9 @@ public abstract class UIBean extends Component {
|
||||
|
||||
private static final Logger LOG = LogManager.getLogger(UIBean.class);
|
||||
|
||||
static final String TEMPLATE_DIR = "templateDir";
|
||||
static final String THEME = "theme";
|
||||
|
||||
protected static final String ATTR_FIELD_VALUE = "fieldValue";
|
||||
protected static final String ATTR_NAME_VALUE = "nameValue";
|
||||
protected static final String ATTR_VALUE = "value";
|
||||
@@ -602,13 +609,18 @@ public abstract class UIBean extends Component {
|
||||
result = findString(this.templateDir);
|
||||
}
|
||||
|
||||
// Check Request, Session, Application scopes
|
||||
if (isBlank(result)) {
|
||||
result = (String) getAttrMap().get(TEMPLATE_DIR);
|
||||
}
|
||||
|
||||
// Default template set
|
||||
if (StringUtils.isBlank(result)) {
|
||||
if (isBlank(result)) {
|
||||
result = defaultTemplateDir;
|
||||
}
|
||||
|
||||
// Defaults to 'template'
|
||||
if (StringUtils.isBlank(result)) {
|
||||
if (isBlank(result)) {
|
||||
result = "template";
|
||||
}
|
||||
|
||||
@@ -622,26 +634,36 @@ public abstract class UIBean extends Component {
|
||||
result = findString(this.theme);
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(result)) {
|
||||
if (isBlank(result)) {
|
||||
Form form = (Form) findAncestor(Form.class);
|
||||
if (form != null) {
|
||||
result = form.getTheme();
|
||||
}
|
||||
}
|
||||
|
||||
// Check Request, Session, Application scopes
|
||||
if (isBlank(result)) {
|
||||
result = (String) getAttrMap().get(THEME);
|
||||
}
|
||||
|
||||
// Default theme set
|
||||
if (StringUtils.isBlank(result)) {
|
||||
if (isBlank(result)) {
|
||||
result = defaultUITheme;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<String, Object> getAttrMap() {
|
||||
AttributeMap attrMap = (AttributeMap) getStack().getContext().get(ATTRIBUTES);
|
||||
return attrMap != null ? attrMap : emptyMap();
|
||||
}
|
||||
|
||||
public void evaluateParams() {
|
||||
String gotTheme = getTheme();
|
||||
|
||||
addParameter("templateDir", getTemplateDir());
|
||||
addParameter("theme", gotTheme);
|
||||
addParameter(TEMPLATE_DIR, getTemplateDir());
|
||||
addParameter(THEME, gotTheme);
|
||||
addParameter("template", template != null ? findString(template) : getDefaultTemplate());
|
||||
addParameter("dynamicAttributes", dynamicAttributes);
|
||||
addParameter("themeExpansionToken", uiThemeExpansionToken);
|
||||
@@ -882,8 +904,8 @@ public abstract class UIBean extends Component {
|
||||
*/
|
||||
protected void applyValueParameter(String translatedName) {
|
||||
// see if the value has been specified as a parameter already
|
||||
if (attributes.containsKey(ATTR_VALUE)) {
|
||||
attributes.put(ATTR_NAME_VALUE, attributes.get(ATTR_VALUE));
|
||||
if (getAttributes().containsKey(ATTR_VALUE)) {
|
||||
getAttributes().put(ATTR_NAME_VALUE, getAttributes().get(ATTR_VALUE));
|
||||
} else {
|
||||
if (evaluateNameValue()) {
|
||||
final Class<?> valueClazz = getValueClassType();
|
||||
|
||||
@@ -111,7 +111,7 @@ public class URL extends ContextBean {
|
||||
|
||||
public URL(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
|
||||
super(stack);
|
||||
urlProvider = new ComponentUrlProvider(this, this.attributes);
|
||||
urlProvider = new ComponentUrlProvider(this, this.getAttributes());
|
||||
urlProvider.setHttpServletRequest(req);
|
||||
urlProvider.setHttpServletResponse(res);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class AttributeMap extends AbstractMap<String, Object> {
|
||||
|
||||
PageContext pc = getPageContext();
|
||||
|
||||
if (pc == null) {
|
||||
if (pc == null || pc.getRequest() == null) {
|
||||
RequestMap request = (RequestMap) context.get(DispatcherConstants.REQUEST);
|
||||
SessionMap session = (SessionMap) context.get(DispatcherConstants.SESSION);
|
||||
ApplicationMap application = (ApplicationMap) context.get(DispatcherConstants.APPLICATION);
|
||||
|
||||
@@ -112,7 +112,7 @@ public class Dispatcher {
|
||||
*/
|
||||
public static final String REQUEST_POST_METHOD = "POST";
|
||||
|
||||
public static final String MULTIPART_FORM_DATA_REGEX = "^multipart/form-data(?:\\s*;\\s*boundary=[0-9a-zA-Z'()+_,\\-./:=?]{1,70})?(?:\\s*;\\s*charset=[a-zA-Z\\-0-9]{3,14})?";
|
||||
public static final String MULTIPART_FORM_DATA_REGEX = "^multipart/form-data(?:\\s*;\\s*boundary=[0-9a-zA-Z'\"()+_,\\-./:=?]{1,70})?(?:\\s*;\\s*charset=[a-zA-Z\\-0-9]{3,14})?";
|
||||
|
||||
private static final String CONFIG_SPLIT_REGEX = "\\s*,\\s*";
|
||||
|
||||
|
||||
+2
-10
@@ -20,6 +20,7 @@ package org.apache.struts2.dispatcher.multipart;
|
||||
|
||||
import com.opensymphony.xwork2.LocaleProviderFactory;
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
@@ -157,16 +158,7 @@ public abstract class AbstractMultiPartRequest implements MultiPartRequest {
|
||||
* @return the canonical name based on the supplied filename
|
||||
*/
|
||||
protected String getCanonicalName(final String originalFileName) {
|
||||
String fileName = originalFileName;
|
||||
|
||||
int forwardSlash = fileName.lastIndexOf('/');
|
||||
int backwardSlash = fileName.lastIndexOf('\\');
|
||||
if (forwardSlash != -1 && forwardSlash > backwardSlash) {
|
||||
fileName = fileName.substring(forwardSlash + 1);
|
||||
} else {
|
||||
fileName = fileName.substring(backwardSlash + 1);
|
||||
}
|
||||
return fileName;
|
||||
return FilenameUtils.getName(originalFileName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-7
@@ -44,6 +44,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.normalizeSpace;
|
||||
|
||||
/**
|
||||
* Multipart form data request adapter for Jakarta Commons Fileupload package.
|
||||
*/
|
||||
@@ -100,7 +102,7 @@ public class JakartaMultiPartRequest extends AbstractMultiPartRequest {
|
||||
protected void processUpload(HttpServletRequest request, String saveDir) throws FileUploadException, UnsupportedEncodingException {
|
||||
if (ServletFileUpload.isMultipartContent(request)) {
|
||||
for (FileItem item : parseRequest(request, saveDir)) {
|
||||
LOG.debug("Found file item: [{}]", sanitizeNewlines(item.getFieldName()));
|
||||
LOG.debug("Found file item: [{}]", normalizeSpace(item.getFieldName()));
|
||||
if (item.isFormField()) {
|
||||
processNormalFormField(item, request.getCharacterEncoding());
|
||||
} else {
|
||||
@@ -115,7 +117,7 @@ public class JakartaMultiPartRequest extends AbstractMultiPartRequest {
|
||||
|
||||
// Skip file uploads that don't have a file name - meaning that no file was selected.
|
||||
if (item.getName() == null || item.getName().trim().isEmpty()) {
|
||||
LOG.debug("No file has been uploaded for the field: {}", sanitizeNewlines(item.getFieldName()));
|
||||
LOG.debug("No file has been uploaded for the field: {}", normalizeSpace(item.getFieldName()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -143,7 +145,7 @@ public class JakartaMultiPartRequest extends AbstractMultiPartRequest {
|
||||
|
||||
long size = item.getSize();
|
||||
if (maxStringLength != null && size > maxStringLength) {
|
||||
LOG.debug("Form field {} of size {} bytes exceeds limit of {}.", sanitizeNewlines(item.getFieldName()), size, maxStringLength);
|
||||
LOG.debug("Form field [{}] of size [{}] bytes exceeds limit of [{}].", normalizeSpace(item.getFieldName()), size, maxStringLength);
|
||||
String errorKey = "struts.messages.upload.error.parameter.too.long";
|
||||
LocalizedMessage localizedMessage = new LocalizedMessage(this.getClass(), errorKey, null,
|
||||
new Object[]{item.getFieldName(), maxStringLength, size});
|
||||
@@ -359,7 +361,7 @@ public class JakartaMultiPartRequest extends AbstractMultiPartRequest {
|
||||
for (String name : names) {
|
||||
List<FileItem> items = files.get(name);
|
||||
for (FileItem item : items) {
|
||||
LOG.debug("Removing file {} {}", name, item);
|
||||
LOG.debug("Removing file [{}]", normalizeSpace(name));
|
||||
if (!item.isInMemory()) {
|
||||
item.delete();
|
||||
}
|
||||
@@ -367,7 +369,4 @@ public class JakartaMultiPartRequest extends AbstractMultiPartRequest {
|
||||
}
|
||||
}
|
||||
|
||||
private String sanitizeNewlines(String before) {
|
||||
return before.replaceAll("[\n\r]", "_");
|
||||
}
|
||||
}
|
||||
|
||||
+9
-7
@@ -45,6 +45,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.normalizeSpace;
|
||||
|
||||
/**
|
||||
* Multi-part form data request adapter for Jakarta Commons FileUpload package that
|
||||
* leverages the streaming API rather than the traditional non-streaming API.
|
||||
@@ -77,7 +79,7 @@ public class JakartaStreamMultiPartRequest extends AbstractMultiPartRequest {
|
||||
File file = fileInfo.getFile();
|
||||
LOG.debug("Deleting file '{}'.", file.getName());
|
||||
if (!file.delete()) {
|
||||
LOG.warn("There was a problem attempting to delete file '{}'.", file.getName());
|
||||
LOG.warn("There was a problem attempting to delete file [{}].", file.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -252,7 +254,7 @@ public class JakartaStreamMultiPartRequest extends AbstractMultiPartRequest {
|
||||
// prevent processing file field item if request size not allowed.
|
||||
if (!requestSizePermitted) {
|
||||
addFileSkippedError(itemStream.getName(), request);
|
||||
LOG.debug("Skipped stream '{}', request maximum size ({}) exceeded.", itemStream.getName(), maxSize);
|
||||
LOG.debug("Skipped stream [{}], request maximum size ({}) exceeded.", normalizeSpace(itemStream.getName()), maxSize);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -296,7 +298,7 @@ public class JakartaStreamMultiPartRequest extends AbstractMultiPartRequest {
|
||||
* @param request the servlet request
|
||||
*/
|
||||
protected void addFileSkippedError(String fileName, HttpServletRequest request) {
|
||||
String exceptionMessage = "Skipped file " + fileName + "; request size limit exceeded.";
|
||||
String exceptionMessage = "Skipped file " + normalizeSpace(fileName) + "; request size limit exceeded.";
|
||||
long allowedMaxSize = maxSize != null ? maxSize : -1;
|
||||
FileSizeLimitExceededException exception = new FileUploadBase.FileSizeLimitExceededException(exceptionMessage, getRequestSize(request), allowedMaxSize);
|
||||
LocalizedMessage message = buildErrorMessage(exception, new Object[]{fileName, getRequestSize(request), allowedMaxSize});
|
||||
@@ -323,7 +325,7 @@ public class JakartaStreamMultiPartRequest extends AbstractMultiPartRequest {
|
||||
}
|
||||
values.add(fieldValue);
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Failed to handle form field '{}'.", fieldName, e);
|
||||
LOG.warn("Failed to handle form field [{}]", normalizeSpace(fieldName), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,7 +338,7 @@ public class JakartaStreamMultiPartRequest extends AbstractMultiPartRequest {
|
||||
protected void processFileItemStreamAsFileField(FileItemStream itemStream, String location) {
|
||||
// Skip file uploads that don't have a file name - meaning that no file was selected.
|
||||
if (itemStream.getName() == null || itemStream.getName().trim().isEmpty()) {
|
||||
LOG.debug("No file has been uploaded for the field: {}", itemStream.getFieldName());
|
||||
LOG.debug("No file has been uploaded for the field: {}", normalizeSpace(itemStream.getFieldName()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -353,7 +355,7 @@ public class JakartaStreamMultiPartRequest extends AbstractMultiPartRequest {
|
||||
try {
|
||||
file.delete();
|
||||
} catch (SecurityException se) {
|
||||
LOG.warn("Failed to delete '{}' due to security exception above.", file.getName(), se);
|
||||
LOG.warn("Failed to delete [{}] due to security exception above.", normalizeSpace(file.getName()), se);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -385,7 +387,7 @@ public class JakartaStreamMultiPartRequest extends AbstractMultiPartRequest {
|
||||
}
|
||||
|
||||
File file = File.createTempFile(prefix + "_", suffix, new File(location));
|
||||
LOG.debug("Creating temporary file '{}' (originally '{}').", file.getName(), fileName);
|
||||
LOG.debug("Creating temporary file [{}] (originally [{}]).", file.getName(), normalizeSpace(fileName));
|
||||
return file;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ import org.apache.struts2.dispatcher.AttributeMap;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.jsp.PageContext;
|
||||
|
||||
import static org.apache.struts2.dispatcher.DispatcherConstants.ATTRIBUTES;
|
||||
|
||||
public class TagUtils {
|
||||
|
||||
private static final Logger LOG = LogManager.getLogger(TagUtils.class);
|
||||
@@ -46,8 +48,8 @@ public class TagUtils {
|
||||
} else {
|
||||
LOG.trace("Adds the current PageContext to ActionContext");
|
||||
stack.getActionContext()
|
||||
.withPageContext(pageContext)
|
||||
.with("attr", new AttributeMap(stack.getContext()));
|
||||
.withPageContext(pageContext)
|
||||
.with(ATTRIBUTES, new AttributeMap(stack.getContext()));
|
||||
}
|
||||
|
||||
return stack;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
<constant name="struts.excludedClasses"
|
||||
value="
|
||||
com.opensymphony.xwork2.ActionContext,
|
||||
org.apache.struts2.ActionContext,
|
||||
java.lang.Class,
|
||||
java.lang.ClassLoader,
|
||||
java.lang.InheritableThreadLocal,
|
||||
@@ -75,10 +76,15 @@
|
||||
value="
|
||||
antlr.build,
|
||||
com.opensymphony.xwork2.config,
|
||||
org.apache.struts2.config,
|
||||
com.opensymphony.xwork2.inject,
|
||||
org.apache.struts2.inject,
|
||||
com.opensymphony.xwork2.ognl,
|
||||
org.apache.struts2.ognl,
|
||||
com.opensymphony.xwork2.security,
|
||||
org.apache.struts2.security,
|
||||
com.opensymphony.xwork2.util,
|
||||
org.apache.struts2.util,
|
||||
freemarker.core,
|
||||
freemarker.ext.jsp,
|
||||
freemarker.ext.rhino,
|
||||
@@ -108,10 +114,15 @@
|
||||
value="
|
||||
antlr.build,
|
||||
com.opensymphony.xwork2.config,
|
||||
org.apache.struts2.config,
|
||||
com.opensymphony.xwork2.inject,
|
||||
org.apache.struts2.inject,
|
||||
com.opensymphony.xwork2.ognl,
|
||||
org.apache.struts2.ognl,
|
||||
com.opensymphony.xwork2.security,
|
||||
org.apache.struts2.security,
|
||||
com.opensymphony.xwork2.util,
|
||||
org.apache.struts2.util,
|
||||
freemarker.core,
|
||||
freemarker.ext.jsp,
|
||||
freemarker.ext.rhino,
|
||||
|
||||
@@ -165,14 +165,6 @@
|
||||
<td class="tag-attribute">String</td>
|
||||
<td class="tag-attribute">Set the value used to retrieve the option value.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tag-attribute">maxLength</td>
|
||||
<td class="tag-attribute">false</td>
|
||||
<td class="tag-attribute"></td>
|
||||
<td class="tag-attribute">false</td>
|
||||
<td class="tag-attribute">Integer</td>
|
||||
<td class="tag-attribute">Deprecated. Use maxlength instead.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tag-attribute">maxlength</td>
|
||||
<td class="tag-attribute">false</td>
|
||||
|
||||
@@ -117,14 +117,6 @@
|
||||
<td class="tag-attribute">String</td>
|
||||
<td class="tag-attribute">String that will be appended to the label</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tag-attribute">maxLength</td>
|
||||
<td class="tag-attribute">false</td>
|
||||
<td class="tag-attribute"></td>
|
||||
<td class="tag-attribute">false</td>
|
||||
<td class="tag-attribute">Integer</td>
|
||||
<td class="tag-attribute">Deprecated. Use maxlength instead.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tag-attribute">maxlength</td>
|
||||
<td class="tag-attribute">false</td>
|
||||
|
||||
@@ -117,14 +117,6 @@
|
||||
<td class="tag-attribute">String</td>
|
||||
<td class="tag-attribute">String that will be appended to the label</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tag-attribute">maxLength</td>
|
||||
<td class="tag-attribute">false</td>
|
||||
<td class="tag-attribute"></td>
|
||||
<td class="tag-attribute">false</td>
|
||||
<td class="tag-attribute">Integer</td>
|
||||
<td class="tag-attribute">Deprecated. Use maxlength instead.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tag-attribute">maxlength</td>
|
||||
<td class="tag-attribute">false</td>
|
||||
|
||||
@@ -28,7 +28,9 @@ import java.util.concurrent.Callable;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
@@ -49,6 +51,7 @@ public class ContainerImplTest {
|
||||
ContainerBuilder cb = new ContainerBuilder();
|
||||
cb.constant("methodCheck.name", "Lukasz");
|
||||
cb.constant("fieldCheck.name", "Lukasz");
|
||||
cb.constant("constructorCheck.name", "Lukasz");
|
||||
cb.factory(EarlyInitializable.class, EarlyInitializableBean.class, Scope.SINGLETON);
|
||||
cb.factory(Initializable.class, InitializableBean.class, Scope.SINGLETON);
|
||||
cb.factory(EarlyInitializable.class, "prototypeEarlyInitializable", EarlyInitializableBean.class, Scope.PROTOTYPE);
|
||||
@@ -65,15 +68,43 @@ public class ContainerImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fieldInjector() throws Exception {
|
||||
public void fieldInjector() {
|
||||
FieldCheck fieldCheck = new FieldCheck();
|
||||
c.inject(fieldCheck);
|
||||
assertEquals(fieldCheck.getName(), "Lukasz");
|
||||
assertEquals("Lukasz", fieldCheck.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void methodInjector() throws Exception {
|
||||
c.inject(new MethodCheck());
|
||||
public void methodInjector() {
|
||||
MethodCheck methodCheck = new MethodCheck();
|
||||
c.inject(methodCheck);
|
||||
assertEquals("Lukasz", methodCheck.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorInjector() {
|
||||
ConstructorCheck constructorCheck = c.inject(ConstructorCheck.class);
|
||||
assertEquals("Lukasz", constructorCheck.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void optionalConstructorInjector() {
|
||||
OptionalConstructorCheck constructorCheck = c.inject(OptionalConstructorCheck.class);
|
||||
assertNull(constructorCheck.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void requiredOptionalConstructorInjector() {
|
||||
RequiredOptionalConstructorCheck constructorCheck = c.inject(RequiredOptionalConstructorCheck.class);
|
||||
assertNotNull(constructorCheck.getExistingName());
|
||||
assertNull(constructorCheck.getNonExitingName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void optionalRequiredConstructorInjector() {
|
||||
OptionalRequiredConstructorCheck constructorCheck = c.inject(OptionalRequiredConstructorCheck.class);
|
||||
assertNull(constructorCheck.getNonExitingName());
|
||||
assertNotNull(constructorCheck.getExistingName());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +123,7 @@ public class ContainerImplTest {
|
||||
* Inject values into method under SecurityManager
|
||||
*/
|
||||
@Test
|
||||
public void testMethodInjectorWithSecurityEnabled() throws Exception {
|
||||
public void testMethodInjectorWithSecurityEnabled() {
|
||||
assumeTrue(SystemUtils.isJavaVersionAtMost(JavaVersion.JAVA_20));
|
||||
System.setSecurityManager(new TestSecurityManager());
|
||||
assertThrows(DependencyException.class, () -> c.inject(new MethodCheck()));
|
||||
@@ -101,7 +132,7 @@ public class ContainerImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEarlyInitializable() throws Exception {
|
||||
public void testEarlyInitializable() {
|
||||
assertTrue("should being initialized already", EarlyInitializableBean.initializedEarly);
|
||||
|
||||
EarlyInitializableCheck earlyInitializableCheck = new EarlyInitializableCheck();
|
||||
@@ -148,22 +179,19 @@ public class ContainerImplTest {
|
||||
|
||||
final InitializableCheck initializableCheck3 = new InitializableCheck();
|
||||
final TestScopeStrategy testScopeStrategy = new TestScopeStrategy();
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ContainerBuilder cb2 = new ContainerBuilder();
|
||||
cb2.factory(EarlyInitializable.class, EarlyInitializableBean.class, Scope.SINGLETON);
|
||||
cb2.factory(Initializable.class, InitializableBean.class, Scope.SINGLETON);
|
||||
cb2.factory(EarlyInitializable.class, "prototypeEarlyInitializable", EarlyInitializableBean.class, Scope.PROTOTYPE);
|
||||
cb2.factory(Initializable.class, "prototypeInitializable", InitializableBean.class, Scope.PROTOTYPE);
|
||||
cb2.factory(Initializable.class, "requestInitializable", InitializableBean.class, Scope.REQUEST);
|
||||
cb2.factory(Initializable.class, "sessionInitializable", InitializableBean.class, Scope.SESSION);
|
||||
cb2.factory(Initializable.class, "threadInitializable", InitializableBean.class, Scope.THREAD);
|
||||
cb2.factory(Initializable.class, "wizardInitializable", InitializableBean.class, Scope.WIZARD);
|
||||
Container c2 = cb2.create(false);
|
||||
c2.setScopeStrategy(testScopeStrategy);
|
||||
c2.inject(initializableCheck3);
|
||||
}
|
||||
Thread thread = new Thread(() -> {
|
||||
ContainerBuilder cb2 = new ContainerBuilder();
|
||||
cb2.factory(EarlyInitializable.class, EarlyInitializableBean.class, Scope.SINGLETON);
|
||||
cb2.factory(Initializable.class, InitializableBean.class, Scope.SINGLETON);
|
||||
cb2.factory(EarlyInitializable.class, "prototypeEarlyInitializable", EarlyInitializableBean.class, Scope.PROTOTYPE);
|
||||
cb2.factory(Initializable.class, "prototypeInitializable", InitializableBean.class, Scope.PROTOTYPE);
|
||||
cb2.factory(Initializable.class, "requestInitializable", InitializableBean.class, Scope.REQUEST);
|
||||
cb2.factory(Initializable.class, "sessionInitializable", InitializableBean.class, Scope.SESSION);
|
||||
cb2.factory(Initializable.class, "threadInitializable", InitializableBean.class, Scope.THREAD);
|
||||
cb2.factory(Initializable.class, "wizardInitializable", InitializableBean.class, Scope.WIZARD);
|
||||
Container c2 = cb2.create(false);
|
||||
c2.setScopeStrategy(testScopeStrategy);
|
||||
c2.inject(initializableCheck3);
|
||||
});
|
||||
thread.run();
|
||||
thread.join();
|
||||
@@ -205,6 +233,76 @@ public class ContainerImplTest {
|
||||
|
||||
}
|
||||
|
||||
public static class ConstructorCheck {
|
||||
private String name;
|
||||
|
||||
@Inject("constructorCheck.name")
|
||||
public ConstructorCheck(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
public static class OptionalConstructorCheck {
|
||||
private String name;
|
||||
|
||||
@Inject(value = "nonExistingConstant", required = false)
|
||||
public OptionalConstructorCheck(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
public static class RequiredOptionalConstructorCheck {
|
||||
private final String existingName;
|
||||
private final String nonExitingName;
|
||||
|
||||
@Inject(required = false)
|
||||
public RequiredOptionalConstructorCheck(
|
||||
@Inject("constructorCheck.name") String existingName,
|
||||
@Inject(value = "nonExistingConstant", required = false) String nonExitingName
|
||||
) {
|
||||
this.existingName = existingName;
|
||||
this.nonExitingName = nonExitingName;
|
||||
}
|
||||
|
||||
public String getExistingName() {
|
||||
return existingName;
|
||||
}
|
||||
|
||||
public String getNonExitingName() {
|
||||
return nonExitingName;
|
||||
}
|
||||
}
|
||||
|
||||
public static class OptionalRequiredConstructorCheck {
|
||||
private final String existingName;
|
||||
private final String nonExitingName;
|
||||
|
||||
@Inject(required = false)
|
||||
public OptionalRequiredConstructorCheck(
|
||||
@Inject(value = "nonExistingConstant", required = false) String nonExitingName,
|
||||
@Inject("constructorCheck.name") String existingName
|
||||
) {
|
||||
this.existingName = existingName;
|
||||
this.nonExitingName = nonExitingName;
|
||||
}
|
||||
|
||||
public String getExistingName() {
|
||||
return existingName;
|
||||
}
|
||||
|
||||
public String getNonExitingName() {
|
||||
return nonExitingName;
|
||||
}
|
||||
}
|
||||
|
||||
class InitializableCheck {
|
||||
|
||||
private Initializable initializable;
|
||||
|
||||
@@ -1233,6 +1233,34 @@ public class OgnlValueStackTest extends XWorkTestCase {
|
||||
assertNull("accessed private field (result not null) ?", accessedValue);
|
||||
}
|
||||
|
||||
public void testFindValueWithConstructorAndProxyChecks() {
|
||||
Map<String, String> properties = new HashMap<>();
|
||||
properties.put(StrutsConstants.STRUTS_DISALLOW_PROXY_OBJECT_ACCESS, Boolean.TRUE.toString());
|
||||
properties.put(StrutsConstants.STRUTS_DISALLOW_PROXY_MEMBER_ACCESS, Boolean.TRUE.toString());
|
||||
loadButSet(properties);
|
||||
refreshContainerFields();
|
||||
|
||||
String value = "test";
|
||||
String ognlResult = (String) vs.findValue(
|
||||
"new com.opensymphony.xwork2.ognl.OgnlValueStackTest$ValueHolder('" + value + "').value", String.class);
|
||||
|
||||
assertEquals(value, ognlResult);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unused"})
|
||||
public static class ValueHolder {
|
||||
// See testFindValueWithConstructorAndProxyChecks
|
||||
private final String value;
|
||||
|
||||
public ValueHolder(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
static class BadJavaBean {
|
||||
private int count;
|
||||
private int count2;
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ public class DefaultExcludedPatternsCheckerTest extends XWorkTestCase {
|
||||
|
||||
public void testDefaultExcludePatterns() throws Exception {
|
||||
// given
|
||||
List<String> prefixes = Arrays.asList("#[0].%s", "[0].%s", "top.%s", "%{[0].%s}", "%{#[0].%s}", "%{top.%s}", "%{#top.%s}", "%{#%s}", "%{%s}", "#%s");
|
||||
List<String> prefixes = Arrays.asList("#[0].%s", "[0].%s", "top.%s", "%{[0].%s}", "%{#[0].%s}", "%{top.%s}", "%{#top.%s}", "%{#%s}", "%{%s}", "#%s", "top.param", "top.request");
|
||||
List<String> inners = Arrays.asList("servletRequest", "servletResponse", "servletContext", "application", "session", "struts", "request", "response", "dojo", "parameters");
|
||||
List<String> suffixes = Arrays.asList("['test']", "[\"test\"]", ".test");
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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 com.opensymphony.xwork2.test;
|
||||
|
||||
public class StrutsUtilBean {
|
||||
|
||||
public String getMyString() {
|
||||
return "myString";
|
||||
}
|
||||
|
||||
public boolean getMyBoolean(boolean bool) {
|
||||
return bool;
|
||||
}
|
||||
|
||||
public String getFoo() {
|
||||
return "bar";
|
||||
}
|
||||
|
||||
public String getBarExpression() {
|
||||
return "%{bar}";
|
||||
}
|
||||
|
||||
public String getBar() {
|
||||
return "bar";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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.components;
|
||||
|
||||
import org.apache.struts2.ActionContext;
|
||||
import org.apache.struts2.dispatcher.DispatcherConstants;
|
||||
import org.apache.struts2.views.jsp.AbstractTagTest;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static org.apache.struts2.components.UIBean.TEMPLATE_DIR;
|
||||
import static org.apache.struts2.components.UIBean.THEME;
|
||||
|
||||
public class UIBeanTagTest extends AbstractTagTest {
|
||||
|
||||
private UIBean bean;
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
bean = new UIBean(stack, request, response) {
|
||||
@Override
|
||||
protected String getDefaultTemplate() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void testTemplateDir_ognlExpression() {
|
||||
bean.setTemplateDir("%{testDir}");
|
||||
stack.push(new Object() {
|
||||
public String getTestDir() {
|
||||
return "testValue";
|
||||
}
|
||||
});
|
||||
|
||||
assertEquals("testValue", bean.getTemplateDir());
|
||||
}
|
||||
|
||||
public void testTemplateDir_attrMapFallback() {
|
||||
ActionContext.of(context).getApplication().put(TEMPLATE_DIR, "applicationValue");
|
||||
assertEquals("applicationValue", bean.getTemplateDir());
|
||||
|
||||
ActionContext.of(context).getSession().put(TEMPLATE_DIR, "sessionValue");
|
||||
assertEquals("sessionValue", bean.getTemplateDir());
|
||||
|
||||
((Map<String, Object>) context.get(DispatcherConstants.REQUEST)).put(TEMPLATE_DIR, "requestValue");
|
||||
assertEquals("requestValue", bean.getTemplateDir());
|
||||
}
|
||||
|
||||
public void testTheme_ognlExpression() {
|
||||
bean.setTheme("%{testTheme}");
|
||||
stack.push(new Object() {
|
||||
public String getTestTheme() {
|
||||
return "testValue";
|
||||
}
|
||||
});
|
||||
|
||||
assertEquals("testValue", bean.getTheme());
|
||||
}
|
||||
|
||||
public void testTheme_attrMapFallback() {
|
||||
ActionContext.of(context).getApplication().put(THEME, "applicationValue");
|
||||
assertEquals("applicationValue", bean.getTheme());
|
||||
|
||||
ActionContext.of(context).getSession().put(THEME, "sessionValue");
|
||||
assertEquals("sessionValue", bean.getTheme());
|
||||
|
||||
((Map<String, Object>) context.get(DispatcherConstants.REQUEST)).put(THEME, "requestValue");
|
||||
assertEquals("requestValue", bean.getTheme());
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,11 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class AttributeMapTest {
|
||||
|
||||
@@ -360,4 +365,21 @@ public class AttributeMapTest {
|
||||
assertEquals("value", value);
|
||||
}
|
||||
|
||||
}
|
||||
@Test
|
||||
public void get_whenPageContextHasNoRequest() {
|
||||
PageContext pageContext = mock(PageContext.class);
|
||||
when(pageContext.getRequest()).thenReturn(null);
|
||||
|
||||
HttpServletRequest req = new MockHttpServletRequest();
|
||||
req.setAttribute("attr", "reqValue");
|
||||
|
||||
AttributeMap attributeMap = new AttributeMap(new HashMap<String, Object>() {{
|
||||
put(StrutsStatics.PAGE_CONTEXT, pageContext);
|
||||
put(DispatcherConstants.REQUEST, new RequestMap(req));
|
||||
}});
|
||||
|
||||
assertEquals("reqValue", attributeMap.get("attr"));
|
||||
verify(pageContext, never()).findAttribute(anyString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -343,6 +343,9 @@ public class DispatcherTest extends StrutsJUnit4InternalTestCase {
|
||||
|
||||
req.setContentType("Multipart/Form-Data ; boundary=---------------------------207103069210263;charset=UTF-16LE");
|
||||
assertTrue(dispatcher.isMultipartRequest(req));
|
||||
|
||||
req.setContentType("multipart/form-data; boundary=\"----=_Part_38_1092302434.1734807780737\"");
|
||||
assertTrue(dispatcher.isMultipartRequest(req));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-3
@@ -672,7 +672,7 @@ public class ActionFileUploadInterceptorTest extends StrutsInternalTestCase {
|
||||
"file" +
|
||||
"\"; filename=\"" +
|
||||
filename +
|
||||
"\r\n" +
|
||||
"\"\r\n" +
|
||||
"Content-Type: " +
|
||||
contentType +
|
||||
"\r\n" +
|
||||
@@ -697,7 +697,6 @@ public class ActionFileUploadInterceptorTest extends StrutsInternalTestCase {
|
||||
}
|
||||
|
||||
private MultiPartRequestWrapper createMultipartRequest(HttpServletRequest req, int maxsize, int maxfilesize, int maxfiles, int maxStringLength) {
|
||||
|
||||
JakartaMultiPartRequest jak = new JakartaMultiPartRequest();
|
||||
jak.setMaxSize(String.valueOf(maxsize));
|
||||
jak.setMaxFileSize(String.valueOf(maxfilesize));
|
||||
@@ -707,7 +706,6 @@ public class ActionFileUploadInterceptorTest extends StrutsInternalTestCase {
|
||||
}
|
||||
|
||||
private MultiPartRequestWrapper createMultipartRequestNoMaxParamsSet(HttpServletRequest req) {
|
||||
|
||||
JakartaMultiPartRequest jak = new JakartaMultiPartRequest();
|
||||
return new MultiPartRequestWrapper(jak, req, tempDir.getAbsolutePath(), new DefaultLocaleProvider());
|
||||
}
|
||||
|
||||
@@ -736,7 +736,7 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase {
|
||||
"file" +
|
||||
"\"; filename=\"" +
|
||||
filename +
|
||||
"\r\n" +
|
||||
"\"\r\n" +
|
||||
"Content-Type: " +
|
||||
contentType +
|
||||
"\r\n" +
|
||||
@@ -761,18 +761,18 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase {
|
||||
}
|
||||
|
||||
private MultiPartRequestWrapper createMultipartRequest(HttpServletRequest req, int maxsize, int maxfilesize, int maxfiles, int maxStringLength) {
|
||||
|
||||
JakartaMultiPartRequest jak = new JakartaMultiPartRequest();
|
||||
jak.setMaxSize(String.valueOf(maxsize));
|
||||
jak.setMaxFileSize(String.valueOf(maxfilesize));
|
||||
jak.setMaxFiles(String.valueOf(maxfiles));
|
||||
jak.setMaxStringLength(String.valueOf(maxStringLength));
|
||||
|
||||
return new MultiPartRequestWrapper(jak, req, tempDir.getAbsolutePath(), new DefaultLocaleProvider());
|
||||
}
|
||||
|
||||
private MultiPartRequestWrapper createMultipartRequestNoMaxParamsSet(HttpServletRequest req) {
|
||||
|
||||
JakartaMultiPartRequest jak = new JakartaMultiPartRequest();
|
||||
|
||||
return new MultiPartRequestWrapper(jak, req, tempDir.getAbsolutePath(), new DefaultLocaleProvider());
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -116,9 +116,9 @@ public class ParametersInterceptorTest extends XWorkTestCase {
|
||||
pi.setParameters(action, vs, HttpParameters.create(params).build());
|
||||
|
||||
// then
|
||||
assertEquals(3, action.getActionErrors().size());
|
||||
assertEquals(3, action.getActionMessages().size());
|
||||
|
||||
List<String> actionErrors = new ArrayList<>(action.getActionErrors());
|
||||
List<String> actionErrors = new ArrayList<>(action.getActionMessages());
|
||||
|
||||
String msg1 = actionErrors.get(0);
|
||||
String msg2 = actionErrors.get(1);
|
||||
@@ -203,9 +203,9 @@ public class ParametersInterceptorTest extends XWorkTestCase {
|
||||
pi.setParameters(action, vs, HttpParameters.create(params).build());
|
||||
|
||||
// then
|
||||
assertEquals(3, action.getActionErrors().size());
|
||||
assertEquals(3, action.getActionMessages().size());
|
||||
|
||||
List<String> actionErrors = new ArrayList<>(action.getActionErrors());
|
||||
List<String> actionErrors = new ArrayList<>(action.getActionMessages());
|
||||
String msg1 = actionErrors.get(0);
|
||||
String msg2 = actionErrors.get(1);
|
||||
String msg3 = actionErrors.get(2);
|
||||
@@ -585,7 +585,7 @@ public class ParametersInterceptorTest extends XWorkTestCase {
|
||||
container.inject(config.getInterceptors().get(0).getInterceptor());
|
||||
ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME, null, extraContext.getContextMap());
|
||||
proxy.execute();
|
||||
final String actionError = "" + ((SimpleAction) proxy.getAction()).getActionErrors().toArray()[0];
|
||||
final String actionError = "" + ((SimpleAction) proxy.getAction()).getActionMessages().toArray()[0];
|
||||
assertTrue(actionError.contains("Error setting expression 'not_a_property' with value 'There is no action property named like this'"));
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package org.apache.struts2.util;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.test.StrutsUtilBean;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
import org.apache.struts2.TestAction;
|
||||
@@ -37,7 +38,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Test case for StrutsUtil.
|
||||
*
|
||||
*/
|
||||
public class StrutsUtilTest extends StrutsInternalTestCase {
|
||||
|
||||
@@ -53,14 +53,7 @@ public class StrutsUtilTest extends StrutsInternalTestCase {
|
||||
}
|
||||
|
||||
public void testIsTrueMethod() {
|
||||
stack.push(new Object() {
|
||||
public String getMyString() {
|
||||
return "myString";
|
||||
}
|
||||
public boolean getMyBoolean(boolean bool) {
|
||||
return bool;
|
||||
}
|
||||
});
|
||||
stack.push(new StrutsUtilBean());
|
||||
assertTrue(strutsUtil.isTrue("myString == 'myString'"));
|
||||
assertFalse(strutsUtil.isTrue("myString == 'myOtherString'"));
|
||||
assertTrue(strutsUtil.isTrue("getMyBoolean(true)"));
|
||||
@@ -68,14 +61,7 @@ public class StrutsUtilTest extends StrutsInternalTestCase {
|
||||
}
|
||||
|
||||
public void testFindStringMethod() {
|
||||
stack.push(new Object() {
|
||||
public String getMyString() {
|
||||
return "myString";
|
||||
}
|
||||
public boolean getMyBoolean(boolean bool) {
|
||||
return bool;
|
||||
}
|
||||
});
|
||||
stack.push(new StrutsUtilBean());
|
||||
|
||||
assertEquals(strutsUtil.findString("myString"), "myString");
|
||||
assertNull(strutsUtil.findString("myOtherString"));
|
||||
@@ -105,14 +91,7 @@ public class StrutsUtilTest extends StrutsInternalTestCase {
|
||||
|
||||
|
||||
public void testFindValueMethod() throws Exception {
|
||||
stack.push(new Object() {
|
||||
public String getMyString() {
|
||||
return "myString";
|
||||
}
|
||||
public boolean getMyBoolean(boolean bool) {
|
||||
return bool;
|
||||
}
|
||||
});
|
||||
stack.push(new StrutsUtilBean());
|
||||
Object obj1 = strutsUtil.findValue("myString", "java.lang.String");
|
||||
Object obj2 = strutsUtil.findValue("getMyBoolean(true)", "java.lang.Boolean");
|
||||
|
||||
@@ -125,7 +104,6 @@ public class StrutsUtilTest extends StrutsInternalTestCase {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void testGetTextMethod() {
|
||||
// this should be in xwork-messages.properties (included by default
|
||||
// by LocalizedTextUtil
|
||||
@@ -233,11 +211,7 @@ public class StrutsUtilTest extends StrutsInternalTestCase {
|
||||
}
|
||||
|
||||
public void testTranslateVariables() {
|
||||
stack.push(new Object() {
|
||||
public String getFoo() {
|
||||
return "bar";
|
||||
}
|
||||
});
|
||||
stack.push(new StrutsUtilBean());
|
||||
String obj1 = strutsUtil.translateVariables("try: %{foo}");
|
||||
|
||||
assertNotNull(obj1);
|
||||
@@ -245,15 +219,8 @@ public class StrutsUtilTest extends StrutsInternalTestCase {
|
||||
}
|
||||
|
||||
public void testTranslateVariablesRecursion() {
|
||||
stack.push(new Object() {
|
||||
public String getFoo() {
|
||||
return "%{bar}";
|
||||
}
|
||||
public String getBar() {
|
||||
return "bar";
|
||||
}
|
||||
});
|
||||
String obj1 = strutsUtil.translateVariables("try: %{foo}");
|
||||
stack.push(new StrutsUtilBean());
|
||||
String obj1 = strutsUtil.translateVariables("try: %{barExpression}");
|
||||
|
||||
assertNotNull(obj1);
|
||||
assertEquals("try: %{bar}", obj1);
|
||||
@@ -277,12 +244,10 @@ public class StrutsUtilTest extends StrutsInternalTestCase {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// === internal class to assist in testing
|
||||
|
||||
protected static class InternalMockHttpServletRequest extends MockHttpServletRequest {
|
||||
InternalMockRequestDispatcher dispatcher = null;
|
||||
|
||||
public RequestDispatcher getRequestDispatcher(String path) {
|
||||
dispatcher = new InternalMockRequestDispatcher(path);
|
||||
return dispatcher;
|
||||
@@ -296,10 +261,12 @@ public class StrutsUtilTest extends StrutsInternalTestCase {
|
||||
protected static class InternalMockRequestDispatcher extends MockRequestDispatcher {
|
||||
private final String url;
|
||||
boolean included = false;
|
||||
|
||||
public InternalMockRequestDispatcher(String url) {
|
||||
super(url);
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public void include(ServletRequest servletRequest, ServletResponse servletResponse) {
|
||||
if (servletResponse instanceof MockHttpServletResponse) {
|
||||
((MockHttpServletResponse) servletResponse).setIncludedUrl(this.url);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-async-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-cdi-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-config-browser-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-convention-plugin</artifactId>
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-dwr-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-embeddedjsp-plugin</artifactId>
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-gxp-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-jasperreports-plugin</artifactId>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-javatemplates-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-jfreechart-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-json-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-junit-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-osgi-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-oval-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-pell-multipart-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-plexus-plugin</artifactId>
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-portlet-junit-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-portlet-mocks-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-portlet-tiles-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-portlet-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-rest-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-sitemesh-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-spring-plugin</artifactId>
|
||||
|
||||
+88
@@ -31,6 +31,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class SecurityMemberAccessProxyTest extends XWorkJUnit4TestCase {
|
||||
@@ -87,4 +88,91 @@ public class SecurityMemberAccessProxyTest extends XWorkJUnit4TestCase {
|
||||
assertTrue(sma.isAccessible(context, proxy.getAction(), proxyObjectProxyMember, ""));
|
||||
assertTrue(sma.isAccessible(context, proxy.getAction(), proxyObjectNonProxyMember, ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullTargetAndTargetAndMemberNotAllowed() {
|
||||
sma.useDisallowProxyObjectAccess(Boolean.TRUE.toString());
|
||||
sma.useDisallowProxyMemberAccess(Boolean.TRUE.toString());
|
||||
assertTrue(sma.isAccessible(context, null, proxyObjectProxyMember, ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullTargetAndTargetAllowedAndMemberNotAllowed() {
|
||||
sma.useDisallowProxyObjectAccess(Boolean.FALSE.toString());
|
||||
sma.useDisallowProxyMemberAccess(Boolean.TRUE.toString());
|
||||
assertTrue(sma.isAccessible(context, null, proxyObjectProxyMember, ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullTargetAndTargetAndMemberAllowed() {
|
||||
sma.useDisallowProxyObjectAccess(Boolean.FALSE.toString());
|
||||
sma.useDisallowProxyMemberAccess(Boolean.FALSE.toString());
|
||||
assertTrue(sma.isAccessible(context, null, proxyObjectProxyMember, ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullMemberAndTargetAndMemberNotAllowed() {
|
||||
sma.useDisallowProxyObjectAccess(Boolean.TRUE.toString());
|
||||
sma.useDisallowProxyMemberAccess(Boolean.TRUE.toString());
|
||||
Object action = proxy.getAction();
|
||||
assertThrows("Member cannot be null!", IllegalArgumentException.class,
|
||||
() -> sma.isAccessible(context, action, null, ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullMemberAndTargetAllowedAndMemberNotAllowed() {
|
||||
sma.useDisallowProxyObjectAccess(Boolean.FALSE.toString());
|
||||
sma.useDisallowProxyMemberAccess(Boolean.TRUE.toString());
|
||||
Object action = proxy.getAction();
|
||||
assertThrows("Member cannot be null!", IllegalArgumentException.class,
|
||||
() -> sma.isAccessible(context, action, null, ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullMemberAndTargetNotAllowedAndMemberAllowed() {
|
||||
sma.useDisallowProxyObjectAccess(Boolean.TRUE.toString());
|
||||
sma.useDisallowProxyMemberAccess(Boolean.FALSE.toString());
|
||||
Object action = proxy.getAction();
|
||||
assertThrows("Member cannot be null!", IllegalArgumentException.class,
|
||||
() -> sma.isAccessible(context, action, null, ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullTargetAndMemberAndTargetAndMemberNotAllowed() {
|
||||
sma.useDisallowProxyObjectAccess(Boolean.TRUE.toString());
|
||||
sma.useDisallowProxyMemberAccess(Boolean.TRUE.toString());
|
||||
assertThrows("Member cannot be null!", IllegalArgumentException.class,
|
||||
() -> sma.isAccessible(context, null, null, ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullTargetAndMemberAndTargetNotAllowedAndMemberAllowed() {
|
||||
sma.useDisallowProxyObjectAccess(Boolean.TRUE.toString());
|
||||
sma.useDisallowProxyMemberAccess(Boolean.FALSE.toString());
|
||||
assertThrows("Member cannot be null!", IllegalArgumentException.class,
|
||||
() -> sma.isAccessible(context, null, null, ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullTargetAndMemberAndTargetAllowedAndMemberNotAllowed() {
|
||||
sma.useDisallowProxyObjectAccess(Boolean.FALSE.toString());
|
||||
sma.useDisallowProxyMemberAccess(Boolean.TRUE.toString());
|
||||
assertThrows("Member cannot be null!", IllegalArgumentException.class,
|
||||
() -> sma.isAccessible(context, null, null, ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullTargetAndMemberAndTargetAndMemberAllowed() {
|
||||
sma.useDisallowProxyObjectAccess(Boolean.FALSE.toString());
|
||||
sma.useDisallowProxyMemberAccess(Boolean.FALSE.toString());
|
||||
assertThrows("Member cannot be null!", IllegalArgumentException.class,
|
||||
() -> sma.isAccessible(context, null, null, ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullPropertyName() {
|
||||
sma.useDisallowProxyMemberAccess(Boolean.FALSE.toString());
|
||||
Object action = proxy.getAction();
|
||||
assertTrue(sma.isAccessible(context, action, proxyObjectProxyMember, null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,8 @@ public class SpringProxyUtilTest extends XWorkTestCase {
|
||||
}
|
||||
|
||||
public void testIsProxy() throws Exception {
|
||||
assertFalse(ProxyUtil.isProxy(null));
|
||||
|
||||
Object simpleAction = appContext.getBean("simple-action");
|
||||
assertFalse(ProxyUtil.isProxy(simpleAction));
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-testng-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-tiles-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-velocity-plugin</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-xslt-plugin</artifactId>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>6.7.0</version>
|
||||
<version>6.7.4</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Struts 2</name>
|
||||
<url>https://struts.apache.org/</url>
|
||||
@@ -51,7 +51,7 @@
|
||||
<connection>scm:git:https://gitbox.apache.org/repos/asf/struts.git</connection>
|
||||
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/struts.git</developerConnection>
|
||||
<url>https://github.com/apache/struts/</url>
|
||||
<tag>STRUTS_6_7_0</tag>
|
||||
<tag>STRUTS_6_7_4</tag>
|
||||
</scm>
|
||||
|
||||
<issueManagement>
|
||||
@@ -104,7 +104,7 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.build.outputTimestamp>2024-11-17T09:51:57Z</project.build.outputTimestamp>
|
||||
<project.build.outputTimestamp>2025-02-20T12:15:20Z</project.build.outputTimestamp>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
|
||||
@@ -183,6 +183,15 @@
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>jdk9plus</id>
|
||||
<activation>
|
||||
<jdk>[9,)</jdk>
|
||||
</activation>
|
||||
<properties>
|
||||
<maven.compiler.release>8</maven.compiler.release>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>jdk17</id>
|
||||
<activation>
|
||||
|
||||
Reference in New Issue
Block a user