You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "J. Fiala" <mo...@fwd.at> on 2016/08/17 17:23:42 UTC

CXF3 - Annotations in the interface are not parsed

Currently annotations in the interface are not parsed by CXF (e.g. 
@Path, @GET, @Produces, @Consumes etc.), it will only read from the 
implementing API class.

This is especially annoying if wadl2java is used to generate the API 
interfaces automatically.
To make it work, one has to manually add the JAXRS-annotations to each 
implementing class.

It would be nice if CXF would read the annotations in the interface in 
the future as well.

Best regards,
Johannes



Re: CXF3 - Annotations in the interface are not parsed

Posted by "J. Fiala" <mo...@fwd.at>.
Vassilis,

Thank you for the input, I resolved this already thanks to Sergey - you 
simply have to cleanup really all JaxRS annotations from the 
implementing class/methods/parameters etc., then it is working as desired!
I accidentally left the @QueryParam at the last parameter and that 
caused the whole method to disappear.

Best regards,
Johannes


Am 18.08.2016 um 19:03 schrieb v.virvilis@biovista.com:
> I can't really help because I have a spring configuration xml for SOAP 
> services not REST.
>
> In case you can draw any parallels or just rule out this path of 
> debugging here how  it looks like:
>
>         <bean id="beaService" class="com.biovista.ws.impl.BEAService">
>         </bean>
>
>         <simple:server id="bea" address="/BEAService"
> serviceClass="com.biovista.lib.ws.iface.BEAService" 
> serviceBean="#beaService">
>                 <simple:dataBinding>
>                         <bean 
> class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
>                 </simple:dataBinding>
>         </simple:server>
>
> The serviceClass is the interface and the serviceBean is the 
> implementing class. The name of both are the same but they live in 
> different packages impl vs iface.
>
> Hope that may help somehow...
>
>     Vassilis
>
>
> On 2016-08-18 17:18, J. Fiala wrote:
>> Hi,
>>
>> I defined the implementing class in the spring configuration (as
>> spring always require to define the implementing class - changing to
>> the interface will result in
>> "org.springframework.beans.BeanInstantiationException - Specified
>> class is an interface"):
>>
>> <bean id="myController" class="at.hello.HelloWorldServiceImpl" />
>>
>> and then defined in the jaxrs:server:
>>
>> <jaxrs:server id="restServer" address="/myserver">
>>         <jaxrs:serviceBeans>
>>             <ref bean="myController" />
>>         </jaxrs:serviceBeans>
>>         <jaxrs:providers>
>>             <ref bean="jsonProvider" />
>>
>> ...
>>
>> Best regards,
>>
>> Johannes
>>
>>
>> Am 18.08.2016 um 16:07 schrieb Vassilis Virvilis:
>>> Hi,
>>>
>>> jumping in and trying a lucky shot...
>>>
>>> Is your packaging information correct? Maybe you have specified the 
>>> impl class and not the interface on the config file...
>>>
>>>     Vassilis
>>>
>>>
>>> On 08/18/2016 05:01 PM, J. Fiala wrote:
>>>> That's exactly what I would like to do - if I remove the annotations
>>>> from the implementing class methods, they vanish from the WADL.
>>>>
>>>> Best regards,
>>>> Johannes
>>>>
>>>>
>>>> Am 18.08.2016 um 15:54 schrieb Sergey Beryozkin:
>>>>> It's invalid per the JAX-RS spec - see its annotation inheritance
>>>>> section, you can not have JAX-RS annotations spread over the 
>>>>> interface
>>>>> and impl, just keep them all on the interface
>>>>>
>>>>> Cheers, Sergey
>>>>> On 18/08/16 14:18, J. Fiala wrote:
>>>>>> Sure:
>>>>>>
>>>>>> Interface (generated using wadl2java):
>>>>>>
>>>>>> @Path("/helloWorld")
>>>>>> public interface HelloWorldResource {
>>>>>>
>>>>>>     @GET
>>>>>>     @Produces("application/json")
>>>>>>     @Path("/find")
>>>>>>     String sayHello(@QueryParam("name") String name);
>>>>>>
>>>>>> }
>>>>>>
>>>>>> // @Path is read from the interface correctly
>>>>>> public class HelloWorldServiceImpl implements HelloWorldResource {
>>>>>>
>>>>>>     // if e.g. @GET is removed, the method will no longer appear 
>>>>>> in the
>>>>>> generated WADL
>>>>>>    // so the annotations at the interface method are effectively 
>>>>>> ignored
>>>>>>
>>>>>>     @GET
>>>>>>     @Consumes({ "application/json" })
>>>>>>     @Produces("application/json")
>>>>>>     @Path("/find")
>>>>>>     @Description(value = "Say hello service", target = 
>>>>>> DocTarget.METHOD)
>>>>>>        String sayHello(@QueryParam("name") String name) {
>>>>>>
>>>>>>     return "hello " + name;
>>>>>>
>>>>>> }
>>>>>>
>>>>>> }
>>>>>>
>>>>>> I can also assemble a small example project if you need it.
>>>>>>
>>>>>> Best regards,
>>>>>> Johannes
>>>>>>
>>>>>> Am 18.08.2016 um 13:21 schrieb Sergey Beryozkin:
>>>>>>> Can you prototype here an interface and an impl class please
>>>>>>>
>>>>>>> thanks, Sergey
>>>>>>> On 18/08/16 12:11, J. Fiala wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> No, that has nothing to do with Swagger, I'm only working with the
>>>>>>>> generated WADL here.
>>>>>>>>
>>>>>>>> The @Path-annotation on the implementing class can be removed, 
>>>>>>>> here
>>>>>>>> picking up from the interface works correctly.
>>>>>>>>
>>>>>>>> However, if I remove @GET/@Path/@Consumes/@Produces from the 
>>>>>>>> method in
>>>>>>>> the implementing class, it will vanish from the generated WADL.
>>>>>>>> the spring configuration (as spring always require to define 
>>>>>>>> the implementing class - changing to the interface will result 
>>>>>>>> in "org.springframework.beans.BeanInstantiationExcept
>>>>>>>> So basically all the annotations at the method level in the 
>>>>>>>> interface
>>>>>>>> are ignored (I'm using CXF 3.1.6).
>>>>>>>>
>>>>>>>> Verified using Spring CXF Boot + using Jboss EAP 6.
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>>
>>>>>>>> Johannes
>>>>>>>>
>>>>>>>>
>>>>>>>> Am 18.08.2016 um 00:32 schrieb Sergey Beryozkin:
>>>>>>>>> Hmm is it somehow related to that Swagger related issue ? The
>>>>>>>>> interface annotation inheritance works just fine in CXF as far 
>>>>>>>>> as I
>>>>>>>>> know, as far as enabling JAX-RS endpoints is concerned
>>>>>>>>>
>>>>>>>>> Note we've seen users reporting Swagger2feature can not handle 
>>>>>>>>> it but
>>>>>>>>> a user has just confirmed that it worked fine in the end - we 
>>>>>>>>> have
>>>>>>>>> another pending issue with Swagger not handling multi-bundle case
>>>>>>>>> well, but that is another story
>>>>>>>>>
>>>>>>>>> Sergey
>>>>>>>>> On 17/08/16 18:23, J. Fiala wrote:
>>>>>>>>>> Currently annotations in the interface are not parsed by CXF 
>>>>>>>>>> (e.g.
>>>>>>>>>> @Path, @GET, @Produces, @Consumes etc.), it will only read 
>>>>>>>>>> from the
>>>>>>>>>> implementing API class.
>>>>>>>>>>
>>>>>>>>>> This is especially annoying if wadl2java is used to generate 
>>>>>>>>>> the API
>>>>>>>>>> interfaces automatically.
>>>>>>>>>> To make it work, one has to manually add the 
>>>>>>>>>> JAXRS-annotations to
>>>>>>>>>> each
>>>>>>>>>> implementing class.
>>>>>>>>>>
>>>>>>>>>> It would be nice if CXF would read the annotations in the
>>>>>>>>>> interface in
>>>>>>>>>> the future as well.
>>>>>>>>>>
>>>>>>>>>> Best regards,
>>>>>>>>>> Johannes
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>


Re: CXF3 - Annotations in the interface are not parsed

Posted by v....@biovista.com.
I can't really help because I have a spring configuration xml for SOAP 
services not REST.

In case you can draw any parallels or just rule out this path of 
debugging here how  it looks like:

         <bean id="beaService" class="com.biovista.ws.impl.BEAService">
         </bean>

         <simple:server id="bea" address="/BEAService"
                 serviceClass="com.biovista.lib.ws.iface.BEAService" 
serviceBean="#beaService">
                 <simple:dataBinding>
                         <bean 
class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
                 </simple:dataBinding>
         </simple:server>

The serviceClass is the interface and the serviceBean is the 
implementing class. The name of both are the same but they live in 
different packages impl vs iface.

Hope that may help somehow...

     Vassilis


On 2016-08-18 17:18, J. Fiala wrote:
> Hi,
> 
> I defined the implementing class in the spring configuration (as
> spring always require to define the implementing class - changing to
> the interface will result in
> "org.springframework.beans.BeanInstantiationException - Specified
> class is an interface"):
> 
> <bean id="myController" class="at.hello.HelloWorldServiceImpl" />
> 
> and then defined in the jaxrs:server:
> 
> <jaxrs:server id="restServer" address="/myserver">
>         <jaxrs:serviceBeans>
>             <ref bean="myController" />
>         </jaxrs:serviceBeans>
>         <jaxrs:providers>
>             <ref bean="jsonProvider" />
> 
> ...
> 
> Best regards,
> 
> Johannes
> 
> 
> Am 18.08.2016 um 16:07 schrieb Vassilis Virvilis:
>> Hi,
>> 
>> jumping in and trying a lucky shot...
>> 
>> Is your packaging information correct? Maybe you have specified the 
>> impl class and not the interface on the config file...
>> 
>>     Vassilis
>> 
>> 
>> On 08/18/2016 05:01 PM, J. Fiala wrote:
>>> That's exactly what I would like to do - if I remove the annotations
>>> from the implementing class methods, they vanish from the WADL.
>>> 
>>> Best regards,
>>> Johannes
>>> 
>>> 
>>> Am 18.08.2016 um 15:54 schrieb Sergey Beryozkin:
>>>> It's invalid per the JAX-RS spec - see its annotation inheritance
>>>> section, you can not have JAX-RS annotations spread over the 
>>>> interface
>>>> and impl, just keep them all on the interface
>>>> 
>>>> Cheers, Sergey
>>>> On 18/08/16 14:18, J. Fiala wrote:
>>>>> Sure:
>>>>> 
>>>>> Interface (generated using wadl2java):
>>>>> 
>>>>> @Path("/helloWorld")
>>>>> public interface HelloWorldResource {
>>>>> 
>>>>>     @GET
>>>>>     @Produces("application/json")
>>>>>     @Path("/find")
>>>>>     String sayHello(@QueryParam("name") String name);
>>>>> 
>>>>> }
>>>>> 
>>>>> // @Path is read from the interface correctly
>>>>> public class HelloWorldServiceImpl implements HelloWorldResource {
>>>>> 
>>>>>     // if e.g. @GET is removed, the method will no longer appear in 
>>>>> the
>>>>> generated WADL
>>>>>    // so the annotations at the interface method are effectively 
>>>>> ignored
>>>>> 
>>>>>     @GET
>>>>>     @Consumes({ "application/json" })
>>>>>     @Produces("application/json")
>>>>>     @Path("/find")
>>>>>     @Description(value = "Say hello service", target = 
>>>>> DocTarget.METHOD)
>>>>>        String sayHello(@QueryParam("name") String name) {
>>>>> 
>>>>>     return "hello " + name;
>>>>> 
>>>>> }
>>>>> 
>>>>> }
>>>>> 
>>>>> I can also assemble a small example project if you need it.
>>>>> 
>>>>> Best regards,
>>>>> Johannes
>>>>> 
>>>>> Am 18.08.2016 um 13:21 schrieb Sergey Beryozkin:
>>>>>> Can you prototype here an interface and an impl class please
>>>>>> 
>>>>>> thanks, Sergey
>>>>>> On 18/08/16 12:11, J. Fiala wrote:
>>>>>>> Hi,
>>>>>>> 
>>>>>>> No, that has nothing to do with Swagger, I'm only working with 
>>>>>>> the
>>>>>>> generated WADL here.
>>>>>>> 
>>>>>>> The @Path-annotation on the implementing class can be removed, 
>>>>>>> here
>>>>>>> picking up from the interface works correctly.
>>>>>>> 
>>>>>>> However, if I remove @GET/@Path/@Consumes/@Produces from the 
>>>>>>> method in
>>>>>>> the implementing class, it will vanish from the generated WADL.
>>>>>>> the spring configuration (as spring always require to define the 
>>>>>>> implementing class - changing to the interface will result in 
>>>>>>> "org.springframework.beans.BeanInstantiationExcept
>>>>>>> So basically all the annotations at the method level in the 
>>>>>>> interface
>>>>>>> are ignored (I'm using CXF 3.1.6).
>>>>>>> 
>>>>>>> Verified using Spring CXF Boot + using Jboss EAP 6.
>>>>>>> 
>>>>>>> Best regards,
>>>>>>> 
>>>>>>> Johannes
>>>>>>> 
>>>>>>> 
>>>>>>> Am 18.08.2016 um 00:32 schrieb Sergey Beryozkin:
>>>>>>>> Hmm is it somehow related to that Swagger related issue ? The
>>>>>>>> interface annotation inheritance works just fine in CXF as far 
>>>>>>>> as I
>>>>>>>> know, as far as enabling JAX-RS endpoints is concerned
>>>>>>>> 
>>>>>>>> Note we've seen users reporting Swagger2feature can not handle 
>>>>>>>> it but
>>>>>>>> a user has just confirmed that it worked fine in the end - we 
>>>>>>>> have
>>>>>>>> another pending issue with Swagger not handling multi-bundle 
>>>>>>>> case
>>>>>>>> well, but that is another story
>>>>>>>> 
>>>>>>>> Sergey
>>>>>>>> On 17/08/16 18:23, J. Fiala wrote:
>>>>>>>>> Currently annotations in the interface are not parsed by CXF 
>>>>>>>>> (e.g.
>>>>>>>>> @Path, @GET, @Produces, @Consumes etc.), it will only read from 
>>>>>>>>> the
>>>>>>>>> implementing API class.
>>>>>>>>> 
>>>>>>>>> This is especially annoying if wadl2java is used to generate 
>>>>>>>>> the API
>>>>>>>>> interfaces automatically.
>>>>>>>>> To make it work, one has to manually add the JAXRS-annotations 
>>>>>>>>> to
>>>>>>>>> each
>>>>>>>>> implementing class.
>>>>>>>>> 
>>>>>>>>> It would be nice if CXF would read the annotations in the
>>>>>>>>> interface in
>>>>>>>>> the future as well.
>>>>>>>>> 
>>>>>>>>> Best regards,
>>>>>>>>> Johannes
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 

Re: CXF3 - Annotations in the interface are not parsed

Posted by "J. Fiala" <mo...@fwd.at>.
Hi,

I defined the implementing class in the spring configuration (as spring 
always require to define the implementing class - changing to the 
interface will result in 
"org.springframework.beans.BeanInstantiationException - Specified class 
is an interface"):

<bean id="myController" class="at.hello.HelloWorldServiceImpl" />

and then defined in the jaxrs:server:

<jaxrs:server id="restServer" address="/myserver">
         <jaxrs:serviceBeans>
             <ref bean="myController" />
         </jaxrs:serviceBeans>
         <jaxrs:providers>
             <ref bean="jsonProvider" />

...

Best regards,

Johannes


Am 18.08.2016 um 16:07 schrieb Vassilis Virvilis:
> Hi,
>
> jumping in and trying a lucky shot...
>
> Is your packaging information correct? Maybe you have specified the 
> impl class and not the interface on the config file...
>
>     Vassilis
>
>
> On 08/18/2016 05:01 PM, J. Fiala wrote:
>> That's exactly what I would like to do - if I remove the annotations
>> from the implementing class methods, they vanish from the WADL.
>>
>> Best regards,
>> Johannes
>>
>>
>> Am 18.08.2016 um 15:54 schrieb Sergey Beryozkin:
>>> It's invalid per the JAX-RS spec - see its annotation inheritance
>>> section, you can not have JAX-RS annotations spread over the interface
>>> and impl, just keep them all on the interface
>>>
>>> Cheers, Sergey
>>> On 18/08/16 14:18, J. Fiala wrote:
>>>> Sure:
>>>>
>>>> Interface (generated using wadl2java):
>>>>
>>>> @Path("/helloWorld")
>>>> public interface HelloWorldResource {
>>>>
>>>>     @GET
>>>>     @Produces("application/json")
>>>>     @Path("/find")
>>>>     String sayHello(@QueryParam("name") String name);
>>>>
>>>> }
>>>>
>>>> // @Path is read from the interface correctly
>>>> public class HelloWorldServiceImpl implements HelloWorldResource {
>>>>
>>>>     // if e.g. @GET is removed, the method will no longer appear in 
>>>> the
>>>> generated WADL
>>>>    // so the annotations at the interface method are effectively 
>>>> ignored
>>>>
>>>>     @GET
>>>>     @Consumes({ "application/json" })
>>>>     @Produces("application/json")
>>>>     @Path("/find")
>>>>     @Description(value = "Say hello service", target = 
>>>> DocTarget.METHOD)
>>>>        String sayHello(@QueryParam("name") String name) {
>>>>
>>>>     return "hello " + name;
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>> I can also assemble a small example project if you need it.
>>>>
>>>> Best regards,
>>>> Johannes
>>>>
>>>> Am 18.08.2016 um 13:21 schrieb Sergey Beryozkin:
>>>>> Can you prototype here an interface and an impl class please
>>>>>
>>>>> thanks, Sergey
>>>>> On 18/08/16 12:11, J. Fiala wrote:
>>>>>> Hi,
>>>>>>
>>>>>> No, that has nothing to do with Swagger, I'm only working with the
>>>>>> generated WADL here.
>>>>>>
>>>>>> The @Path-annotation on the implementing class can be removed, here
>>>>>> picking up from the interface works correctly.
>>>>>>
>>>>>> However, if I remove @GET/@Path/@Consumes/@Produces from the 
>>>>>> method in
>>>>>> the implementing class, it will vanish from the generated WADL.
>>>>>>
>>>>>> So basically all the annotations at the method level in the 
>>>>>> interface
>>>>>> are ignored (I'm using CXF 3.1.6).
>>>>>>
>>>>>> Verified using Spring CXF Boot + using Jboss EAP 6.
>>>>>>
>>>>>> Best regards,
>>>>>>
>>>>>> Johannes
>>>>>>
>>>>>>
>>>>>> Am 18.08.2016 um 00:32 schrieb Sergey Beryozkin:
>>>>>>> Hmm is it somehow related to that Swagger related issue ? The
>>>>>>> interface annotation inheritance works just fine in CXF as far as I
>>>>>>> know, as far as enabling JAX-RS endpoints is concerned
>>>>>>>
>>>>>>> Note we've seen users reporting Swagger2feature can not handle 
>>>>>>> it but
>>>>>>> a user has just confirmed that it worked fine in the end - we have
>>>>>>> another pending issue with Swagger not handling multi-bundle case
>>>>>>> well, but that is another story
>>>>>>>
>>>>>>> Sergey
>>>>>>> On 17/08/16 18:23, J. Fiala wrote:
>>>>>>>> Currently annotations in the interface are not parsed by CXF (e.g.
>>>>>>>> @Path, @GET, @Produces, @Consumes etc.), it will only read from 
>>>>>>>> the
>>>>>>>> implementing API class.
>>>>>>>>
>>>>>>>> This is especially annoying if wadl2java is used to generate 
>>>>>>>> the API
>>>>>>>> interfaces automatically.
>>>>>>>> To make it work, one has to manually add the JAXRS-annotations to
>>>>>>>> each
>>>>>>>> implementing class.
>>>>>>>>
>>>>>>>> It would be nice if CXF would read the annotations in the
>>>>>>>> interface in
>>>>>>>> the future as well.
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> Johannes
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>>
>


Re: CXF3 - Annotations in the interface are not parsed

Posted by Vassilis Virvilis <v....@biovista.com>.
Hi,

jumping in and trying a lucky shot...

Is your packaging information correct? Maybe you have specified the impl 
class and not the interface on the config file...

     Vassilis


On 08/18/2016 05:01 PM, J. Fiala wrote:
> That's exactly what I would like to do - if I remove the annotations
> from the implementing class methods, they vanish from the WADL.
>
> Best regards,
> Johannes
>
>
> Am 18.08.2016 um 15:54 schrieb Sergey Beryozkin:
>> It's invalid per the JAX-RS spec - see its annotation inheritance
>> section, you can not have JAX-RS annotations spread over the interface
>> and impl, just keep them all on the interface
>>
>> Cheers, Sergey
>> On 18/08/16 14:18, J. Fiala wrote:
>>> Sure:
>>>
>>> Interface (generated using wadl2java):
>>>
>>> @Path("/helloWorld")
>>> public interface HelloWorldResource {
>>>
>>>     @GET
>>>     @Produces("application/json")
>>>     @Path("/find")
>>>     String sayHello(@QueryParam("name") String name);
>>>
>>> }
>>>
>>> // @Path is read from the interface correctly
>>> public class HelloWorldServiceImpl implements HelloWorldResource {
>>>
>>>     // if e.g. @GET is removed, the method will no longer appear in the
>>> generated WADL
>>>    // so the annotations at the interface method are effectively ignored
>>>
>>>     @GET
>>>     @Consumes({ "application/json" })
>>>     @Produces("application/json")
>>>     @Path("/find")
>>>     @Description(value = "Say hello service", target = DocTarget.METHOD)
>>>        String sayHello(@QueryParam("name") String name) {
>>>
>>>     return "hello " + name;
>>>
>>> }
>>>
>>> }
>>>
>>> I can also assemble a small example project if you need it.
>>>
>>> Best regards,
>>> Johannes
>>>
>>> Am 18.08.2016 um 13:21 schrieb Sergey Beryozkin:
>>>> Can you prototype here an interface and an impl class please
>>>>
>>>> thanks, Sergey
>>>> On 18/08/16 12:11, J. Fiala wrote:
>>>>> Hi,
>>>>>
>>>>> No, that has nothing to do with Swagger, I'm only working with the
>>>>> generated WADL here.
>>>>>
>>>>> The @Path-annotation on the implementing class can be removed, here
>>>>> picking up from the interface works correctly.
>>>>>
>>>>> However, if I remove @GET/@Path/@Consumes/@Produces from the method in
>>>>> the implementing class, it will vanish from the generated WADL.
>>>>>
>>>>> So basically all the annotations at the method level in the interface
>>>>> are ignored (I'm using CXF 3.1.6).
>>>>>
>>>>> Verified using Spring CXF Boot + using Jboss EAP 6.
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Johannes
>>>>>
>>>>>
>>>>> Am 18.08.2016 um 00:32 schrieb Sergey Beryozkin:
>>>>>> Hmm is it somehow related to that Swagger related issue ? The
>>>>>> interface annotation inheritance works just fine in CXF as far as I
>>>>>> know, as far as enabling JAX-RS endpoints is concerned
>>>>>>
>>>>>> Note we've seen users reporting Swagger2feature can not handle it but
>>>>>> a user has just confirmed that it worked fine in the end - we have
>>>>>> another pending issue with Swagger not handling multi-bundle case
>>>>>> well, but that is another story
>>>>>>
>>>>>> Sergey
>>>>>> On 17/08/16 18:23, J. Fiala wrote:
>>>>>>> Currently annotations in the interface are not parsed by CXF (e.g.
>>>>>>> @Path, @GET, @Produces, @Consumes etc.), it will only read from the
>>>>>>> implementing API class.
>>>>>>>
>>>>>>> This is especially annoying if wadl2java is used to generate the API
>>>>>>> interfaces automatically.
>>>>>>> To make it work, one has to manually add the JAXRS-annotations to
>>>>>>> each
>>>>>>> implementing class.
>>>>>>>
>>>>>>> It would be nice if CXF would read the annotations in the
>>>>>>> interface in
>>>>>>> the future as well.
>>>>>>>
>>>>>>> Best regards,
>>>>>>> Johannes
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>
>

-- 

__________________________________

Vassilis Virvilis Ph.D.
Head of IT
Biovista Inc.

Stay tuned
www: http://www.biovista.com
LinkedIn: https://www.linkedin.com/company/biovista
Twitter: https://twitter.com/BiovistaInc/
Facebook: https://www.facebook.com/biovistainc
    Vizit (research): 
https://www.facebook.com/Biovista-Vizit-888532217910104/?ref=hl
Google+: https://plus.google.com/105184050931054521199
Tumblr: http://biovista.tumblr.com/
YouTube: https://www.youtube.com/user/BiovistaInc

--
US Offices
2421 Ivy Road
Charlottesville, VA 22903
USA
T: +1.434.971.1141
F: +1.434.971.1144

European Offices
34 Rodopoleos Street
Ellinikon, Athens 16777
GREECE
T: +30.210.9629848
F: +30.210.9647606

Biovista is a privately held biotechnology company that finds novel uses 
for existing drugs, and profiles their side effects using their 
mechanism of action. Biovista develops its own pipeline of drugs in CNS, 
oncology, auto-immune and rare diseases. Biovista is collaborating with 
biopharmaceutical companies on indication expansion and de-risking of 
their portfolios and with the FDA on adverse event prediction.



Re: CXF3 - Annotations in the interface are not parsed

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 18/08/16 16:02, J. Fiala wrote:
> Sergey,
>
> Sorry I found the cause - one of the parameters were still annotated.
> So if the method/parameters are all clean, it works as expected (it's
> also possible to have a mix - any clean or fully annotated method at the
> implementing class works as expected).
>
> So if there is any annotation on the method or any of the parameters, it
> will get lost, although the interface has the complete correct declaration.

It is true but the spec has a clear position on it. We've discussed this 
with several users before. Spreading the JAXRS annotations is 
problematic from the maintenance point of view and is basically an 
anti-pattern.

Glad you see it working now

Sergey
> The only exception to this rule is the (CXF)-@Description annotation,
> which presence will not cause the method to vanish (although the
> annotation is ignored then by the WadlGenerator).
>
> public class HelloWorldServiceImpl implements HelloWorldResource {
>
> // @QueryParam("name")  will cause this method to vanish.
>  public String sayHello(@QueryParam("name") String name) {
>
>     return "hello " + name;
>
> }
>
> }
>
> Best regards,
>
> Johannes
>
>
> Am 18.08.2016 um 16:43 schrieb Sergey Beryozkin:
>> So let me double check, are you saying of you have
>>
>> @Path("/helloWorld")
>> public interface HelloWorldResource {
>>
>>     @GET
>>     @Produces("application/json")
>>     @Path("/find")
>>     String sayHello(@QueryParam("name") String name);
>>
>> }
>>
>> public class HelloWorldServiceImpl implements HelloWorldResource {
>>    public String sayHello(String name) {
>>
>>     return "hello " + name;
>>
>> }
>>
>> }
>>
>> it does not work (note with absolutely all JAXRS method annotations
>> gone) ?
>> You said below
>>
>> // if e.g. @GET is removed, the method will no longer appear in the
>> >>> generated WADL
>> >>>    // so the annotations at the interface method are effectively
>> ignored
>> >>>
>>
>> but all annotations have to go...
>> Sergey
>>
>> On 18/08/16 15:01, J. Fiala wrote:
>>> That's exactly what I would like to do - if I remove the annotations
>>> from the implementing class methods, they vanish from the WADL.
>>>
>>> Best regards,
>>> Johannes
>>>
>>>
>>> Am 18.08.2016 um 15:54 schrieb Sergey Beryozkin:
>>>> It's invalid per the JAX-RS spec - see its annotation inheritance
>>>> section, you can not have JAX-RS annotations spread over the interface
>>>> and impl, just keep them all on the interface
>>>>
>>>> Cheers, Sergey
>>>> On 18/08/16 14:18, J. Fiala wrote:
>>>>> Sure:
>>>>>
>>>>> Interface (generated using wadl2java):
>>>>>
>>>>> @Path("/helloWorld")
>>>>> public interface HelloWorldResource {
>>>>>
>>>>>     @GET
>>>>>     @Produces("application/json")
>>>>>     @Path("/find")
>>>>>     String sayHello(@QueryParam("name") String name);
>>>>>
>>>>> }
>>>>>
>>>>> // @Path is read from the interface correctly
>>>>> public class HelloWorldServiceImpl implements HelloWorldResource {
>>>>>
>>>>>     // if e.g. @GET is removed, the method will no longer appear in
>>>>> the
>>>>> generated WADL
>>>>>    // so the annotations at the interface method are effectively
>>>>> ignored
>>>>>
>>>>>     @GET
>>>>>     @Consumes({ "application/json" })
>>>>>     @Produces("application/json")
>>>>>     @Path("/find")
>>>>>     @Description(value = "Say hello service", target =
>>>>> DocTarget.METHOD)
>>>>>        String sayHello(@QueryParam("name") String name) {
>>>>>
>>>>>     return "hello " + name;
>>>>>
>>>>> }
>>>>>
>>>>> }
>>>>>
>>>>> I can also assemble a small example project if you need it.
>>>>>
>>>>> Best regards,
>>>>> Johannes
>>>>>
>>>>> Am 18.08.2016 um 13:21 schrieb Sergey Beryozkin:
>>>>>> Can you prototype here an interface and an impl class please
>>>>>>
>>>>>> thanks, Sergey
>>>>>> On 18/08/16 12:11, J. Fiala wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> No, that has nothing to do with Swagger, I'm only working with the
>>>>>>> generated WADL here.
>>>>>>>
>>>>>>> The @Path-annotation on the implementing class can be removed, here
>>>>>>> picking up from the interface works correctly.
>>>>>>>
>>>>>>> However, if I remove @GET/@Path/@Consumes/@Produces from the
>>>>>>> method in
>>>>>>> the implementing class, it will vanish from the generated WADL.
>>>>>>>
>>>>>>> So basically all the annotations at the method level in the
>>>>>>> interface
>>>>>>> are ignored (I'm using CXF 3.1.6).
>>>>>>>
>>>>>>> Verified using Spring CXF Boot + using Jboss EAP 6.
>>>>>>>
>>>>>>> Best regards,
>>>>>>>
>>>>>>> Johannes
>>>>>>>
>>>>>>>
>>>>>>> Am 18.08.2016 um 00:32 schrieb Sergey Beryozkin:
>>>>>>>> Hmm is it somehow related to that Swagger related issue ? The
>>>>>>>> interface annotation inheritance works just fine in CXF as far as I
>>>>>>>> know, as far as enabling JAX-RS endpoints is concerned
>>>>>>>>
>>>>>>>> Note we've seen users reporting Swagger2feature can not handle
>>>>>>>> it but
>>>>>>>> a user has just confirmed that it worked fine in the end - we have
>>>>>>>> another pending issue with Swagger not handling multi-bundle case
>>>>>>>> well, but that is another story
>>>>>>>>
>>>>>>>> Sergey
>>>>>>>> On 17/08/16 18:23, J. Fiala wrote:
>>>>>>>>> Currently annotations in the interface are not parsed by CXF (e.g.
>>>>>>>>> @Path, @GET, @Produces, @Consumes etc.), it will only read from
>>>>>>>>> the
>>>>>>>>> implementing API class.
>>>>>>>>>
>>>>>>>>> This is especially annoying if wadl2java is used to generate
>>>>>>>>> the API
>>>>>>>>> interfaces automatically.
>>>>>>>>> To make it work, one has to manually add the JAXRS-annotations to
>>>>>>>>> each
>>>>>>>>> implementing class.
>>>>>>>>>
>>>>>>>>> It would be nice if CXF would read the annotations in the
>>>>>>>>> interface in
>>>>>>>>> the future as well.
>>>>>>>>>
>>>>>>>>> Best regards,
>>>>>>>>> Johannes
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Re: CXF3 - Annotations in the interface are not parsed

Posted by "J. Fiala" <mo...@fwd.at>.
Sergey,

Sorry I found the cause - one of the parameters were still annotated.
So if the method/parameters are all clean, it works as expected (it's 
also possible to have a mix - any clean or fully annotated method at the 
implementing class works as expected).

So if there is any annotation on the method or any of the parameters, it 
will get lost, although the interface has the complete correct declaration.
The only exception to this rule is the (CXF)-@Description annotation, 
which presence will not cause the method to vanish (although the 
annotation is ignored then by the WadlGenerator).

public class HelloWorldServiceImpl implements HelloWorldResource {

// @QueryParam("name")  will cause this method to vanish.
  public String sayHello(@QueryParam("name") String name) {

     return "hello " + name;

}

}

Best regards,

Johannes


Am 18.08.2016 um 16:43 schrieb Sergey Beryozkin:
> So let me double check, are you saying of you have
>
> @Path("/helloWorld")
> public interface HelloWorldResource {
>
>     @GET
>     @Produces("application/json")
>     @Path("/find")
>     String sayHello(@QueryParam("name") String name);
>
> }
>
> public class HelloWorldServiceImpl implements HelloWorldResource {
>    public String sayHello(String name) {
>
>     return "hello " + name;
>
> }
>
> }
>
> it does not work (note with absolutely all JAXRS method annotations 
> gone) ?
> You said below
>
> // if e.g. @GET is removed, the method will no longer appear in the
> >>> generated WADL
> >>>    // so the annotations at the interface method are effectively 
> ignored
> >>>
>
> but all annotations have to go...
> Sergey
>
> On 18/08/16 15:01, J. Fiala wrote:
>> That's exactly what I would like to do - if I remove the annotations
>> from the implementing class methods, they vanish from the WADL.
>>
>> Best regards,
>> Johannes
>>
>>
>> Am 18.08.2016 um 15:54 schrieb Sergey Beryozkin:
>>> It's invalid per the JAX-RS spec - see its annotation inheritance
>>> section, you can not have JAX-RS annotations spread over the interface
>>> and impl, just keep them all on the interface
>>>
>>> Cheers, Sergey
>>> On 18/08/16 14:18, J. Fiala wrote:
>>>> Sure:
>>>>
>>>> Interface (generated using wadl2java):
>>>>
>>>> @Path("/helloWorld")
>>>> public interface HelloWorldResource {
>>>>
>>>>     @GET
>>>>     @Produces("application/json")
>>>>     @Path("/find")
>>>>     String sayHello(@QueryParam("name") String name);
>>>>
>>>> }
>>>>
>>>> // @Path is read from the interface correctly
>>>> public class HelloWorldServiceImpl implements HelloWorldResource {
>>>>
>>>>     // if e.g. @GET is removed, the method will no longer appear in 
>>>> the
>>>> generated WADL
>>>>    // so the annotations at the interface method are effectively 
>>>> ignored
>>>>
>>>>     @GET
>>>>     @Consumes({ "application/json" })
>>>>     @Produces("application/json")
>>>>     @Path("/find")
>>>>     @Description(value = "Say hello service", target = 
>>>> DocTarget.METHOD)
>>>>        String sayHello(@QueryParam("name") String name) {
>>>>
>>>>     return "hello " + name;
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>> I can also assemble a small example project if you need it.
>>>>
>>>> Best regards,
>>>> Johannes
>>>>
>>>> Am 18.08.2016 um 13:21 schrieb Sergey Beryozkin:
>>>>> Can you prototype here an interface and an impl class please
>>>>>
>>>>> thanks, Sergey
>>>>> On 18/08/16 12:11, J. Fiala wrote:
>>>>>> Hi,
>>>>>>
>>>>>> No, that has nothing to do with Swagger, I'm only working with the
>>>>>> generated WADL here.
>>>>>>
>>>>>> The @Path-annotation on the implementing class can be removed, here
>>>>>> picking up from the interface works correctly.
>>>>>>
>>>>>> However, if I remove @GET/@Path/@Consumes/@Produces from the 
>>>>>> method in
>>>>>> the implementing class, it will vanish from the generated WADL.
>>>>>>
>>>>>> So basically all the annotations at the method level in the 
>>>>>> interface
>>>>>> are ignored (I'm using CXF 3.1.6).
>>>>>>
>>>>>> Verified using Spring CXF Boot + using Jboss EAP 6.
>>>>>>
>>>>>> Best regards,
>>>>>>
>>>>>> Johannes
>>>>>>
>>>>>>
>>>>>> Am 18.08.2016 um 00:32 schrieb Sergey Beryozkin:
>>>>>>> Hmm is it somehow related to that Swagger related issue ? The
>>>>>>> interface annotation inheritance works just fine in CXF as far as I
>>>>>>> know, as far as enabling JAX-RS endpoints is concerned
>>>>>>>
>>>>>>> Note we've seen users reporting Swagger2feature can not handle 
>>>>>>> it but
>>>>>>> a user has just confirmed that it worked fine in the end - we have
>>>>>>> another pending issue with Swagger not handling multi-bundle case
>>>>>>> well, but that is another story
>>>>>>>
>>>>>>> Sergey
>>>>>>> On 17/08/16 18:23, J. Fiala wrote:
>>>>>>>> Currently annotations in the interface are not parsed by CXF (e.g.
>>>>>>>> @Path, @GET, @Produces, @Consumes etc.), it will only read from 
>>>>>>>> the
>>>>>>>> implementing API class.
>>>>>>>>
>>>>>>>> This is especially annoying if wadl2java is used to generate 
>>>>>>>> the API
>>>>>>>> interfaces automatically.
>>>>>>>> To make it work, one has to manually add the JAXRS-annotations to
>>>>>>>> each
>>>>>>>> implementing class.
>>>>>>>>
>>>>>>>> It would be nice if CXF would read the annotations in the
>>>>>>>> interface in
>>>>>>>> the future as well.
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> Johannes
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
>


Re: CXF3 - Annotations in the interface are not parsed

Posted by Sergey Beryozkin <sb...@gmail.com>.
So let me double check, are you saying of you have

@Path("/helloWorld")
public interface HelloWorldResource {

     @GET
     @Produces("application/json")
     @Path("/find")
     String sayHello(@QueryParam("name") String name);

}

public class HelloWorldServiceImpl implements HelloWorldResource {
    public String sayHello(String name) {

     return "hello " + name;

}

}

it does not work (note with absolutely all JAXRS method annotations gone) ?
You said below

// if e.g. @GET is removed, the method will no longer appear in the
 >>> generated WADL
 >>>    // so the annotations at the interface method are effectively 
ignored
 >>>

but all annotations have to go...
Sergey

On 18/08/16 15:01, J. Fiala wrote:
> That's exactly what I would like to do - if I remove the annotations
> from the implementing class methods, they vanish from the WADL.
>
> Best regards,
> Johannes
>
>
> Am 18.08.2016 um 15:54 schrieb Sergey Beryozkin:
>> It's invalid per the JAX-RS spec - see its annotation inheritance
>> section, you can not have JAX-RS annotations spread over the interface
>> and impl, just keep them all on the interface
>>
>> Cheers, Sergey
>> On 18/08/16 14:18, J. Fiala wrote:
>>> Sure:
>>>
>>> Interface (generated using wadl2java):
>>>
>>> @Path("/helloWorld")
>>> public interface HelloWorldResource {
>>>
>>>     @GET
>>>     @Produces("application/json")
>>>     @Path("/find")
>>>     String sayHello(@QueryParam("name") String name);
>>>
>>> }
>>>
>>> // @Path is read from the interface correctly
>>> public class HelloWorldServiceImpl implements HelloWorldResource {
>>>
>>>     // if e.g. @GET is removed, the method will no longer appear in the
>>> generated WADL
>>>    // so the annotations at the interface method are effectively ignored
>>>
>>>     @GET
>>>     @Consumes({ "application/json" })
>>>     @Produces("application/json")
>>>     @Path("/find")
>>>     @Description(value = "Say hello service", target = DocTarget.METHOD)
>>>        String sayHello(@QueryParam("name") String name) {
>>>
>>>     return "hello " + name;
>>>
>>> }
>>>
>>> }
>>>
>>> I can also assemble a small example project if you need it.
>>>
>>> Best regards,
>>> Johannes
>>>
>>> Am 18.08.2016 um 13:21 schrieb Sergey Beryozkin:
>>>> Can you prototype here an interface and an impl class please
>>>>
>>>> thanks, Sergey
>>>> On 18/08/16 12:11, J. Fiala wrote:
>>>>> Hi,
>>>>>
>>>>> No, that has nothing to do with Swagger, I'm only working with the
>>>>> generated WADL here.
>>>>>
>>>>> The @Path-annotation on the implementing class can be removed, here
>>>>> picking up from the interface works correctly.
>>>>>
>>>>> However, if I remove @GET/@Path/@Consumes/@Produces from the method in
>>>>> the implementing class, it will vanish from the generated WADL.
>>>>>
>>>>> So basically all the annotations at the method level in the interface
>>>>> are ignored (I'm using CXF 3.1.6).
>>>>>
>>>>> Verified using Spring CXF Boot + using Jboss EAP 6.
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Johannes
>>>>>
>>>>>
>>>>> Am 18.08.2016 um 00:32 schrieb Sergey Beryozkin:
>>>>>> Hmm is it somehow related to that Swagger related issue ? The
>>>>>> interface annotation inheritance works just fine in CXF as far as I
>>>>>> know, as far as enabling JAX-RS endpoints is concerned
>>>>>>
>>>>>> Note we've seen users reporting Swagger2feature can not handle it but
>>>>>> a user has just confirmed that it worked fine in the end - we have
>>>>>> another pending issue with Swagger not handling multi-bundle case
>>>>>> well, but that is another story
>>>>>>
>>>>>> Sergey
>>>>>> On 17/08/16 18:23, J. Fiala wrote:
>>>>>>> Currently annotations in the interface are not parsed by CXF (e.g.
>>>>>>> @Path, @GET, @Produces, @Consumes etc.), it will only read from the
>>>>>>> implementing API class.
>>>>>>>
>>>>>>> This is especially annoying if wadl2java is used to generate the API
>>>>>>> interfaces automatically.
>>>>>>> To make it work, one has to manually add the JAXRS-annotations to
>>>>>>> each
>>>>>>> implementing class.
>>>>>>>
>>>>>>> It would be nice if CXF would read the annotations in the
>>>>>>> interface in
>>>>>>> the future as well.
>>>>>>>
>>>>>>> Best regards,
>>>>>>> Johannes
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Re: CXF3 - Annotations in the interface are not parsed

Posted by "J. Fiala" <mo...@fwd.at>.
That's exactly what I would like to do - if I remove the annotations 
from the implementing class methods, they vanish from the WADL.

Best regards,
Johannes


Am 18.08.2016 um 15:54 schrieb Sergey Beryozkin:
> It's invalid per the JAX-RS spec - see its annotation inheritance 
> section, you can not have JAX-RS annotations spread over the interface 
> and impl, just keep them all on the interface
>
> Cheers, Sergey
> On 18/08/16 14:18, J. Fiala wrote:
>> Sure:
>>
>> Interface (generated using wadl2java):
>>
>> @Path("/helloWorld")
>> public interface HelloWorldResource {
>>
>>     @GET
>>     @Produces("application/json")
>>     @Path("/find")
>>     String sayHello(@QueryParam("name") String name);
>>
>> }
>>
>> // @Path is read from the interface correctly
>> public class HelloWorldServiceImpl implements HelloWorldResource {
>>
>>     // if e.g. @GET is removed, the method will no longer appear in the
>> generated WADL
>>    // so the annotations at the interface method are effectively ignored
>>
>>     @GET
>>     @Consumes({ "application/json" })
>>     @Produces("application/json")
>>     @Path("/find")
>>     @Description(value = "Say hello service", target = DocTarget.METHOD)
>>        String sayHello(@QueryParam("name") String name) {
>>
>>     return "hello " + name;
>>
>> }
>>
>> }
>>
>> I can also assemble a small example project if you need it.
>>
>> Best regards,
>> Johannes
>>
>> Am 18.08.2016 um 13:21 schrieb Sergey Beryozkin:
>>> Can you prototype here an interface and an impl class please
>>>
>>> thanks, Sergey
>>> On 18/08/16 12:11, J. Fiala wrote:
>>>> Hi,
>>>>
>>>> No, that has nothing to do with Swagger, I'm only working with the
>>>> generated WADL here.
>>>>
>>>> The @Path-annotation on the implementing class can be removed, here
>>>> picking up from the interface works correctly.
>>>>
>>>> However, if I remove @GET/@Path/@Consumes/@Produces from the method in
>>>> the implementing class, it will vanish from the generated WADL.
>>>>
>>>> So basically all the annotations at the method level in the interface
>>>> are ignored (I'm using CXF 3.1.6).
>>>>
>>>> Verified using Spring CXF Boot + using Jboss EAP 6.
>>>>
>>>> Best regards,
>>>>
>>>> Johannes
>>>>
>>>>
>>>> Am 18.08.2016 um 00:32 schrieb Sergey Beryozkin:
>>>>> Hmm is it somehow related to that Swagger related issue ? The
>>>>> interface annotation inheritance works just fine in CXF as far as I
>>>>> know, as far as enabling JAX-RS endpoints is concerned
>>>>>
>>>>> Note we've seen users reporting Swagger2feature can not handle it but
>>>>> a user has just confirmed that it worked fine in the end - we have
>>>>> another pending issue with Swagger not handling multi-bundle case
>>>>> well, but that is another story
>>>>>
>>>>> Sergey
>>>>> On 17/08/16 18:23, J. Fiala wrote:
>>>>>> Currently annotations in the interface are not parsed by CXF (e.g.
>>>>>> @Path, @GET, @Produces, @Consumes etc.), it will only read from the
>>>>>> implementing API class.
>>>>>>
>>>>>> This is especially annoying if wadl2java is used to generate the API
>>>>>> interfaces automatically.
>>>>>> To make it work, one has to manually add the JAXRS-annotations to 
>>>>>> each
>>>>>> implementing class.
>>>>>>
>>>>>> It would be nice if CXF would read the annotations in the 
>>>>>> interface in
>>>>>> the future as well.
>>>>>>
>>>>>> Best regards,
>>>>>> Johannes
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
>


Re: CXF3 - Annotations in the interface are not parsed

Posted by Sergey Beryozkin <sb...@gmail.com>.
It's invalid per the JAX-RS spec - see its annotation inheritance 
section, you can not have JAX-RS annotations spread over the interface 
and impl, just keep them all on the interface

Cheers, Sergey
On 18/08/16 14:18, J. Fiala wrote:
> Sure:
>
> Interface (generated using wadl2java):
>
> @Path("/helloWorld")
> public interface HelloWorldResource {
>
>     @GET
>     @Produces("application/json")
>     @Path("/find")
>     String sayHello(@QueryParam("name") String name);
>
> }
>
> // @Path is read from the interface correctly
> public class HelloWorldServiceImpl implements HelloWorldResource {
>
>     // if e.g. @GET is removed, the method will no longer appear in the
> generated WADL
>    // so the annotations at the interface method are effectively ignored
>
>     @GET
>     @Consumes({ "application/json" })
>     @Produces("application/json")
>     @Path("/find")
>     @Description(value = "Say hello service", target = DocTarget.METHOD)
>        String sayHello(@QueryParam("name") String name) {
>
>     return "hello " + name;
>
> }
>
> }
>
> I can also assemble a small example project if you need it.
>
> Best regards,
> Johannes
>
> Am 18.08.2016 um 13:21 schrieb Sergey Beryozkin:
>> Can you prototype here an interface and an impl class please
>>
>> thanks, Sergey
>> On 18/08/16 12:11, J. Fiala wrote:
>>> Hi,
>>>
>>> No, that has nothing to do with Swagger, I'm only working with the
>>> generated WADL here.
>>>
>>> The @Path-annotation on the implementing class can be removed, here
>>> picking up from the interface works correctly.
>>>
>>> However, if I remove @GET/@Path/@Consumes/@Produces from the method in
>>> the implementing class, it will vanish from the generated WADL.
>>>
>>> So basically all the annotations at the method level in the interface
>>> are ignored (I'm using CXF 3.1.6).
>>>
>>> Verified using Spring CXF Boot + using Jboss EAP 6.
>>>
>>> Best regards,
>>>
>>> Johannes
>>>
>>>
>>> Am 18.08.2016 um 00:32 schrieb Sergey Beryozkin:
>>>> Hmm is it somehow related to that Swagger related issue ? The
>>>> interface annotation inheritance works just fine in CXF as far as I
>>>> know, as far as enabling JAX-RS endpoints is concerned
>>>>
>>>> Note we've seen users reporting Swagger2feature can not handle it but
>>>> a user has just confirmed that it worked fine in the end - we have
>>>> another pending issue with Swagger not handling multi-bundle case
>>>> well, but that is another story
>>>>
>>>> Sergey
>>>> On 17/08/16 18:23, J. Fiala wrote:
>>>>> Currently annotations in the interface are not parsed by CXF (e.g.
>>>>> @Path, @GET, @Produces, @Consumes etc.), it will only read from the
>>>>> implementing API class.
>>>>>
>>>>> This is especially annoying if wadl2java is used to generate the API
>>>>> interfaces automatically.
>>>>> To make it work, one has to manually add the JAXRS-annotations to each
>>>>> implementing class.
>>>>>
>>>>> It would be nice if CXF would read the annotations in the interface in
>>>>> the future as well.
>>>>>
>>>>> Best regards,
>>>>> Johannes
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Re: CXF3 - Annotations in the interface are not parsed

Posted by "J. Fiala" <mo...@fwd.at>.
Sure:

Interface (generated using wadl2java):

@Path("/helloWorld")
public interface HelloWorldResource {

     @GET
     @Produces("application/json")
     @Path("/find")
     String sayHello(@QueryParam("name") String name);

}

// @Path is read from the interface correctly
public class HelloWorldServiceImpl implements HelloWorldResource {

     // if e.g. @GET is removed, the method will no longer appear in the 
generated WADL
    // so the annotations at the interface method are effectively ignored

     @GET
     @Consumes({ "application/json" })
     @Produces("application/json")
     @Path("/find")
     @Description(value = "Say hello service", target = DocTarget.METHOD)
        String sayHello(@QueryParam("name") String name) {

     return "hello " + name;

}

}

I can also assemble a small example project if you need it.

Best regards,
Johannes

Am 18.08.2016 um 13:21 schrieb Sergey Beryozkin:
> Can you prototype here an interface and an impl class please
>
> thanks, Sergey
> On 18/08/16 12:11, J. Fiala wrote:
>> Hi,
>>
>> No, that has nothing to do with Swagger, I'm only working with the
>> generated WADL here.
>>
>> The @Path-annotation on the implementing class can be removed, here
>> picking up from the interface works correctly.
>>
>> However, if I remove @GET/@Path/@Consumes/@Produces from the method in
>> the implementing class, it will vanish from the generated WADL.
>>
>> So basically all the annotations at the method level in the interface
>> are ignored (I'm using CXF 3.1.6).
>>
>> Verified using Spring CXF Boot + using Jboss EAP 6.
>>
>> Best regards,
>>
>> Johannes
>>
>>
>> Am 18.08.2016 um 00:32 schrieb Sergey Beryozkin:
>>> Hmm is it somehow related to that Swagger related issue ? The
>>> interface annotation inheritance works just fine in CXF as far as I
>>> know, as far as enabling JAX-RS endpoints is concerned
>>>
>>> Note we've seen users reporting Swagger2feature can not handle it but
>>> a user has just confirmed that it worked fine in the end - we have
>>> another pending issue with Swagger not handling multi-bundle case
>>> well, but that is another story
>>>
>>> Sergey
>>> On 17/08/16 18:23, J. Fiala wrote:
>>>> Currently annotations in the interface are not parsed by CXF (e.g.
>>>> @Path, @GET, @Produces, @Consumes etc.), it will only read from the
>>>> implementing API class.
>>>>
>>>> This is especially annoying if wadl2java is used to generate the API
>>>> interfaces automatically.
>>>> To make it work, one has to manually add the JAXRS-annotations to each
>>>> implementing class.
>>>>
>>>> It would be nice if CXF would read the annotations in the interface in
>>>> the future as well.
>>>>
>>>> Best regards,
>>>> Johannes
>>>>
>>>>
>>>
>>>
>>
>
>


Re: CXF3 - Annotations in the interface are not parsed

Posted by Sergey Beryozkin <sb...@gmail.com>.
Can you prototype here an interface and an impl class please

thanks, Sergey
On 18/08/16 12:11, J. Fiala wrote:
> Hi,
>
> No, that has nothing to do with Swagger, I'm only working with the
> generated WADL here.
>
> The @Path-annotation on the implementing class can be removed, here
> picking up from the interface works correctly.
>
> However, if I remove @GET/@Path/@Consumes/@Produces from the method in
> the implementing class, it will vanish from the generated WADL.
>
> So basically all the annotations at the method level in the interface
> are ignored (I'm using CXF 3.1.6).
>
> Verified using Spring CXF Boot + using Jboss EAP 6.
>
> Best regards,
>
> Johannes
>
>
> Am 18.08.2016 um 00:32 schrieb Sergey Beryozkin:
>> Hmm is it somehow related to that Swagger related issue ? The
>> interface annotation inheritance works just fine in CXF as far as I
>> know, as far as enabling JAX-RS endpoints is concerned
>>
>> Note we've seen users reporting Swagger2feature can not handle it but
>> a user has just confirmed that it worked fine in the end - we have
>> another pending issue with Swagger not handling multi-bundle case
>> well, but that is another story
>>
>> Sergey
>> On 17/08/16 18:23, J. Fiala wrote:
>>> Currently annotations in the interface are not parsed by CXF (e.g.
>>> @Path, @GET, @Produces, @Consumes etc.), it will only read from the
>>> implementing API class.
>>>
>>> This is especially annoying if wadl2java is used to generate the API
>>> interfaces automatically.
>>> To make it work, one has to manually add the JAXRS-annotations to each
>>> implementing class.
>>>
>>> It would be nice if CXF would read the annotations in the interface in
>>> the future as well.
>>>
>>> Best regards,
>>> Johannes
>>>
>>>
>>
>>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Re: CXF3 - Annotations in the interface are not parsed

Posted by "J. Fiala" <mo...@fwd.at>.
Hi,

No, that has nothing to do with Swagger, I'm only working with the 
generated WADL here.

The @Path-annotation on the implementing class can be removed, here 
picking up from the interface works correctly.

However, if I remove @GET/@Path/@Consumes/@Produces from the method in 
the implementing class, it will vanish from the generated WADL.

So basically all the annotations at the method level in the interface 
are ignored (I'm using CXF 3.1.6).

Verified using Spring CXF Boot + using Jboss EAP 6.

Best regards,

Johannes


Am 18.08.2016 um 00:32 schrieb Sergey Beryozkin:
> Hmm is it somehow related to that Swagger related issue ? The 
> interface annotation inheritance works just fine in CXF as far as I 
> know, as far as enabling JAX-RS endpoints is concerned
>
> Note we've seen users reporting Swagger2feature can not handle it but 
> a user has just confirmed that it worked fine in the end - we have 
> another pending issue with Swagger not handling multi-bundle case 
> well, but that is another story
>
> Sergey
> On 17/08/16 18:23, J. Fiala wrote:
>> Currently annotations in the interface are not parsed by CXF (e.g.
>> @Path, @GET, @Produces, @Consumes etc.), it will only read from the
>> implementing API class.
>>
>> This is especially annoying if wadl2java is used to generate the API
>> interfaces automatically.
>> To make it work, one has to manually add the JAXRS-annotations to each
>> implementing class.
>>
>> It would be nice if CXF would read the annotations in the interface in
>> the future as well.
>>
>> Best regards,
>> Johannes
>>
>>
>
>


Re: CXF3 - Annotations in the interface are not parsed

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hmm is it somehow related to that Swagger related issue ? The interface 
annotation inheritance works just fine in CXF as far as I know, as far 
as enabling JAX-RS endpoints is concerned

Note we've seen users reporting Swagger2feature can not handle it but a 
user has just confirmed that it worked fine in the end - we have another 
pending issue with Swagger not handling multi-bundle case well, but that 
is another story

Sergey
On 17/08/16 18:23, J. Fiala wrote:
> Currently annotations in the interface are not parsed by CXF (e.g.
> @Path, @GET, @Produces, @Consumes etc.), it will only read from the
> implementing API class.
>
> This is especially annoying if wadl2java is used to generate the API
> interfaces automatically.
> To make it work, one has to manually add the JAXRS-annotations to each
> implementing class.
>
> It would be nice if CXF would read the annotations in the interface in
> the future as well.
>
> Best regards,
> Johannes
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/