Struts 2
  1. Struts 2
  2. WW-4131

RestActionProxyFactory is handling all requests with PrefixBasedActionMapper

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.12, 2.3.14, 2.3.15
    • Fix Version/s: 2.3.16
    • Component/s: Plugin - REST
    • Labels:
      None

      Description

      Using the following configuration:

      <constant name="struts.mapper.class" value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/>
      <constant name="struts.mapper.prefixMapping" value=":rest,/ajax:struts,/login:struts"/>
      

      Is expected that when I request the following url http://xxxxxxxx.com/ajax/anyThingHere, struts action proxy should handle this call. But instead, RestActionProxyFactory is handling this call.

      But the RestActionProxyFactory class has a if, and every time the namespace attribute is injected with "/ajax" value. So the condition always is redirected to the rest plugin handler and not to the struts default.

      Here is my ActionProxyFactory implementation:

      public class CustomActionProxyFactory extends RestActionProxyFactory {
      
          @Override
          public ActionProxy createActionProxy(String namespace, String actionName, String methodName, Map<String, Object> extraContext, boolean executeResult, boolean cleanupContext) {
              RestActionProxyFactory p = new RestActionProxyFactory();
              p.setContainer(container);
              if ("/ajax".equals(namespace)) {
                  p.setNamespace("/idealogic");
              }
              return p.createActionProxy(namespace, actionName, methodName, extraContext, executeResult, cleanupContext);
          }
      }
      

      By some reason, it fixed the origin behaviour.

      The begin of this issue was that <s:action> tag was rendering the action result, even with executeResult = false, which is the default value.

      Another observation was that, changing the flush attribute value, the result is rendered in different parts of the html.

        Activity

        Hide
        Hudson added a comment -

        SUCCESS: Integrated in Struts2-JDK6 #822 (See https://builds.apache.org/job/Struts2-JDK6/822/)
        WW-4131 Polishes JavaDoc a bit (lukaszlenart: rev 1534943)

        • /struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java
          WW-4131 Polishes JavaDoc a bit (lukaszlenart: rev 1534942)
        • /struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java
          WW-4131 Polishes JavaDoc a bit (lukaszlenart: rev 1534938)
        • /struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java
          WW-4131 Implements new ActionProxyFactory to cooperate with PrefixBasedActionMapper (lukaszlenart: rev 1534936)
        • /struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java
        • /struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxyFactory.java
        • /struts/struts2/trunk/core/src/main/resources/struts-default.xml
        • /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/DefaultActionProxyFactory.java
        Show
        Hudson added a comment - SUCCESS: Integrated in Struts2-JDK6 #822 (See https://builds.apache.org/job/Struts2-JDK6/822/ ) WW-4131 Polishes JavaDoc a bit (lukaszlenart: rev 1534943) /struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java WW-4131 Polishes JavaDoc a bit (lukaszlenart: rev 1534942) /struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java WW-4131 Polishes JavaDoc a bit (lukaszlenart: rev 1534938) /struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java WW-4131 Implements new ActionProxyFactory to cooperate with PrefixBasedActionMapper (lukaszlenart: rev 1534936) /struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java /struts/struts2/trunk/core/src/main/java/org/apache/struts2/impl/StrutsActionProxyFactory.java /struts/struts2/trunk/core/src/main/resources/struts-default.xml /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/DefaultActionProxyFactory.java
        Hide
        Lukasz Lenart added a comment -

        Defined new PrefixBasedActionProxyFactory to support multiple prefixes the same was as PrefixBasedActionMapper, see the docs

        https://cwiki.apache.org/confluence/display/WW/ActionMapper#ActionMapper-PrefixBasedActionMapper

        Show
        Lukasz Lenart added a comment - Defined new PrefixBasedActionProxyFactory to support multiple prefixes the same was as PrefixBasedActionMapper, see the docs https://cwiki.apache.org/confluence/display/WW/ActionMapper#ActionMapper-PrefixBasedActionMapper
        Hide
        ASF subversion and git services added a comment -

        Commit 1534943 from Lukasz Lenart in branch 'struts2/trunk'
        [ https://svn.apache.org/r1534943 ]

        WW-4131 Polishes JavaDoc a bit

        Show
        ASF subversion and git services added a comment - Commit 1534943 from Lukasz Lenart in branch 'struts2/trunk' [ https://svn.apache.org/r1534943 ] WW-4131 Polishes JavaDoc a bit
        Hide
        ASF subversion and git services added a comment -

        Commit 1534942 from Lukasz Lenart in branch 'struts2/trunk'
        [ https://svn.apache.org/r1534942 ]

        WW-4131 Polishes JavaDoc a bit

        Show
        ASF subversion and git services added a comment - Commit 1534942 from Lukasz Lenart in branch 'struts2/trunk' [ https://svn.apache.org/r1534942 ] WW-4131 Polishes JavaDoc a bit
        Hide
        ASF subversion and git services added a comment -

        Commit 1534938 from Lukasz Lenart in branch 'struts2/trunk'
        [ https://svn.apache.org/r1534938 ]

        WW-4131 Polishes JavaDoc a bit

        Show
        ASF subversion and git services added a comment - Commit 1534938 from Lukasz Lenart in branch 'struts2/trunk' [ https://svn.apache.org/r1534938 ] WW-4131 Polishes JavaDoc a bit
        Hide
        ASF subversion and git services added a comment -

        Commit 1534936 from Lukasz Lenart in branch 'struts2/trunk'
        [ https://svn.apache.org/r1534936 ]

        WW-4131 Implements new ActionProxyFactory to cooperate with PrefixBasedActionMapper

        Show
        ASF subversion and git services added a comment - Commit 1534936 from Lukasz Lenart in branch 'struts2/trunk' [ https://svn.apache.org/r1534936 ] WW-4131 Implements new ActionProxyFactory to cooperate with PrefixBasedActionMapper
        Hide
        Felipe Lorenz added a comment -

        I use to work with 2.3.8, but the pattern of using s:action tag to populate select or list(i.e) is the first time. So I can't say which version this behavior starts.

        Show
        Felipe Lorenz added a comment - I use to work with 2.3.8, but the pattern of using s:action tag to populate select or list(i.e) is the first time. So I can't say which version this behavior starts.
        Hide
        Lukasz Lenart added a comment -

        You have migrated from which version?

        Show
        Lukasz Lenart added a comment - You have migrated from which version?

          People

          • Assignee:
            Lukasz Lenart
            Reporter:
            Felipe Lorenz
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development