You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by john70 <jo...@mail.ru> on 2012/02/03 12:41:35 UTC

Re: Jetty Support

Hi all,

I know you are very busy. But my question is still not answered.
Are you planning (I mean real planning and not a hypothetical one) to add
Jetty support or not?

Especially after reading this article:

http://java.dzone.com/articles/cost-high-availability

I have much more interest in Jetty. ;-)

Thanks in advance!

Best regards,
John

--
View this message in context: http://openejb.979440.n4.nabble.com/Jetty-Support-tp4340294p4354361.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Jetty Support

Posted by David Blevins <da...@gmail.com>.
On Feb 8, 2012, at 4:53 AM, john70 wrote:

> Hi David,
> 
> thank you again for taking time!
> 
> 
> 
> David Blevins-2 wrote
>> 
>> The part that has historically been missing in Jetty terms is the
>> injection support of various Java EE things into Servlets, Filters, etc. 
>> I.e. wiring the things that Jetty controls into the overall server.  Jan
>> and I have chatted a couple times on that part.
>> 
> 
> I don't need  the injection support for Servlets, Filters, etc. So if it is
> still missed, it is OK for me.

If that's the case, it sounds like you don't need really any "integration".  Both OpenEJB and Jetty have very expressive APIs for building things up in code. I wouldn't recommend this to just anyone, but it sounds like you might get a little giggle out of the possibilities.

   http://svn.apache.org/repos/asf/openejb/trunk/sandbox/jettyfun/src/test/java/org/superbiz/jettyfun/JettyIntegrationTest.java

There isn't really a "test" there, I just started playing -- I tend to use tests rather than main classes for prototyping.

Just a little proof of concept.  There are numerous ways that could be tweaked, changed, or expanded.  The idea was just to get the creative juices flowing.

So note on the "if (proxied)" statement.  One approach just has OpenEJB build the actual instance and hand it over bare to Jetty.  This approach will get you a fully injected instance, but none of the container managed services that are setup prior to calls being made; jndi, transactions, interceptors, locking, cdi request scope.  The other approach get's you all that extra stuff.

I would note that when you have the kind of control shown in that simple little example, you can easily make that decision however you want.  For example, that if block could be:

    if (beanContext.getBeanClass().isAnnotationPresent(Proxied.class)) {
        // Interceptors, transactions, CDI scope management all will be enabled
        servlet = (Servlet) beanContext.getBusinessLocalHome().create();
    } else {
        // Here we just take the raw injected instance and use it directly
        final InstanceContext instanceContext = beanContext.newInstance();
        servlet = (Servlet) instanceContext.getBean();
    }

Where 'Proxied' is some annotation you made up and apply where you want it.

As well the line that uses the ejbName as the path could just as easily use some other annotation of your design to set the path -- you could even reuse the @WebServlet annotation if you wanted.

Most people aren't used to thinking like an app server developer and so these things aren't obvious, but with the right mindset you can have all sorts of wicked fun.


-David


Re: Jetty Support

Posted by john70 <jo...@mail.ru>.
Hi David,

thank you again for taking time!



David Blevins-2 wrote
> 
> The part that has historically been missing in Jetty terms is the
> injection support of various Java EE things into Servlets, Filters, etc. 
> I.e. wiring the things that Jetty controls into the overall server.  Jan
> and I have chatted a couple times on that part.
> 

I don't need  the injection support for Servlets, Filters, etc. So if it is
still missed, it is OK for me.


David Blevins-2 wrote
> 
> Give me the weekend to look over all that code and see what the story is. 
> Also let me know which major version of Jetty you want -- I assume the
> latest.
> 

Yes, the latest major version of Jetty. Currently it is Jetty 8.1.0 (7.6.0
is also OK).

Thanks!

Best regards,
John

--
View this message in context: http://openejb.979440.n4.nabble.com/Jetty-Support-tp4340294p4369328.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Jetty Support

Posted by David Blevins <da...@gmail.com>.
On Feb 3, 2012, at 3:41 AM, john70 wrote:

> Hi all,
> 
> I know you are very busy. But my question is still not answered.
> Are you planning (I mean real planning and not a hypothetical one) to add
> Jetty support or not?

Had a partial response crafted, but not finished.  The "who cares about certification" response was perfect -- thank you.  Any other response would have been a clear no in terms of Jetty support.  Taking certification off the table, we've used Jetty ourselves for years in our build.  Primarily for JAX-RS and JAX-WS endpoints as well as the ability to run our EJBd protocol over HTTP via Jetty.  So that part is easy and simply having Jetty "there" is easy.  There've been people who've used them together by just booting Jetty in code and OpenEJB in code (both are really better embeddable) and then just having the servlets lookup the EJBs via global JNDI over the LocalInitialContextFactory.

The part that has historically been missing in Jetty terms is the injection support of various Java EE things into Servlets, Filters, etc.  I.e. wiring the things that Jetty controls into the overall server.  Jan and I have chatted a couple times on that part.

We definitely have everything else on that list.  In fact, it sounds a lot like what Andy Gumbrecht is using, minus Jetty of course (or if he is using it, it's news to me).

Give me the weekend to look over all that code and see what the story is.  Also let me know which major version of Jetty you want -- I assume the latest.


-David