[ 
https://issues.apache.org/jira/browse/CXF-3379?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13003596#comment-13003596
 ] 

Ben Noordhuis commented on CXF-3379:
------------------------------------

Sergey, can you mentor me a little?

> you might want to drop contextMessage.getExchange() it can only be null if 
> message.seyExchange(new ExchangeImpl()) was not done in the test, never null 
> in the real case

At the top of JAXRSUtils.createContextValue() this check is done:
{code}
Message contextMessage = m.getExchange() != null ? 
m.getExchange().getInMessage() : m;
if (contextMessage == null && 
Boolean.FALSE.equals(m.get(Message.INBOUND_MESSAGE))) {
    contextMessage = m;
}
{code}
So conceivably it could be true that contextMessage == m and m.getExchange() == 
null, right?

> The only missing bit is the related ThreadLocal implementation

The Application object is a singleton, its thread safety the responsibility of 
the developer - like servlets, really. How and why does a ThreadLocalProxy 
enter the mix? (There probably is a splendid reason, I just haven't caught on 
yet.)

> @Context fails to inject Application instance
> ---------------------------------------------
>
>                 Key: CXF-3379
>                 URL: https://issues.apache.org/jira/browse/CXF-3379
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.3
>            Reporter: Ben Noordhuis
>
> Quoting JSR 311:
> "The instance of the application-supplied Application subclass can be 
> injected into a class field or method parameter using the @Context 
> annotation. Access to the Application subclass instance allows configuration 
> information to be centralized in that class. Note that this cannot be 
> injected into the Application subclass itself since this would create a 
> circular dependency."
> JAXRSUtils.createContextValue() doesn't handle this. This bug exists in 2.3.x 
> and HEAD.
> I'd submit a patch but I don't know where (or if) the Application class is 
> registered after it's instantiated by CXFNonSpringJaxrsServlet.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to