You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Robert M. Zigweid (JIRA)" <ji...@apache.org> on 2010/07/12 19:53:50 UTC
[jira] Created: (WW-3464) Wildcard Mappings, Last one loses.
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.DefaultTextProvider@61b59919],
property=struts]
20682 [http-8084-2] DEBUG com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler
- Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@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.BaseView@55d7fc31, com.opensymphony.xwork2.DefaultTextProvider@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.DefaultTextProvider@18a4edc4],
property=struts]
13176 [http-8084-1] DEBUG com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler
- Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@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.ProjectView@63ad6884, com.opensymphony.xwork2.DefaultTextProvider@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.ProjectView@63ad6884, com.opensymphony.xwork2.DefaultTextProvider@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.
[jira] Commented: (WW-3464) Wildcard Mappings, Last one loses.
Posted by "Maurizio Cucchiara (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12922809#action_12922809 ]
Maurizio Cucchiara commented on WW-3464:
----------------------------------------
There is an inconsistency between documentation and xwork behavior (in xwork first match take precedence).
So there are three ways to address the issue:
1. modify documentation
2. adapt xwork behavior (highly discouraged)
3. insert a new struts constant that allows both behavior: first match take precedence, last match take precedence (default, as is the current policy). (is it really worth while to insert a new constant?)
What do you guys think about it?
> 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.DefaultTextProvider@61b59919],
> property=struts]
> 20682 [http-8084-2] DEBUG com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler
> - Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@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.BaseView@55d7fc31, com.opensymphony.xwork2.DefaultTextProvider@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.DefaultTextProvider@18a4edc4],
> property=struts]
> 13176 [http-8084-1] DEBUG com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler
> - Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@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.ProjectView@63ad6884, com.opensymphony.xwork2.DefaultTextProvider@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.ProjectView@63ad6884, com.opensymphony.xwork2.DefaultTextProvider@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.