On 04/06/13 19:03, eanbiso wrote:
I'm sorry, I have not explained clearly,
I was referring to the call of the other endPoint.
I try to explain:
whit the annotation
     @Path("/PubDocs.json")

in the RestPublicDocsJSON class, when I call the endPoint
      http://localhost:8162/PubDocs/isReady
the call fails with the exception described;
without the @Path annotation in the RestPublicDocsJSON class,
the call at the  http://localhost:8162/PubDocs/isReady begins to function 
properly and return true.
Well, I can only assume then that a superclass has @Path("/PubDocs"), which becomes visible once @Path("/PubDocs.json") is dropped, otherwise @Path("/PubDocs.json") simply overrides the super class @Path is any, nothing unusual there

Sergey


Andrea

Date: Tue, 4 Jun 2013 09:57:19 -0700
From: [email protected]
To: [email protected]
Subject: Re: CXF and swagger



        Hi

On 04/06/13 17:35, eanbiso wrote:

Hi Sergey,

I've tried but the same problem occurs.

the only ways to call the ws without exceptions seem to be:

1) remove the annotation @Path

2) or replace it with general @Path("/")



Hmm, so which URI works ?

When you have


@Path("/PubDocs.json")


then you obviously expect "/PubDocs.json" be in the request URI, but you

say it starts working if we remove the above @Path. So which request URI

works for you ?


Sergey

Cheers,

Andrea



Date: Tue, 4 Jun 2013 07:19:00 -0700

From: [hidden email]

To: [hidden email]

Subject: Re: CXF and swagger







        Hi



On 04/06/13 14:31, eanbiso wrote:







Hi Sergey,



the annotation that is responsible for the failure is the



       @Path("/PubDocs.json")







Removing it the endPoint works fine.



All the annotations used in the class are the following :



       @Path("/PubDocs.json")







       @Api(value = "/PubDocs", description = "Operations about pubDocs")







       @Produces({"application/json"})







       public class RestPublicDocsJSON extends RestPublicDocs{}





I think I know what it is. CXF supports these type extensions



(originally from JAX-RS 0.8 I think), so you do for example,





"GET <a href="<a href="http://host:port/PubDocs.json";>http://host:port/PubDocs.json";><a 
href="http://host:port/PubDocs.json";>http://host:port/PubDocs.json"; and the runtime will replace it with





"<a href="<a href="http://host:port/PubDocs";>http://host:port/PubDocs";><a 
href="http://host:port/PubDocs";>http://host:port/PubDocs";



and set



"Accept: application/json"





I think @Path("/PubDocs")





will work with





"GET <a href="<a href="http://host:port/PubDocs.json";>http://host:port/PubDocs.json";><a 
href="http://host:port/PubDocs.json";>http://host:port/PubDocs.json";





Can you try it ?





I think we also need to get RequestPreprocessor configurable (which is



where extensions like .json are checked), we have a JIRA for that





Cheers, Sergey









Thanks,







Andrea







Date: Tue, 4 Jun 2013 02:13:05 -0700



From: [hidden email]



To: [hidden email]



Subject: Re: CXF and swagger















        Hi







On 03/06/13 16:32, eanbiso wrote:







Hi all,







I'm trying to publish and use cxf rest endPoint adding annotations required







to use the framework com.wordnik.swagger







I tried to follow the example at







https://github.com/wordnik/swagger-core/tree/master/samples/java-jaxrs-cxf/src/main/java/com/wordnik/swagger/sample
with some differences: I must publish the endPoint directly from java code.







My situatios is the following...















