[jira] [Assigned] (CXF-8227) Failure to comply with JAX-RS spec with ContainerRequestContext and WriterInterceptorContext

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Assigned] (CXF-8227) Failure to comply with JAX-RS spec with ContainerRequestContext and WriterInterceptorContext

Peter Seer (Jira)

     [ https://issues.apache.org/jira/browse/CXF-8227?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andriy Redko reassigned CXF-8227:
---------------------------------

    Assignee: Andriy Redko

> Failure to comply with JAX-RS spec with ContainerRequestContext and WriterInterceptorContext
> --------------------------------------------------------------------------------------------
>
>                 Key: CXF-8227
>                 URL: https://issues.apache.org/jira/browse/CXF-8227
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.3.5
>         Environment: * Linux and or Windows
>  * Java 11.0.6
>  * CXF 3.3.5
>            Reporter: Jorge Cercas
>            Assignee: Andriy Redko
>            Priority: Critical
>
> The Javadoc for the ContainerRequestContext interface says:
>  {{[setProperty|https://docs.oracle.com/javaee/7/api/javax/ws/rs/container/ContainerRequestContext.html#setProperty-java.lang.String-java.lang.Object-](String name, [Object|http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true] object)}}
>  Binds an object to a given property name in the *current request/response exchange context*.
>  {{[getProperty|https://docs.oracle.com/javaee/7/api/javax/ws/rs/container/ContainerRequestContext.html#getProperty-java.lang.String-](String name)}}
>  Returns the property with the given name registered in the *current request/response exchange context*, or {{null}} if there is no property by that name.
> And the Javadoc for the InterceptorContext interface and known sub-interfaces (ReaderInterceptorContext, WriterInterceptorContext) says:
>  {{[setProperty|https://docs.oracle.com/javaee/7/api/javax/ws/rs/ext/InterceptorContext.html#setProperty-java.lang.String-java.lang.Object-](String name, [Object|http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true] object)}}
>  Binds an object to a given property name in the *current request/response exchange context*.
>  {{[getProperty|https://docs.oracle.com/javaee/7/api/javax/ws/rs/ext/InterceptorContext.html#getProperty-java.lang.String-](String name)}}
>  Returns the property with the given name registered in the *current request/response exchange context*, or {{null}} if there is no property by that name.
>   
>  However, given the code below for a resource that does provide an entity, the variable fooBar in the aroundWriteTo method is always null.
> {code:java}
> // code placeholder
> @Provider
> public class InterceptorBug implements ContainerRequestFilter, WriterInterceptor {
>    
>     @Override
>     public void filter(ContainerRequestContext requestContext) throws IOException {
>         requestContext.setProperty("foo.bar", "baz");
>     }
>     @Override
>     public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException {
>         context.proceed();
>         // 'fooBar' ALWAYS NULL
>         var fooBar = context.getProperty("foo.bar");
>     }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)