You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by versus <vl...@gmail.com> on 2008/04/14 20:31:17 UTC

Embedded jetty with session support

Hi all,

where can I find more information regarding jetty-configuration? 
I took a look at the
http://cwiki.apache.org/CXF20DOC/jetty-configuration.html page, but some
things are still unclear to me, e.g. how does this fit in the server
configuration/initialization and what should be done on the client side?

What I want to setup is: unit testing framework = cxf + embedded jetty with
session support
The setup should be as easy as possible. 

Thanks for any help!
-- 
View this message in context: http://www.nabble.com/Embedded-jetty-with-session-support-tp16685265p16685265.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Embedded jetty with session support

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 15 April 2008, versus wrote:
> Hi Dan,
>
> thanks for your fast answer. The proposed solutions worked.
> Now I have another question:
> - I'm writing unit tests for web service implementation which gets
> some config through the session
> (servlet reads the init params and stores the config in the session).
> Unfortunately, the implementation can't be changed. Somehow I need to
> pass this config from the client.
> What are possible options? I'm interested in easy solution.

Hmm.... about the only thing I can think of is to write a quick 
interceptor that fills in the session data with the data required for 
your testing environment.  Register that on the endpoint once it's 
published.

Dan



>
> Keep up the great job! I already convinced a friend developer to
> switch to CXF ;-)
>
> dkulp wrote:
> > Hm...  well, this isn't quite as easy as I had hoped it would be due
> > to a protected method that probably should be public.
> >
> > Right now, the ONLY way to configure the session support is via a
> > spring config.   Thus, in your test, you could have a spring xml
> > config to configure the session support and create a Bus based on
> > that prior to publishing your service.    The OTHER option is to
> > publish a dummy service on the port you want so the jetty engine
> > starts up, grab the JettyHTTPServerEngineFactory from the bus, get
> > the JettyHTTPServerEngine for the port, call the
> > setSessionSupport(true) method, then publish the real service you
> > want.
> >
> > The main problem is that the method:
> > JettyHTTPServerEngine createJettyHTTPServerEngine(int port, String
> > protocol)
> > on the JettyHTTPServerEngineFactory is not public.   I'm going to
> > make it public in my next commit.   Ideally, you would get the
> > JettyHTTPServerEngineFactory from the Bus, call that method to get
> > the engine for the port you want, configure it, then publish your
> > service. Right now, the dummy service needs to be published first to
> > make sure that method is called.
> >
> > Dan
> >
> > On Monday 14 April 2008, versus wrote:
> >> Hi all,
> >>
> >> where can I find more information regarding jetty-configuration?
> >> I took a look at the
> >> http://cwiki.apache.org/CXF20DOC/jetty-configuration.html page, but
> >> some things are still unclear to me, e.g. how does this fit in the
> >> server configuration/initialization and what should be done on the
> >> client side?
> >>
> >> What I want to setup is: unit testing framework = cxf + embedded
> >> jetty with session support
> >> The setup should be as easy as possible.
> >>
> >> Thanks for any help!
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer, IONA
> > dkulp@apache.org
> > http://www.dankulp.com/blog



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Re: Embedded jetty with session support

Posted by versus <vl...@gmail.com>.
Hi Dan,

thanks for your fast answer. The proposed solutions worked.
Now I have another question: 
- I'm writing unit tests for web service implementation which gets some
config through the session 
(servlet reads the init params and stores the config in the session). 
Unfortunately, the implementation can't be changed. Somehow I need to pass
this config from the client.
What are possible options? I'm interested in easy solution.

Keep up the great job! I already convinced a friend developer to switch to
CXF ;-)


dkulp wrote:
> 
> 
> Hm...  well, this isn't quite as easy as I had hoped it would be due to a 
> protected method that probably should be public.  
> 
> Right now, the ONLY way to configure the session support is via a spring 
> config.   Thus, in your test, you could have a spring xml config to 
> configure the session support and create a Bus based on that prior to 
> publishing your service.    The OTHER option is to publish a dummy 
> service on the port you want so the jetty engine starts up, grab the 
> JettyHTTPServerEngineFactory from the bus, get the JettyHTTPServerEngine 
> for the port, call the setSessionSupport(true) method, then publish the 
> real service you want.
> 
> The main problem is that the method:
> JettyHTTPServerEngine createJettyHTTPServerEngine(int port, String 
> protocol)
> on the JettyHTTPServerEngineFactory is not public.   I'm going to make it 
> public in my next commit.   Ideally, you would get the 
> JettyHTTPServerEngineFactory from the Bus, call that method to get the 
> engine for the port you want, configure it, then publish your service.   
> Right now, the dummy service needs to be published first to make sure 
> that method is called.
> 
> Dan
> 
> 
> 
> 
> On Monday 14 April 2008, versus wrote:
>> Hi all,
>>
>> where can I find more information regarding jetty-configuration?
>> I took a look at the
>> http://cwiki.apache.org/CXF20DOC/jetty-configuration.html page, but
>> some things are still unclear to me, e.g. how does this fit in the
>> server configuration/initialization and what should be done on the
>> client side?
>>
>> What I want to setup is: unit testing framework = cxf + embedded jetty
>> with session support
>> The setup should be as easy as possible.
>>
>> Thanks for any help!
> 
> 
> 
> -- 
> J. Daniel Kulp
> Principal Engineer, IONA
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: http://www.nabble.com/Embedded-jetty-with-session-support-tp16685265p16700576.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Embedded jetty with session support

Posted by Daniel Kulp <dk...@apache.org>.
Hm...  well, this isn't quite as easy as I had hoped it would be due to a 
protected method that probably should be public.  

Right now, the ONLY way to configure the session support is via a spring 
config.   Thus, in your test, you could have a spring xml config to 
configure the session support and create a Bus based on that prior to 
publishing your service.    The OTHER option is to publish a dummy 
service on the port you want so the jetty engine starts up, grab the 
JettyHTTPServerEngineFactory from the bus, get the JettyHTTPServerEngine 
for the port, call the setSessionSupport(true) method, then publish the 
real service you want.

The main problem is that the method:
JettyHTTPServerEngine createJettyHTTPServerEngine(int port, String 
protocol)
on the JettyHTTPServerEngineFactory is not public.   I'm going to make it 
public in my next commit.   Ideally, you would get the 
JettyHTTPServerEngineFactory from the Bus, call that method to get the 
engine for the port you want, configure it, then publish your service.   
Right now, the dummy service needs to be published first to make sure 
that method is called.

Dan




On Monday 14 April 2008, versus wrote:
> Hi all,
>
> where can I find more information regarding jetty-configuration?
> I took a look at the
> http://cwiki.apache.org/CXF20DOC/jetty-configuration.html page, but
> some things are still unclear to me, e.g. how does this fit in the
> server configuration/initialization and what should be done on the
> client side?
>
> What I want to setup is: unit testing framework = cxf + embedded jetty
> with session support
> The setup should be as easy as possible.
>
> Thanks for any help!



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog