tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Touzery <emmanuel.touz...@lecip-its.com>
Subject Re: jax-rs @Path annotation scanning
Date Wed, 22 Oct 2014 16:25:50 GMT
Thanks a lot, it works great!

Emmanuel

On 22/10/14 14:59, Romain Manni-Bucau wrote:
> <web-app ...>
>
>      <servlet>
>          <servlet-name>javax.ws.rs.core.Application</servlet-name>
>      </servlet>
>      <servlet-mapping>
>          <servlet-name>javax.ws.rs.core.Application</servlet-name>
>          <url-pattern>/api/*</url-pattern>
>      </servlet-mapping>
> </web-app>
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
>
> 2014-10-22 14:56 GMT+02:00 Emmanuel Touzery <emmanuel.touzery@lecip-its.com>:
>> Hello,
>>
>>      I was hoping that is the case.
>>
>>      OK, if I remove the application class yes I actually see in the log
>> output that the services are detected, they're just bound to another URL
>> than the one we expect. So I just need to fix the @ApplicationPath
>> directive. So that's through the web.xml, however can you just give me an
>> example of that section of the web.xml that works for tomee/apache cxf
>> jax-rs? All the examples I find online have inheriting from Application
>> instead of using the web.xml, for instance there:
>>
>> http://tomee.apache.org/examples-trunk/rest-example-with-application/README.html
>>
>>      Thank you!
>>
>> Emmanuel
>>
>>
>> On 22/10/14 14:42, Romain Manni-Bucau wrote:
>>> Hi
>>>
>>> tomee scans out of the box for it. Here some rules:
>>> 1) no application class: app is scanned
>>> 2) application class(es) exist
>>>      a) they are deployed respecting getClasses()/getSingleton()
>>>      b) if getClasses() = getSingleton() = empty set => we do 1 but
>>> respecting potential @ApplicatinoPath
>>> 3) if you define a servlet in web.xml which has as init param jaxrs
>>> Application fqn then we use it as @Applicatinopath
>>>
>>> Romain Manni-Bucau
>>> Twitter: @rmannibucau
>>> Blog: http://rmannibucau.wordpress.com/
>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>> Github: https://github.com/rmannibucau
>>>
>>>
>>>
>>> 2014-10-22 14:38 GMT+02:00 Emmanuel Touzery
>>> <emmanuel.touzery@lecip-its.com>:
>>>> Hello,
>>>>
>>>>       I know that in glassfish it's possible to do something (with the
>>>> web.xml
>>>> IIRC) and all the services with @Path annotation are automatically taken
>>>> into account by the container. We ported a GF application to tomee and
>>>> the
>>>> way we have it configured now is by listing every JAX-RS service manually
>>>> in
>>>> a class inheriting Application. I tried quickly scanning the classpath
>>>> manually to find classes with the @Path annotation but it was quite slow
>>>> and
>>>> I'm pretty sure something like that must be supported through some option
>>>> or
>>>> optional setup?
>>>>
>>>>       So, how we go about to enable that scanning and spare ourselves that
>>>> typing everytime we add a new JAX-RS service?
>>>>
>>>>       Regards,
>>>>
>>>> Emmanuel
>>


Mime
View raw message