Struts 2
  1. Struts 2
  2. WW-1796

@InterceptorRef and @InterceptorRefs annotations to configure actions with custom interceptor-refs

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Future
    • Component/s: Plugin - CodeBehind
    • Labels:
      None
    • Flags:
      Patch

      Description

      This patch allows people to annotate their actions with @InterceptorRef and @InterceptorRefs to configure the interceptor stacks that the action is run with, bringing us one step closer to zero-conf.

      The ClasspathConfigurationProvider is where all the magic happens ( after ParentPackage configuration ).

      Notes:
      -Interceptors are stacked in the order they are listed, by whatever the InterceptorBuilder returns.
      -It is currently possible to have @InterceptorRef and @InterceptorRefs in the same action, but the @InterceptorRef will still be on top.
      -Most of my testing has been on the 2.0.x branch, but since there seem not to have been a lot of changes to the ClasspathConfigurationProvider ( if any ) since that time, it's been a straightforward move.

      Patch is against trunk/core and includes the new annotation files as well

      1. interceptor-ref.patch
        11 kB
        Aadi Deshpande
      2. interceptor-ref.patch
        11 kB
        Aadi Deshpande

        Issue Links

          Activity

          Hide
          musachy added a comment -

          Applied to Convention plugin in the sandbox. I also added "params" to @IntereceptorRef, so an action can be configured like:

          ...
          @Action(value="/test/hello", interceptorRefs = @InterceptorRef(value = "roles", params =

          {"allowedRoles", "a,b"}

          ))
          public String execute() throws Exception

          { setMessage(getText(MESSAGE)); return SUCCESS; }

          ...

          Show
          musachy added a comment - Applied to Convention plugin in the sandbox. I also added "params" to @IntereceptorRef, so an action can be configured like: ... @Action(value="/test/hello", interceptorRefs = @InterceptorRef(value = "roles", params = {"allowedRoles", "a,b"} )) public String execute() throws Exception { setMessage(getText(MESSAGE)); return SUCCESS; } ...
          Hide
          Don Brown added a comment -

          Agreed, moving to 2.1.x till we decide we are ready to apply it.

          Show
          Don Brown added a comment - Agreed, moving to 2.1.x till we decide we are ready to apply it.
          Hide
          Ted Husted added a comment -

          I started to review this patch, but decided to wait until I had a chance to review the Conventions plugin in the sandbox, to see how well it jives with what we are doing there.

          If nothing else, we will probably have to remap the patch, since I believe the annotation code has since been moved to the CodeBehind plugin.

          Show
          Ted Husted added a comment - I started to review this patch, but decided to wait until I had a chance to review the Conventions plugin in the sandbox, to see how well it jives with what we are doing there. If nothing else, we will probably have to remap the patch, since I believe the annotation code has since been moved to the CodeBehind plugin.
          Hide
          Don Brown added a comment -

          Moving to 2.1.0 as it is a new feature

          Show
          Don Brown added a comment - Moving to 2.1.0 as it is a new feature
          Hide
          Aadi Deshpande added a comment -

          the first patch had a bug.
          this one is bug-free-er

          Show
          Aadi Deshpande added a comment - the first patch had a bug. this one is bug-free-er
          Hide
          Aadi Deshpande added a comment -

          el patch-o

          Show
          Aadi Deshpande added a comment - el patch-o

            People

            • Assignee:
              Unassigned
              Reporter:
              Aadi Deshpande
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development