Wildcard Mappings, Last one loses.
----------------------------------
Key: WW-3464
URL: https://issues.apache.org/jira/browse/WW-3464
Project: Struts 2
Issue Type: Bug
Components: XML Configuration
Affects Versions: 2.1.8.1
Environment: OS X 10.6.4, Java 5, Running from inside Netbeans using
embedded tomcat
Reporter: Robert M. Zigweid
Given the struts.xml snippet:
<action name="*" method="{1}" class="web.BaseView">
<result name="success" type="tiles">Welcome</result>
<result name="test" type="tiles">test</result>
</action>
<action name="Project*" method="{1}" class="web.ProjectView">
<result name="none" type="tiles">NoProject</result>
</action>
I generate the log results as follows:
20676 [http-8084-2] DEBUG
com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler
- Entering nullPropertyValue
[target=[com.opensymphony.xwork2.defaulttextprovi...@61b59919],
property=struts]
20682 [http-8084-2] DEBUG
com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler
- Entering nullPropertyValue
[target=[com.opensymphony.xwork2.defaulttextprovi...@61b59919],
property=struts]
20689 [http-8084-2] DEBUG com.opensymphony.xwork2.DefaultActionProxy -
Creating an DefaultActionProxy
for namespace / and action name ProjectStatus
20689 [http-8084-2] DEBUG com.opensymphony.xwork2.config.impl.AbstractMatcher
- Attempting
to match 'ProjectStatus' to a wildcard pattern, 3 available
20689 [http-8084-2] DEBUG com.opensymphony.xwork2.config.impl.AbstractMatcher
- Value matches
pattern '*'
20703 [http-8084-2] DEBUG com.opensymphony.xwork2.interceptor.I18nInterceptor
- intercept
'//ProjectStatus' {
20704 [http-8084-2] DEBUG com.opensymphony.xwork2.interceptor.I18nInterceptor
- applied invocation
context locale=en
20704 [http-8084-2] DEBUG com.opensymphony.xwork2.interceptor.I18nInterceptor
- before Locale=en
20735 [http-8084-2] DEBUG
com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler
- Entering nullPropertyValue [target=[web.basev...@55d7fc31,
com.opensymphony.xwork2.defaulttextprovi...@61b59919],
property=struts]
20765 [http-8084-2] DEBUG org.apache.struts2.interceptor.FileUploadInterceptor
- Bypassing
//ProjectStatus
20765 [http-8084-2] DEBUG
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor
- Setting static parameters {}
20767 [http-8084-2] DEBUG
com.opensymphony.xwork2.interceptor.ParametersInterceptor - Setting
params NONE
20767 [http-8084-2] DEBUG
com.opensymphony.xwork2.interceptor.ParametersInterceptor - Setting
params
As you can see the "*" is matched as opposed to "Project*", which seems to go
against the
'last one wins' as is described by the struts documentation on
http://struts.apache.org/2.1.8.1/docs/wildcard-mappings.html
Now, if I reverse the order of the actions in struts.xml I get the following
result:
13176 [http-8084-1] DEBUG
com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler
- Entering nullPropertyValue
[target=[com.opensymphony.xwork2.defaulttextprovi...@18a4edc4],
property=struts]
13176 [http-8084-1] DEBUG
com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler
- Entering nullPropertyValue
[target=[com.opensymphony.xwork2.defaulttextprovi...@18a4edc4],
property=struts]
13176 [http-8084-1] DEBUG com.opensymphony.xwork2.DefaultActionProxy -
Creating an DefaultActionProxy
for namespace / and action name ProjectStatus
13176 [http-8084-1] DEBUG com.opensymphony.xwork2.config.impl.AbstractMatcher
- Attempting
to match 'ProjectStatus' to a wildcard pattern, 3 available
13176 [http-8084-1] DEBUG com.opensymphony.xwork2.config.impl.AbstractMatcher
- Value matches
pattern 'Project*'
13177 [http-8084-1] DEBUG com.opensymphony.xwork2.interceptor.I18nInterceptor
- intercept
'//ProjectStatus' {
13177 [http-8084-1] DEBUG com.opensymphony.xwork2.interceptor.I18nInterceptor
- applied invocation
context locale=en
13177 [http-8084-1] DEBUG
com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler
- Entering nullPropertyValue [target=[web.projectv...@63ad6884,
com.opensymphony.xwork2.defaulttextprovi...@18a4edc4],
property=locale]
13177 [http-8084-1] DEBUG com.opensymphony.xwork2.interceptor.I18nInterceptor
- before Locale=null
13177 [http-8084-1] DEBUG
com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler
- Entering nullPropertyValue [target=[web.projectv...@63ad6884,
com.opensymphony.xwork2.defaulttextprovi...@18a4edc4],
property=struts]
13178 [http-8084-1] DEBUG org.apache.struts2.interceptor.FileUploadInterceptor
- Bypassing
//ProjectStatus
13178 [http-8084-1] DEBUG
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor
- Setting static parameters {}
13179 [http-8084-1] DEBUG
com.opensymphony.xwork2.interceptor.ParametersInterceptor - Setting
params NONE
13179 [http-8084-1] DEBUG
com.opensymphony.xwork2.interceptor.ParametersInterceptor - Setting
params
Here, the "Project*" action is being matched as opposed to "*" despite being
first.
I'm failing to see how 'last one wins'
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.