Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7630

NameBindings are ignored for (at least) ContextResponseFilters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.2.2
    • 3.2.2, 3.1.15
    • JAX-RS
    • None
    • Unknown

    Description

      If we create a NameBinding annotation:

      @NameBinding
      @Retention(RetentionPolicy.RUNTIME)
      @Target({ElementType.TYPE, ElementType.METHOD})
      public @interface Filtered {
      }

      and qualify a ContainerResponseFilter:

      @Filtered
      @Provider
      public class TestNameBoundFilter implements ContainerResponseFilter {
      
          @Override
          public void filter(
                  ContainerRequestContext requestContext,
                  ContainerResponseContext responseContext)
              throws IOException {
      
              MultivaluedMap<String, Object> headers = responseContext.getHeaders();
      
              headers.putSingle("NameBoundFiltered", "true");
          }
      
      }

      and some methods in a Resource:

      public class NameBoundResource {
      
          @GET
          @Filtered
          @Path("/filtered")
          public String filtered() {
              return "filtered";
          }
      
          @GET
          @Path("/unfiltered")
          public String unfiltered() {
              return "unfiltered";
          }
      
      }

      only responses for requests made to "/filtered" path should carry the "NameBoundHeader" header. However both responses, to "/filtered" and "/unfiltered" carry the header.

      Attachments

        Issue Links

          Activity

            People

              sergey_beryozkin Sergey Beryozkin
              csierra Carlos Sierra Andrés
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: