You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by James <cx...@legendsoft.net> on 2010/02/05 03:55:44 UTC

How to Use http_jetty transport and JettyHTTPDestination from pre-existing embedded Jetty application

Hi,

We have a pre-existing application that uses Jetty in embedded form.  The
existing application doesn't yet support web services, but we want to use
CXF to add web service functionality.

At application startup we execute lines similar to the following to launch
Jetty within our JVM:
  org.mortbay.jetty.Server server = new Server();
  .
  .
  org.mortbay.jetty.deployer.WebAppDeployer deployer = new WebAppDeployer();
  deployer.setWebAppDir("/");

  org.mortbay.jetty.handler.HandlerList handlerList = new HandlerList();
  deployer.setContexts(handlerList);

  server.addHandler(handlerList);
  server.addLifeCycle(deployer);
  server.start();
It is very important that we be able to use continuations as supported by
Jetty 6.  We understand that access to the built-in CXF/Jetty
ContinuationProvider is available as follows:
  MessageContext context;
  .
  .
  .
  ContinuationProvider provider =
context.get("org.apache.cxf.continuations.ContinuationProvider");
  Continuation c = provider.getContinuation();
Unfortunately, no matter what we try, the
"org.apache.cxf.transport.Destination" associated with our message context
is an instance of "org.apache.cxf.transport.servlet.ServletDestination", and
therefore the ContinuationProvider returned from the MessageContext is
always null.

Our pre-existing application uses Spring.

How can we configure CXF with our existing application so that CXF uses the
http_jetty transport and the JettyHTTPDestination for access to the
"org.apache.cxf.continuations.ContinuationProvider", while still launching
Jetty as shown above?

*We would really like to see how this could be accomplished both with Spring
and without - i.e. using a code snippet.)

Thanks in advance,
Jay


RE: How to Use http_jetty transport and JettyHTTPDestination from pre-existing embedded Jetty application

Posted by James Avery <cx...@legendsoft.net>.
Thanks Dan.

We're also investigating the possibility of creating a new instance of the
org.apache.cxf.transport.htttp_jetty.continuations.JettyContinuationProvider
and using it with the org.apache.cxf.transport.servlet.CXFServlet.  Do you
think this has any possibility of working?

We're investigating this, but we're not sure how to create or obtain an
instance of our org.apache.cxf.binding.soap.SoapMessage.  Is there some way
of recreating the SoapMessage using a javax.xml.ws.handler.MessageContext,
or obtaining it through an annotation?

-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org]
Sent: Friday, February 05, 2010 2:56 PM
To: users@cxf.apache.org
Cc: James Avery
Subject: Re: How to Use http_jetty transport and JettyHTTPDestination
from pre-existing embedded Jetty application


On Fri February 5 2010 2:50:23 pm James Avery wrote:
> Still looking for some options here...
>
> Is it possible to use the "JettyHTTPTransportFactory" with the
> "org.apache.cxf.transport.servlet.CXFServlet"?

I really don't think there is.

You could PROBABLY write an interceptor that grabbed the HTTPServletRequest
thing from the message and test if it's the Jetty version and such and do
some
of the Jetty continuation things like we do in the
JettyHTTPTransportFactory.
Stick the interceptor as the first on the chain I'm not 100% sure that would
work but might be worth trying.

Ideally, the Servlet transport would be updated to support the new
continuation things in the new version of the Servlet spec.

Dan




>
> -----Original Message-----
> From: James [mailto:cxf@legendsoft.net]
> Sent: Thursday, February 04, 2010 9:56 PM
> To: users@cxf.apache.org
> Subject: How to Use http_jetty transport and JettyHTTPDestination from
> pre-existing embedded Jetty application
>
>
> Hi,
>
> We have a pre-existing application that uses Jetty in embedded form.  The
> existing application doesn't yet support web services, but we want to use
> CXF to add web service functionality.
>
> At application startup we execute lines similar to the following to launch
> Jetty within our JVM:
>   org.mortbay.jetty.Server server = new Server();
>   .
>   .
>   org.mortbay.jetty.deployer.WebAppDeployer deployer = new
>  WebAppDeployer(); deployer.setWebAppDir("/");
>
>   org.mortbay.jetty.handler.HandlerList handlerList = new HandlerList();
>   deployer.setContexts(handlerList);
>
>   server.addHandler(handlerList);
>   server.addLifeCycle(deployer);
>   server.start();
> It is very important that we be able to use continuations as supported by
> Jetty 6.  We understand that access to the built-in CXF/Jetty
> ContinuationProvider is available as follows:
>   MessageContext context;
>   .
>   .
>   .
>   ContinuationProvider provider =
> context.get("org.apache.cxf.continuations.ContinuationProvider");
>   Continuation c = provider.getContinuation();
> Unfortunately, no matter what we try, the
> "org.apache.cxf.transport.Destination" associated with our message context
> is an instance of "org.apache.cxf.transport.servlet.ServletDestination",
>  and therefore the ContinuationProvider returned from the MessageContext
is
>  always null.
>
> Our pre-existing application uses Spring.
>
> How can we configure CXF with our existing application so that CXF uses
the
> http_jetty transport and the JettyHTTPDestination for access to the
> "org.apache.cxf.continuations.ContinuationProvider", while still launching
> Jetty as shown above?
>
> *We would really like to see how this could be accomplished both with
>  Spring and without - i.e. using a code snippet.)
>
> Thanks in advance,
> Jay
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.432 / Virus Database: 271.1.1/2668 - Release Date: 02/04/10
> 19:35:00
>

