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

Sergey Beryozkin commented on CXF-5576:
---------------------------------------

Hi Christian,
If we move the code creating the endpoints into the extension and start 
attaching them to CXFNonSpringServlet inside the extension, then we need to 
start thinking about setting a proper servlet context and building the absolute 
HTTP address, something I'd like to avoid doing in the actual extension.

I guess I'd rather keep CDI Servlet as it can make it handy to have the WAR and 
indeed the standalone cases supported easily, it is kind of a helper really, 
CXFNonSpringServlet extension. But I think you are right in that the extension 
can do more but I'd limit it ti the actual endpoint preparation/initialization, 
the CDI servlet or other consumers of the extension would call create() on the 
bean, after possibly further updating its configuration.

For example, the CDI servlet would do:

{code:java}
final BeanManager beanManager = CDI.current().getBeanManager();
JAXRSCdiResourceExtension extension = beanManager.getExtension( 
JAXRSCdiResourceExtension.class );
if( extension != null ) {       
    extension.getBean().create();
}
{code}

with the extension doing all the initialization work, but not doing the final 
create(). This way we can customize the actual transport configuration easily...


> Initital support for CDI integration
> ------------------------------------
>
>                 Key: CXF-5576
>                 URL: https://issues.apache.org/jira/browse/CXF-5576
>             Project: CXF
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 3.0.0
>            Reporter: Andriy Redko
>            Assignee: Andriy Redko
>              Labels: cdi
>         Attachments: weld-one-jar.zip, weld-one-war.zip
>
>
> A per section 10.2.3 Context and Dependency Injection (CDI) of JAX-RS 2.0 
> specification, in a product that supports CDI, the implementations MUST 
> support the use of CDI-style Beans as root resource classes, providers and 
> Application subclasses. Providers and Application subclasses MUST be 
> singletons or use application scope.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to