cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benson Margulies" <bim2...@basistech.com>
Subject RE: Getting the HTTP server off the bus
Date Sat, 14 Jul 2007 00:50:38 GMT
Willem,

The recipe in 2.0 looks like:

Bus bus =  BusFactory.getDefaultBus();
        DestinationFactoryManager dfm =
bus.getExtension(DestinationFactoryManager.class);
        JettyHTTPTransportFactory df = (JettyHTTPTransportFactory)
dfm.getDestinationFactory("http://cxf.apache.org/transports/http/configu
ration");
        EndpointInfo ei = new EndpointInfo();
        ei.setAddress(serviceFactory.getAddress());
        @SuppressWarnings("unused")
        Destination destination = df.getDestination(ei);
        JettyHTTPDestination jettyDestination =
(JettyHTTPDestination)destination; 
        ServerEngine engine= jettyDestination.getEngine();

Now I wish that I could just retrieve the org.mortbay.jetty.Server from
the JettyHTTPServerEngine and talk to it, I already know how. It already
knows how to handle static content. It's kind of crazy to write my own
code to serve up static data, when the code from Jetty is out there and
can do it perfectly well.

If I offered a patch, would you take it?



> -----Original Message-----
> From: Willem Jiang [mailto:ning.jiang@iona.com]
> Sent: Wednesday, July 11, 2007 10:35 PM
> To: cxf-user@incubator.apache.org
> Subject: Re: Getting the HTTP server off the bus
> 
> Hi Benson,
> 
> All the Jetty related stuff of CXF are in the
> cxf-rt-transports-http-jetty module.
> You can get the serverEngine which wraps the Jetty instance from the
> JettyHttpTransportFactory.
> 
> You can use the below codes to get the serverEngine.
> 
>         Bus bus =  BusFactory.getDefaultBus();
>         DestinationFactoryManager dfm =
> bus.getExtension(DestinationFactoryManager.class);
>         JettyHttpTransportFactory df = (JettyHttpTransportFactory)
>
dfm.getDestinationFactory("http://cxf.apache.org/transports/http/configu
ra
> tion");
>        ServerEngine engine= df.getEngine();
> 
> The you just need to extends JettyHTTPHandler to deal with the static
> content directory, and add it into the engine by call addServant(URL
> url, JettyHTTPHandler handler).
> 
> You can find the detail information about the ServerEngine and
> JettyHTTPHandler from this directory
> 
>
https://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/transports/http-
> jetty/src/main/java/org/apache/cxf/transport/http_jetty
> 
> Enjoy hacking the code !
> 
> Willem.
> 
> 
> Benson Margulies wrote:
> > Could someone reveal how to ask the default bus for the running
Jetty
> > instance? I want to add a static content directory for it to handle.
> >
> >
> >
> >
> >
> >
> >

Mime
View raw message