struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert M. Zigweid" <rzigw...@zigweid.net>
Subject Wildcard Mappings -- Last one doesn't win
Date Thu, 08 Jul 2010 21:21:09 GMT
Greetings, 

Firstly, I apologize if i display an inordinate amount of ignorance.  However, after looking
for quite some time, I'm failing to find the answer to my question, and practical application
seems to point at there being either something obvious I'm missing, or a flaw in the documentation,
or similar. 

Some Notes: 
Logs are what I'm pulling out of NetBeans from the Apache tomcat logs. 
I'm using struts-2.1.8.1,
I've not changed the properties file for struts.

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' 

Regards, 

Robert

p.s. my apologies if there's multi-post here, I had a moment or so of user fail.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message