Hi

On Fri, Jul 22, 2011 at 4:05 PM, Carl-Erik Kopseng <[email protected]> wrote:
>> See this section:
>> http://cxf.apache.org/docs/jaxrs-services-configuration.html#JAXRSServicesConfiguration-ConfiguringJAXRSservicesincontainerwithoutSpring
>>
>> At the moment, in/out interceptors will only be picked up if
>> jaxrs.serviceClasses and jaxrs.providers parameters are used instead of
>> javax.ws.rs.Application.
>>
>> It does make sense to get jaxrs.outInterceptors and jaxrs.inInterceptors
>> supported with Application as well
>
> I see that I cannot ATM configure the interceptors through web.xml,
You can if you use jaxrs.serviceClasses and jaxrs.providers, it's a
limitation/bug
that they are not picked up when Application is used - will try to fix it.

> but is there any way of programmatically adding the interceptors from
> my Application class?

Not really given that Application on its own is supposed to be a
portable construct

>I am unsure if I can go the route you linked to,
> as inject two EJBs into one service, and I am unsure of how that could
> be accomplished by just configuration.
>
>                /* Inserts the appropriate EJBs into the rest service.
>                MyService myService = new BudgetService();
>                try {
>                        myService.setTotalCalculator( (ITotalCalculator) 
> getBean(
> "ITotalCalculator" ) );
>                        myService.setInfoStorage( (IInfoStorage) getBean( 
> "IInfoStorage" ) );
>                } catch ( NamingException e ) {
>                        throw new RuntimeException( e );
>                }
>                singletons.add( myService );
>
If BudgetService only delegates to ITotalCalculator and IInfoStorage
then you can get two
root classes registered via jaxrs.serviceClasses. Example, if
BudgetService handles /path/calc  by just delegating to
ITotalCalculator and /path/info - to IInfoStorage then you can have 2
root resources wrapping  ITotalCalculator and  IInfoStorage and
listening on /path/calc and /path/info respectively.

The other workaround is to register a custom CXFNonSpringJaxrsServlet,
override createServerFromApplication() by copying the code from the
superclass and add a call to setInterceptors() just before bean.create
is called

That said, I have it fixed in on the trunk/branches

Cheers, Sergey
However - I'll try to get it fixed such as that interceptors are added
with Application too from web.xml.



> --
> Regards, Carl-Erik
>



-- 
Sergey Beryozkin

http://sberyozkin.blogspot.com
Talend - http://www.talend.com

Reply via email to