Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3464

Wildcard Mappings, Last one loses.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.8.1
    • Fix Version/s: 3.0
    • Component/s: XML Configuration
    • Labels:
      None
    • Environment:

      OS X 10.6.4, Java 5, Running from inside Netbeans using embedded tomcat

      Description

      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'

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rzigweid Robert M. Zigweid
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: