Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] SPDY NPN without -Xbootclasspath

Hi,

On Fri, Sep 6, 2013 at 1:00 AM, Eirik Bjørsnøs <eirbjo@xxxxxxxxx> wrote:
>
> Hi,
>
> Investigating SPDY support for JettyConsole (a Maven plugin embedding Jetty
> into runnable .war-files), I found a way to add SPDY support without setting
> -Xbootclasspath on the command line.
>
> It involves attaching to the current JVM and then loading a JVM agent.
>
> The agent adds a ClassFileTransformer. When the SSL classes in NPN-boot are
> loaded, the NPN-boot bytes are returned instead of the JVM's bytes.
>
> Here's the complete implementation of the SPDY plugin for JettyConsole:
>
> http://simplericity.org/svn/simplericity/trunk/jetty-console/jetty-console-plugins/jetty-console-spdy-plugin/
>
> The loading of the agent happens in the bootstrap() method here:
>
> http://simplericity.org/svn/simplericity/trunk/jetty-console/jetty-console-plugins/jetty-console-spdy-plugin/src/main/java/org/simplericity/jettyconsole/plugins/spdy/SpdyPlugin.java
>
> And the JVM agent itself is here:
>
> http://simplericity.org/svn/simplericity/trunk/jetty-console/jetty-console-plugins/jetty-console-spdy-plugin/src/main/java/org/simplericity/jettyconsole/plugins/spdy/SpdyAgent.java
>
> It all seems to work, although I've only tested this on my Mac so far.
>
> I think avoiding the bootclasspath hassle could help increase SPDY adoption.
> WDTY? Any interest in doing something similar in Jetty?

I have considered that approach a while back, when I implemented NPN.
Ages ago I even wrote a blog about using the attach API:
http://bordet.blogspot.it/2005/11/attaching-to-mustang-explained.html.

As you note, it has the disadvantage of requiring tools.jar;
furthermore, I was cautious about using class retransformation because
it could interfere with other retransformers.

I wish there exist a method:

instrumentation.*pre*pendToBootstrapClassLoaderSearch(jarFile);

which would have solved the problems, but it's not there.

In any case, attaching is a valid alternative.
Since NPN has been "deprecated" in favor of ALPN, we may implement a
mechanism based on agents for ALPN.

Do you mind to comment on this bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=405729.
Add your ideas of using an agent, and we may get it done.

Thanks !

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
http://intalio.com
Developer advice, training, services and support
from the Jetty & CometD experts.
Intalio, the modern way to build business applications.


Back to the top