I have an endPoint with a simple interface like this:















        @WebService(targetNamespace = http://com.prova.pubdocs/)







        public interface IPublic extends IPublishable{







                







            @GET







        @Path("/isReady")







        @ApiOperation(value = "Check the instance is ready or not", notes =







"Returns a boolean corresponding to the instance state.", responseClass =







"boolean")







        boolean isReady();















        }







(the interface IPublishable specifies only the methods to publish and







unpublish the endPoints),       















and an implementor like this:







        @WebService("RestServicePubDocs", "PubDocs")







        public class RestPublicDocs implements IPublic, IPlat1Service {















                @Override







        public boolean isReady() {







                return true;







        }







        ....







        }















Following the example I've also  daclared the class:















        @Path("/PubDocs.json")







        @Api(value = "/PubDocs", description = "Operations about pubDocs")







        @Produces({"application/json"})







        public class RestPublicDocsJSON extends RestPublicDocs{}















and then I've published the end point in a similar way:















        private Server publishRestServerSwagger(String addr,







                        List<Interceptor&lt;? extends Message>> inInterceptors,







                        List<Interceptor&lt;? extends Message>> 
outInterceptors){







                Server simpl=null;







                try {   







                        JAXRSServerFactoryBean sf = new 
JAXRSServerFactoryBean();







                        sf.setServiceBean(new RestPublicDocsJSON()); //the 
implementor







                        sf.setServiceBean(new ApiListingResourceJSON()); 
//required from swagger







                        sf.setAddress(addr);







                        sf.setProvider(new JacksonJsonProvider()); //required 
from swagger







                        sf.setProvider(new RestExceptionHandler()); //my 
exception mapper







                        







                        if (inInterceptors != null) {







                                for (Interceptor<? extends Message> interceptor 
: inInterceptors) {







                                        sf.getInInterceptors().add(interceptor);







                                }







                        }







                        if (outInterceptors != null) {







                                for (Interceptor<? extends Message> interceptor 
: outInterceptors) {







                                        
sf.getOutInterceptors().add(interceptor);







                                }







                        }







                        







                        //add new rest fault interceptor







                        sf.getOutFaultInterceptors().add(new 
RestFaultInterceptor());







                        //new management end







                        simpl = sf.create();







                        //disable honorKeepAlive value depending on VMArg 
(honorKeepAlive default







value is true)







                        log.info("Endpoint has been published on " + addr);







                } catch (Exception e) {







                        log.warn("Error publishing endpoint: " + e.toString(), 
e);







                }







                







                return simpl;







        }























The publication seems to be successful and no exception occurs but when I







call the ws, a javax.ws.rs.WebApplicationException with status 404 and all







values null occurs.







If I remove the annotations from the RestPublicDocsJSON class the api works







properly and no exception occurs.







Someone can help me?



I can't see what may be going wrong from the code above.







In this fragment,











    >      @Path("/PubDocs.json")







    >      @Api(value = "/PubDocs", description = "Operations about pubDocs")







    >      @Produces({"application/json"})







    >      public class RestPublicDocsJSON extends RestPublicDocs{}











which annotations affect the api working properly ? Are these







annotations the only ones on RestPublicDocsJSON ?











Sergey















Thanks a lot,















Andrea































--







View this message in context: 
http://cxf.547215.n5.nabble.com/CXF-and-swagger-tp5728644.html
Sent from the cxf-user mailing list archive at Nabble.com.























        



        



        



        







        







        



        



                If you reply to this email, your message will be added to the 
discussion below:



                
http://cxf.547215.n5.nabble.com/CXF-and-swagger-tp5728644p5728690.html
        



        



                



                To unsubscribe from CXF and swagger, click here.







                NAML



                                                















--



View this message in context: 
http://cxf.547215.n5.nabble.com/CXF-and-swagger-tp5728644p5728720.html
Sent from the cxf-user mailing list archive at Nabble.com.











        

        

        

        



        



        

        

                If you reply to this email, your message will be added to the 
discussion below:

                
http://cxf.547215.n5.nabble.com/CXF-and-swagger-tp5728644p5728727.html
        

        

                

                To unsubscribe from CXF and swagger, click here.



                NAML

                                                







--

View this message in context: 
http://cxf.547215.n5.nabble.com/CXF-and-swagger-tp5728644p5728742.html
Sent from the cxf-user mailing list archive at Nabble.com.






--
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com

Reply via email to