Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,14 @@ public static List<InterceptorMapping> constructInterceptorReference(Interceptor
throw new ConfigurationException("Unable to find interceptor class referenced by ref-name " + refName, location);
} else {
if (referencedConfig instanceof InterceptorConfig config) {
try {
Interceptor inter = objectFactory.buildInterceptor(config, refParams);
result.add(new InterceptorMapping(refName, inter, refParams));
} catch (ConfigurationException ex) {
LOG.warn(new ParameterizedMessage("Unable to load config class {} at {} probably due to a missing jar, which might be fine if you never plan to use the {} interceptor",
config.getClassName(), ex.getLocation(), config.getName()), ex);
}

Interceptor inter = objectFactory.buildInterceptor(config, refParams);
result.add(new InterceptorMapping(refName, inter, refParams));
} else if (referencedConfig instanceof InterceptorStackConfig stackConfig) {

if (refParams != null && !refParams.isEmpty()) {
result = constructParameterizedInterceptorReferences(interceptorLocator, stackConfig, refParams, objectFactory);
} else {
result.addAll(stackConfig.getInterceptors());
}

} else {
LOG.error("Got unexpected type for interceptor {}. Got {}", refName, referencedConfig);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

import org.apache.struts2.ActionContext;
import org.apache.struts2.XWorkTestCase;
import org.apache.struts2.config.DefaultPropertiesProvider;
import org.apache.struts2.config.RuntimeConfiguration;
import org.apache.struts2.config.StrutsBeanSelectionProvider;
import org.apache.struts2.config.entities.ActionConfig;
import org.apache.struts2.config.entities.InterceptorMapping;
import org.apache.struts2.config.entities.InterceptorStackConfig;
Expand Down Expand Up @@ -158,7 +160,7 @@ public void testSetExemptedPathsInjectionIndirectly() throws Exception {
// Ensure we're using the specific test configuration, not the default simple configuration.
XmlConfigurationProvider configurationProvider = new StrutsXmlConfigurationProvider("struts-testing.xml");
container.inject(configurationProvider);
loadConfigurationProviders(configurationProvider);
loadConfigurationProviders(configurationProvider, new DefaultPropertiesProvider(), new StrutsBeanSelectionProvider());

// The test configuration in "struts-testing.xml" should define a "default" package. That "default" package should contain a "defaultInterceptorStack" containing
// a "fetchMetadata" interceptor parameter "fetchMetadata.setExemptedPaths". If the parameter method injection is working correctly for the FetchMetadataInterceptor,
Expand Down