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

Romain Manni-Bucau commented on OWB-1293:
-----------------------------------------

[~gr...@webtide.com] not really. Strictly speaking the current integration is a 
substandard and several things already don't work :( - that said it is the same 
for tomcat module.

Let's list what the integration must support and how it can be solved each time:

1. Boot: weld and openwebbeans have a listener to handle that and scopes. You 
can either test which impl is available and add the right listener 
programmatically (it is like 5 lines and avoid to reimplement scopes etc which 
can be bothering in jetty). This is likely the best to ensure the listener is 
the first one (enclosing in terms of execution) but alternative is to let it be 
set up automatically. On weld side there is already an initializer and we can 
add a module with it in owb if it is needed but not sure it is good since the 
order would then be random - or you would need to ensure jetty resort 
initializer, which can likely be done relying on @Priority since it is there 
anyway.
2. Servlet components injection: here the initialization must be done lazily 
(once the listener is bootstraped to have the CDI container ready) and you can 
rely on the portable CDI.current() API to get the bean manager and do the 
injections with creational context releasing after the instance gets destroyed.
3. Custom bean management: it is mainly about the principal if you do 1. Here 
the good news is that you don't need to use security services of OWB or Weld 
and you can just decorate the built-in bean/service (which would never be 
called):

{code}
@Decorator
@Priority(0)
public class JettyPrincipal implements Principal
{
    @Inject
    @Delegate
    private Principal principal;

    @Override
    public String getName()
    {
        return useSomeJettyInternals();
    }
}
{code}


So at the end I guess the integration in jetty can become portable quite 
easily. Is it clearer?




> Update Jetty integration prior to Jetty-10 release
> --------------------------------------------------
>
>                 Key: OWB-1293
>                 URL: https://issues.apache.org/jira/browse/OWB-1293
>             Project: OpenWebBeans
>          Issue Type: Improvement
>          Components: Interceptor and Decorators
>            Reporter: Greg Wilkins
>            Priority: Major
>
> The current jetty integration relies on exposing private jetty APIs so a 
> jetty Decorator can be registered.   This is fragile and requires different 
> APIs for the upcoming jetty-10 release.
> Instead, Jetty is developing a mechanism where a object with a decorator 
> signature can be set as a context attribute and it will be introspected and 
> dynamically registered as a decorator without any API dependencies.
> This is currently being developed in 
> [https://github.com/eclipse/jetty.project/pull/3838] and an integration with 
> Weld is at [https://github.com/weld/core/pull/1926] 
> Feedback is sought from the OpenWebBeans team on the approach and then we'd 
> like to collaborate to make a similar integration.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to