--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.435 / Virus Database: 271.1.1/2669 - Release Date: 02/05/10
07:35:00


Re: How to Use http_jetty transport and JettyHTTPDestination from pre-existing embedded Jetty application

Posted by Daniel Kulp <dk...@apache.org>.
On Fri February 5 2010 2:50:23 pm James Avery wrote:
> Still looking for some options here...
> 
> Is it possible to use the "JettyHTTPTransportFactory" with the
> "org.apache.cxf.transport.servlet.CXFServlet"?

I really don't think there is. 

You could PROBABLY write an interceptor that grabbed the HTTPServletRequest 
thing from the message and test if it's the Jetty version and such and do some 
of the Jetty continuation things like we do in the JettyHTTPTransportFactory.    
Stick the interceptor as the first on the chain I'm not 100% sure that would 
work but might be worth trying.     

Ideally, the Servlet transport would be updated to support the new 
continuation things in the new version of the Servlet spec.   

Dan




> 
> -----Original Message-----
> From: James [mailto:cxf@legendsoft.net]
> Sent: Thursday, February 04, 2010 9:56 PM
> To: users@cxf.apache.org
> Subject: How to Use http_jetty transport and JettyHTTPDestination from
> pre-existing embedded Jetty application
> 
> 
> Hi,
> 
> We have a pre-existing application that uses Jetty in embedded form.  The
> existing application doesn't yet support web services, but we want to use
> CXF to add web service functionality.
> 
> At application startup we execute lines similar to the following to launch
> Jetty within our JVM:
>   org.mortbay.jetty.Server server = new Server();
>   .
>   .
>   org.mortbay.jetty.deployer.WebAppDeployer deployer = new
>  WebAppDeployer(); deployer.setWebAppDir("/");
> 
>   org.mortbay.jetty.handler.HandlerList handlerList = new HandlerList();
>   deployer.setContexts(handlerList);
> 
>   server.addHandler(handlerList);
>   server.addLifeCycle(deployer);
>   server.start();
> It is very important that we be able to use continuations as supported by
> Jetty 6.  We understand that access to the built-in CXF/Jetty
> ContinuationProvider is available as follows:
>   MessageContext context;
>   .
>   .
>   .
>   ContinuationProvider provider =
> context.get("org.apache.cxf.continuations.ContinuationProvider");
>   Continuation c = provider.getContinuation();
> Unfortunately, no matter what we try, the
> "org.apache.cxf.transport.Destination" associated with our message context
> is an instance of "org.apache.cxf.transport.servlet.ServletDestination",
>  and therefore the ContinuationProvider returned from the MessageContext is
>  always null.
> 
> Our pre-existing application uses Spring.
> 
> How can we configure CXF with our existing application so that CXF uses the
> http_jetty transport and the JettyHTTPDestination for access to the
> "org.apache.cxf.continuations.ContinuationProvider", while still launching
> Jetty as shown above?
> 
> *We would really like to see how this could be accomplished both with
>  Spring and without - i.e. using a code snippet.)
> 
> Thanks in advance,
> Jay
> 
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.432 / Virus Database: 271.1.1/2668 - Release Date: 02/04/10
> 19:35:00
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

RE: How to Use http_jetty transport and JettyHTTPDestination from pre-existing embedded Jetty application

Posted by James Avery <cx...@legendsoft.net>.
Still looking for some options here...

Is it possible to use the "JettyHTTPTransportFactory" with the
"org.apache.cxf.transport.servlet.CXFServlet"?

-----Original Message-----
From: James [mailto:cxf@legendsoft.net]
Sent: Thursday, February 04, 2010 9:56 PM
To: users@cxf.apache.org
Subject: How to Use http_jetty transport and JettyHTTPDestination from
pre-existing embedded Jetty application


Hi,

We have a pre-existing application that uses Jetty in embedded form.  The
existing application doesn't yet support web services, but we want to use
CXF to add web service functionality.

At application startup we execute lines similar to the following to launch
Jetty within our JVM:
  org.mortbay.jetty.Server server = new Server();
  .
  .
  org.mortbay.jetty.deployer.WebAppDeployer deployer = new WebAppDeployer();
  deployer.setWebAppDir("/");

  org.mortbay.jetty.handler.HandlerList handlerList = new HandlerList();
  deployer.setContexts(handlerList);

  server.addHandler(handlerList);
  server.addLifeCycle(deployer);
  server.start();
It is very important that we be able to use continuations as supported by
Jetty 6.  We understand that access to the built-in CXF/Jetty
ContinuationProvider is available as follows:
  MessageContext context;
  .
  .
  .
  ContinuationProvider provider =
context.get("org.apache.cxf.continuations.ContinuationProvider");
  Continuation c = provider.getContinuation();
Unfortunately, no matter what we try, the
"org.apache.cxf.transport.Destination" associated with our message context
is an instance of "org.apache.cxf.transport.servlet.ServletDestination", and
therefore the ContinuationProvider returned from the MessageContext is
always null.

Our pre-existing application uses Spring.

How can we configure CXF with our existing application so that CXF uses the
http_jetty transport and the JettyHTTPDestination for access to the
"org.apache.cxf.continuations.ContinuationProvider", while still launching
Jetty as shown above?

*We would really like to see how this could be accomplished both with Spring
and without - i.e. using a code snippet.)

Thanks in advance,
Jay


No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.432 / Virus Database: 271.1.1/2668 - Release Date: 02/04/10
19:35:00