[ https://issues.apache.org/jira/browse/CXF-7630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16350195#comment-16350195 ]
ASF GitHub Bot commented on CXF-7630: ------------------------------------- asfgit closed pull request #376: [CXF-7630] Do not preset namebindings when installing through a Feature URL: https://github.com/apache/cxf/pull/376 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/FilterProviderInfo.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/FilterProviderInfo.java index 0f04b5e94c8..1c92de28a56 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/FilterProviderInfo.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/FilterProviderInfo.java @@ -49,7 +49,7 @@ public FilterProviderInfo(Class<?> resourceClass, boolean dynamic, Map<Class<?>, Integer> supportedContracts) { super(resourceClass, serviceClass, provider, bus, true); - this.nameBinding = Collections.singleton(nameBinding); + this.nameBinding = nameBinding == null ? null : Collections.singleton(nameBinding); this.supportedContracts = supportedContracts; this.dynamic = dynamic; } diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java index bf4ddf1b72d..54eba425543 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java @@ -219,6 +219,8 @@ protected void setProviders(boolean custom, boolean busGlobal, Object... provide providerCls, featureProvider, getBus(), + null, + false, contracts)); } else { allProviders.add(featureProvider); diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java index d1b514889d2..02b61a64912 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java @@ -90,7 +90,11 @@ protected void run() { providers.add(new PreMatchContainerRequestFilter2()); providers.add(new PreMatchContainerRequestFilter()); providers.add(new PostMatchContainerResponseFilter()); - providers.add(new PostMatchContainerResponseFilter3()); + providers.add((Feature) context -> { + context.register(new PostMatchContainerResponseFilter3()); + + return true; + }); providers.add(new PostMatchContainerResponseFilter2()); providers.add(new CustomReaderBoundInterceptor()); providers.add(new CustomReaderInterceptor()); ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > NameBindings are ignored for (at least) ContextResponseFilters > -------------------------------------------------------------- > > Key: CXF-7630 > URL: https://issues.apache.org/jira/browse/CXF-7630 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Affects Versions: 3.2.2 > Reporter: Carlos Sierra > Priority: Major > > If we create a _NameBinding_ annotation: > {code:java} > @NameBinding > @Retention(RetentionPolicy.RUNTIME) > @Target({ElementType.TYPE, ElementType.METHOD}) > public @interface Filtered { > }{code} > and qualify a _ContainerResponseFilter_: > {code:java} > @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"); > } > }{code} > and some methods in a _Resource_: > {code:java} > public class NameBoundResource { > @GET > @Filtered > @Path("/filtered") > public String filtered() { > return "filtered"; > } > @GET > @Path("/unfiltered") > public String unfiltered() { > return "unfiltered"; > } > }{code} > only responses for requests made to _"/filtered"_ path should carry the > _"NameBoundHeader"_ header. However both responses, to _"/filtered"_ and > _"/unfiltered"_ carry the header. -- This message was sent by Atlassian JIRA (v7.6.3#76005)