You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2011/03/07 14:30:59 UTC

[jira] Commented: (CXF-3379) @Context fails to inject Application instance

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

Sergey Beryozkin commented on CXF-3379:
---------------------------------------

thanks for opening this JIRA.

CXFNonSpringJaxrsServlet.createServerFromApplication returns Server, so Application instance may be saved as the server.getEndpoint() property. Endpoint can later be retrieved from the current message:
m.getExchange().get(Endpoint.class) and then the property pointing to the Application instance can be checked.

However, I don't understand why would a root resource or provider class want to have Application instance injected ? Can you explain please what you'd use it for ?

thanks, Sergey


> @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