cmoulliard wrote:
Is there a jira ticket opened about OSGI modification discussed in this
post ?
I'm a user of Apache ServiceMix 4 - Apache Felix Karaf where I would like to
modify an existing component camel-web
(
http://camel.apache.org/web-console.html
<
http://camel.apache.org/web-console.html> ) based on Jersey.
Unfortunately, I'm blocked now due to classloading/resources config issues.
Regards,
Charles
> Paul Sandoz wrote:
>>
>> On Sep 28, 2009, at 11:29 PM, Vlatko Davidovski wrote:
>>
>>> Thanks for your feedback Paul! Could you be more specific in the
>>> steps to be taken.
>> First, I think it is going to require some changes to the Atmosphere
>> spade server to ensure better programatic configuration of Jersey:
>>
>> - The spade server needs to support registering of an instance or a
>> class of Application.
>>
>> Jean-Francois, that should be easy to declare the class of the
>> Application to use in the AtmosphereAdapter. You can also declare an
>> instance by directly instantiating Jersey's ServletContainer and
>> passing the instance to the constructor (in the latest SNAPSHOT source).
>>
>>
>> Second, the hack around OSGi would be to obtain a list of all the
>> classes registered in the META-INF/services files. The following files
>> are relevant in the spade-server jar:
>>
>> META-INF/services/com.sun.jersey.spi.inject.InjectableProvider
>> META-INF/services/com.sun.jersey.spi.container.WebApplicationProvider
>> META-INF/services/jersey-server-components
>> META-INF/services/javax.ws.rs.ext.MessageBodyReader
>> META-INF/services/javax.ws.rs.ext.MessageBodyWriter
>> META-INF/services/com.sun.jersey.spi.container.ContainerProvider
>> META-INF/services/com.sun.jersey.spi.StringReaderProvider
>> META-INF/services/com.sun.jersey.spi.container.ContainerRequestFilter
>> META-INF/services/
>> com
>> .sun
>> .jersey.server.impl.model.method.dispatch.ResourceMethodDispatchProvider
>> META-INF/services/com.sun.jersey.spi.HeaderDelegateProvider
>>
>> In your ResourceConfig you can add classes declared in the above files
>> (see the end of the email for the complete set of classes). Note that
>> not all classes may be relevant depending on your dependencies/
>> requirements. But i would start by including everything and then pick
>> off classes you do not require (it is most likely to be stuff in
>> MessageBodyReader and MessageBodyWriter related to say JAXB to Atom
>> etc).
>>
>>
>> Third, you will need to explicitly register the JAX-RS RuntmeDelegate
>> class declared in:
>>
>> META-INF/services/javax.ws.rs.ext.RuntimeDelegate
>>
>> See:
>>
>>
https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/ext/RuntimeDelegate.ht
ml
<
https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/ext/RuntimeDelegate.h
tml>
>> #setInstance%28javax.ws.rs.ext.RuntimeDelegate%29
>>
>> RuntimeDelegate.setInstance(new
>> com.sun.jersey.server.impl.provider.RuntimeDelegate());
>>
>> This should be done in the static main method of your application
>> before any JAX-RS/Jersey classes are utilized.
>>
>>
>> A caveat, i dunno if the above is more complicated than working around
>> the OSGi issues as per the blog entry you sent a link to.
>>
>> Paul.
>>
>>
>>
>>
>> com
>> .sun.jersey.server.impl.model.method.dispatch.VoidVoidDispatchProvider
>> com
>> .sun.jersey.server.impl.model.method.dispatch.HttpReqResDispatchProvider
>> com
>> .sun
>> .jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider
>> com.sun.jersey.server.impl.model.method.dispatch.FormDispatchProvider
>> com
>> .sun
>> .jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider
>> com.sun.jersey.core.impl.provider.header.LocaleProvider
>> com.sun.jersey.core.impl.provider.header.EntityTagProvider
>> com.sun.jersey.core.impl.provider.header.MediaTypeProvider
>> com.sun.jersey.core.impl.provider.header.CacheControlProvider
>> com.sun.jersey.core.impl.provider.header.NewCookieProvider
>> com.sun.jersey.core.impl.provider.header.CookieProvider
>> com.sun.jersey.core.impl.provider.header.URIProvider
>> com.sun.jersey.core.impl.provider.header.DateProvider
>> com.sun.jersey.core.impl.provider.header.StringProvider
>> com
>> .sun
>> .jersey.server.impl.model.parameter.multivalued.StringReaderProviders
>> $TypeFromStringEnum
>> com
>> .sun
>> .jersey.server.impl.model.parameter.multivalued.StringReaderProviders
>> $TypeValueOf
>> com
>> .sun
>> .jersey.server.impl.model.parameter.multivalued.StringReaderProviders
>> $TypeFromString
>> com
>> .sun
>> .jersey.server.impl.model.parameter.multivalued.StringReaderProviders
>> $StringConstructor
>> com
>> .sun
>> .jersey.server.impl.model.parameter.multivalued.StringReaderProviders
>> $DateProvider
>> com
>> .sun
>> .jersey
>> .server.impl.model.parameter.multivalued.JAXBStringReaderProviders
>> $RootElementProvider
>> com
>> .sun
>> .jersey.server.impl.container.httpserver.HttpHandlerContainerProvider
>> com.sun.jersey.server.impl.container.grizzly.GrizzlyContainerProvider
>> com.sun.jersey.server.impl.container.filter.NormalizeFilter
>> com.sun.jersey.server.impl.container.WebApplicationProviderImpl
>> com.sun.jersey.core.impl.provider.xml.SAXParserContextProvider
>> com.sun.jersey.core.impl.provider.xml.XMLStreamReaderContextProvider
>> com.sun.jersey.core.impl.provider.xml.DocumentBuilderFactoryProvider
>> com.sun.jersey.core.impl.provider.xml.TransformerFactoryProvider
>> com.sun.jersey.core.impl.provider.entity.StringProvider
>> com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
>> com.sun.jersey.core.impl.provider.entity.FileProvider
>> com.sun.jersey.core.impl.provider.entity.InputStreamProvider
>> com.sun.jersey.core.impl.provider.entity.DataSourceProvider
>> com.sun.jersey.core.impl.provider.entity.RenderedImageProvider
>> com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider
>> com.sun.jersey.core.impl.provider.entity.FormProvider
>> com.sun.jersey.core.impl.provider.entity.FormMultivaluedMapProvider
>> com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$App
>> com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$Text
>> com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
>> com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$App
>> com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$Text
>> com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
>> com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$App
>> com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$Text
>> com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
>> com.sun.jersey.core.impl.provider.entity.ReaderProvider
>> com.sun.jersey.core.impl.provider.entity.DocumentProvider
>> com.sun.jersey.core.impl.provider.entity.SourceProvider
>> $StreamSourceReader
>> com.sun.jersey.core.impl.provider.entity.SourceProvider$SAXSourceReader
>> com.sun.jersey.core.impl.provider.entity.SourceProvider$DOMSourceReader
>> com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$App
>> com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$Text
>> com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$General
>> com.sun.jersey.core.impl.provider.entity.EntityHolderReader
>> com.sun.jersey.server.impl.template.ViewableMessageBodyWriter
>> com.sun.jersey.core.impl.provider.entity.StringProvider
>> com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
>> com.sun.jersey.core.impl.provider.entity.FileProvider
>> com.sun.jersey.core.impl.provider.entity.InputStreamProvider
>> com.sun.jersey.core.impl.provider.entity.DataSourceProvider
>> com.sun.jersey.core.impl.provider.entity.RenderedImageProvider
>> com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider
>> com.sun.jersey.core.impl.provider.entity.FormProvider
>> com.sun.jersey.core.impl.provider.entity.FormMultivaluedMapProvider
>> com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$App
>> com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$Text
>> com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
>> com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$App
>> com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$Text
>> com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
>> com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$App
>> com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$Text
>> com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
>> com.sun.jersey.core.impl.provider.entity.ReaderProvider
>> com.sun.jersey.core.impl.provider.entity.DocumentProvider
>> com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider
>> com.sun.jersey.core.impl.provider.entity.SourceProvider$SourceWriter
>> org.atmosphere.core.BroadcasterInjector
>> org.atmosphere.core.BroadcasterLookupInjector
>> org.atmosphere.core.AtmosphereEventInjector
>>
>>
>>> Unfortunately I am not that much fluent with all the structure of
>>> Jersey and I just recently started using Atmosphere Spade Server.
>>> It would be great if you could step by step the required actions and
>>> I will do my best to get this thing working under OSGi. At least
>>> with the quick fix.
>>>
>>> Thanks!
>>> Vlatko
>>>
>>>
>>> On Sep 28, 2009, at 8:35 PM, Paul Sandoz wrote:
>>>
>>>> On Sep 28, 2009, at 3:41 PM, Vlatko Davidovski wrote:
>>>>
>>>>> Hi Paul!
>>>>>
>>>>> Thanks so much for the fast reply.
>>>>> I was quite happy to see Atmosphere Spade Server as a module in
>>>>> the system I am developing (a RESTful device gateway for
>>>>> automation) because of the following reasons:
>>>>> - it can run standalone
>>>>> - supports REST
>>>>> - supports Comet
>>>>>
>>>>> However, as I based my system on OSGi, I am now in a serious
>>>>> dilemma on how to continue. Do you have any suggestions on quick
>>>>> fixes I could do to get atmosphere (the Jersey part of it) under
>>>>> OSGi until a decent solution comes from the dev team?
>>>>>
>>>> It seems that you need some changes to the spade server to register
>>>> an implementation of Application/ResourceConfig? that should be
>>>> possible.
>>>>
>>>> The tricky but will be supporting Jersey with META-INF/service.
>>>>
>>>> As a quick fix you could register all the classes declared in those
>>>> files for jersey-core and jersey-server and the atmosphere (see
>>>> jersey-server-components) in the ResourceConfig e.g. you could have
>>>> a special ResourceConfig that does that from which you extend to
>>>> add your application stuff.
>>>>
>>>> Paul.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
<
http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3809349&i=0>
>>>> For additional commands, e-mail: [hidden email]
<
http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3809349&i=1>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
<
http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3809349&i=2>
>>> For additional commands, e-mail: [hidden email]
<
http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3809349&i=3>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
<
http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3809349&i=4>
>> For additional commands, e-mail: [hidden email]
<
http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3809349&i=5>
>>
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
<
http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3809349&i=6>
For additional commands, e-mail: [hidden email]
<
http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3809349&i=7>
_____
View message @
http://n2.nabble.com/Atmosphere-Spade-Server-in-OSGi-tp3719211p3809349.html
<
http://n2.nabble.com/Atmosphere-Spade-Server-in-OSGi-tp3719211p3809349.html
>
To unsubscribe from Re: [Jersey] Re: Atmosphere Spade Server in OSGi, click
<
http://n2.nabble.com/subscriptions/Unsubscribe.jtp?code=Y21vdWxsaWFyZEB4cGV
jdGlzLmNvbXwzODA2NTMyfDYyNTk3NTMzMQ==> here.
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept
for the presence of computer viruses.
XPECTIS - Streamlined Solutions & Services S.A.
**********************************************************************