Closed GoogleCodeExporter closed 9 years ago
Hi,
unfortunately the focus right now is on providing test coverage for existing functionality and commmiting it to main CXF project.
Please see
http://cxf.apache.org/docs/servlet-transport.html#ServletTransport-Usingtheservl
ettransportwithoutSpring
You can certainly glue this manually by substituting
Endpoint.publish("/Greeter", new GreeterImpl());
for something like
Endpoint.publish("/Greeter", injector.get(GreeterImpl.class));
You can also reuse the scope mechanism since it's based on general-puprose CXF
Interceptors.
To streamline this you'd need a module like JaxRsClient module - if you make
any progress you are welcome to submit a patch here.
Original comment by kuba.bochenski@gmail.com
on 13 Nov 2012 at 10:43
Thanks for the Advice, Kuba. I ended up doing something like this:
public class GuiceCXFServlet extends CXFNonSpringServlet {
@Override
protected void loadBus(ServletConfig servletConfig) {
super.loadBus(servletConfig);
Injector injector = (Injector) servletConfig.getServletContext().getAttribute( Injector.class.getName() );
BusFactory.setDefaultBus(getBus());
MyServiceImpl instance = injector.getInstance(MyServiceImpl.class);
injector.injectMembers(instance);
Endpoint.publish("/myService", instance);
}
}
If I have some time, I will try to understand your ESDL code and do some code
for SOAP Services. If you have any advice to accomplish that, just post here. :)
Original comment by bruno...@gmail.com
on 16 Nov 2012 at 2:17
Hi, and sorry for the late anwser.
Your example is basically the same thing I'd do (altought I don't understand
the need to injectMembers on the MyServiceImpl instance).
The ESDL code is basically wrappers for various setters on the
JaxRsServerFactoryBean.
To understand what's going on I think it's best to start from
JaxRsServerFactoryBeanProvider and then look how those values are bound in the
JaxRsServerModule.
A crucial glue element is GuicePerRequestResourceProvider, which wraps a
regular Guice provider. My problem wiht implenting the SOAP module is that I
can't seem to find an analogous class in the JaxWs codebase.
I don't think there is no valid subresource concept in SOAP, so you can ignore
the SubresourceInterceptor and related code.
The scope handling is done based on CXF interceptors, so it should work out of
the box (although there is no session scope).
Hope this helps - if not don't hesitate to ask
Original comment by kuba.bochenski@gmail.com
on 26 Nov 2012 at 6:06
I was going to create a lot of SOAP services on my current project, but the
plans changed and there will be only one service, so I will stick with the code
above for now.
> Your example is basically the same thing I'd do (altought I don't understand
the need to injectMembers on the MyServiceImpl instance).
I call injectMembers() because I have some fields with @Inject and they need to
be injected. At first I didn't accept injector.getInstance() not doing that,
but It seems the way Guice works for me.
I understood what you said about the provider. If the plans changed again, I
will try to contribute some code.
Original comment by bruno...@gmail.com
on 27 Nov 2012 at 9:30
Original comment by kuba.bochenski@gmail.com
on 27 Jan 2014 at 4:41
Original issue reported on code.google.com by
bruno...@gmail.com
on 12 Nov 2012 at 10:19