Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

Wildcard Mappings -- Last one doesn't win

Robert M. Zigweid

2010-07-08


Author LoginPost Reply
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@(protected)]
20682 [http-8084-2] DEBUG com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler - Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@(protected)]
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@(protected)]
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@(protected)]
13176 [http-8084-1] DEBUG com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler - Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@(protected)]
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@(protected)]
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@(protected)]
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.
©2008 gg3721.com - Jax Systems, LLC, U.S.A.