You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Alex O'Ree <sp...@gmail.com> on 2013/12/06 13:06:01 UTC

CXF REST, is this supported?

Can I setup a REST path something similar to this?

@Path("/base?{entity}Key={key}")

When attempting to execute that path, I get the following error

WARNING: No operation matching request path
"/juddiv3/services/inquiryRest/base" is found, Relative Path: /base,
HTTP Me
thod: GET, ContentType: */*, Accept:
text/html,application/xhtml+xml,image/webp,application/xml;q=0.9,*/*;q=0.8,.
Please
 enable FINE/TRACE log level for more details.

Here's what my pom has
   <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-bundle-jaxrs</artifactId>
            <version>2.7.5</version>
            <scope>provided</scope>
        </dependency>

Re: CXF REST, is this supported?

Posted by Alex O'Ree <sp...@gmail.com>.
I'm using 2.7.5, I tried updating to 2.7.6 but something significant
was changed that i haven't been able to identify that breaks the juddi
build. I think its configuration file related. IIRC it was asking for
the location of another config file.

On Mon, Dec 9, 2013 at 5:03 AM, Sergey Beryozkin <sb...@gmail.com> wrote:
> Hi
>
> On 08/12/13 23:26, Alex O'Ree wrote:
>>
>> I was able to get everything to work. thanks for the help!
>>
>> Follow up question, is it possible with CXF REST to have a conditional
>> return type?
>>
>> I was able to get this to work while running in tomcat:
>>     @GET
>>          @Path("/JSON/getDetail")
>>          @Produces("application/json")
>>          @org.apache.cxf.jaxrs.model.wadl.Description("Returns the
>> details of a UDDI entity in JSON, use query parameters"
>>                  + "serviceKey,businessKey,tModelKey, bindingKey")
>>          public Object getDetailJSON(@QueryParam("serviceKey") String
>> serviceKey,
>>                  @QueryParam("businessKey") String businessKey,
>>                  @QueryParam("tModelKey") String tModelKey,
>>                  @QueryParam("bindingKey") String bindingKey) throws
>> WebApplicationException {
>> ...}
>>
>>
>> however it won't passed the unit tests.
>>
>> testgetDetailJSON_SVC(org.apache.juddi.api.impl.rest.UDDIInquiryJAXRSTest):
>> .No message body reader has been found for
>>   class : class java.lang.Object, ContentType : application/json.
>>
> Try CXF 2.7.8 please, there were some relevant fixes to support Objects; or
> consider wrapping it in Response, it will likely work as is in 2.7.5
>
> Sergey
>
>>
>>
>> On Fri, Dec 6, 2013 at 7:04 PM, Alex O'Ree <sp...@gmail.com> wrote:
>>>
>>> @GET
>>>      @Path("/base?{entity}Key={key}")
>>>      @Produces("application/xml")
>>>       @org.apache.cxf.jaxrs.model.wadl.Description("Returns the
>>> selected UDDI entity as XML per section 6.5 of the UDDIv3
>>> specification. Use businessKey, tmodelKey, bindingKey or serviceKey ")
>>>      public Object getEntityAsXML(@PathParam("entity") String
>>> entity,@PathParam("key") String key) throws WebApplicationException {
>>> }
>>>
>>>
>>> basically i'm writing an adapter for juddi that implements this:
>>> http://uddi.org/pubs/uddi-v3.0.2-20041019.htm#_Toc85908158
>>>
>>>
>>> On Fri, Dec 6, 2013 at 7:26 AM, António Mota <am...@gmail.com> wrote:
>>>>
>>>> What are you trying to do? Can you post some examples? And also what is
>>>> the
>>>> signature of the method you are annotating?
>>>>
>>>>
>>>> * Melhores cumprimentos / Beir beannacht / Best regards *
>>>> *______________________________________________________*
>>>>
>>>> *António Manuel dos Santos Mota <http://gplus.to/amsmota>*
>>>> *http://www.linkedin.com/in/amsmota*
>>>> <http://www.linkedin.com/in/amsmota>
>>>> *______________________________________________________*
>>>>
>>>>
>>>> On 6 December 2013 12:06, Alex O'Ree <sp...@gmail.com> wrote:
>>>>
>>>>> Can I setup a REST path something similar to this?
>>>>>
>>>>> @Path("/base?{entity}Key={key}")
>>>>>
>>>>> When attempting to execute that path, I get the following error
>>>>>
>>>>> WARNING: No operation matching request path
>>>>> "/juddiv3/services/inquiryRest/base" is found, Relative Path: /base,
>>>>> HTTP Me
>>>>> thod: GET, ContentType: */*, Accept:
>>>>>
>>>>>
>>>>> text/html,application/xhtml+xml,image/webp,application/xml;q=0.9,*/*;q=0.8,.
>>>>> Please
>>>>>   enable FINE/TRACE log level for more details.
>>>>>
>>>>> Here's what my pom has
>>>>>     <dependency>
>>>>>              <groupId>org.apache.cxf</groupId>
>>>>>              <artifactId>cxf-bundle-jaxrs</artifactId>
>>>>>              <version>2.7.5</version>
>>>>>              <scope>provided</scope>
>>>>>          </dependency>
>>>>>
>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com

Re: CXF REST, is this supported?

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 08/12/13 23:26, Alex O'Ree wrote:
> I was able to get everything to work. thanks for the help!
>
> Follow up question, is it possible with CXF REST to have a conditional
> return type?
>
> I was able to get this to work while running in tomcat:
>     @GET
>          @Path("/JSON/getDetail")
>          @Produces("application/json")
>          @org.apache.cxf.jaxrs.model.wadl.Description("Returns the
> details of a UDDI entity in JSON, use query parameters"
>                  + "serviceKey,businessKey,tModelKey, bindingKey")
>          public Object getDetailJSON(@QueryParam("serviceKey") String serviceKey,
>                  @QueryParam("businessKey") String businessKey,
>                  @QueryParam("tModelKey") String tModelKey,
>                  @QueryParam("bindingKey") String bindingKey) throws
> WebApplicationException {
> ...}
>
>
> however it won't passed the unit tests.
>    testgetDetailJSON_SVC(org.apache.juddi.api.impl.rest.UDDIInquiryJAXRSTest):
> .No message body reader has been found for
>   class : class java.lang.Object, ContentType : application/json.
>
Try CXF 2.7.8 please, there were some relevant fixes to support Objects; 
or consider wrapping it in Response, it will likely work as is in 2.7.5

Sergey
>
>
> On Fri, Dec 6, 2013 at 7:04 PM, Alex O'Ree <sp...@gmail.com> wrote:
>> @GET
>>      @Path("/base?{entity}Key={key}")
>>      @Produces("application/xml")
>>       @org.apache.cxf.jaxrs.model.wadl.Description("Returns the
>> selected UDDI entity as XML per section 6.5 of the UDDIv3
>> specification. Use businessKey, tmodelKey, bindingKey or serviceKey ")
>>      public Object getEntityAsXML(@PathParam("entity") String
>> entity,@PathParam("key") String key) throws WebApplicationException {
>> }
>>
>>
>> basically i'm writing an adapter for juddi that implements this:
>> http://uddi.org/pubs/uddi-v3.0.2-20041019.htm#_Toc85908158
>>
>>
>> On Fri, Dec 6, 2013 at 7:26 AM, António Mota <am...@gmail.com> wrote:
>>> What are you trying to do? Can you post some examples? And also what is the
>>> signature of the method you are annotating?
>>>
>>>
>>> * Melhores cumprimentos / Beir beannacht / Best regards *
>>> *______________________________________________________*
>>>
>>> *António Manuel dos Santos Mota <http://gplus.to/amsmota>*
>>> *http://www.linkedin.com/in/amsmota* <http://www.linkedin.com/in/amsmota>
>>> *______________________________________________________*
>>>
>>>
>>> On 6 December 2013 12:06, Alex O'Ree <sp...@gmail.com> wrote:
>>>
>>>> Can I setup a REST path something similar to this?
>>>>
>>>> @Path("/base?{entity}Key={key}")
>>>>
>>>> When attempting to execute that path, I get the following error
>>>>
>>>> WARNING: No operation matching request path
>>>> "/juddiv3/services/inquiryRest/base" is found, Relative Path: /base,
>>>> HTTP Me
>>>> thod: GET, ContentType: */*, Accept:
>>>>
>>>> text/html,application/xhtml+xml,image/webp,application/xml;q=0.9,*/*;q=0.8,.
>>>> Please
>>>>   enable FINE/TRACE log level for more details.
>>>>
>>>> Here's what my pom has
>>>>     <dependency>
>>>>              <groupId>org.apache.cxf</groupId>
>>>>              <artifactId>cxf-bundle-jaxrs</artifactId>
>>>>              <version>2.7.5</version>
>>>>              <scope>provided</scope>
>>>>          </dependency>
>>>>


-- 
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com

Re: CXF REST, is this supported?

Posted by Alex O'Ree <sp...@gmail.com>.
I was able to get everything to work. thanks for the help!

Follow up question, is it possible with CXF REST to have a conditional
return type?

I was able to get this to work while running in tomcat:
   @GET
        @Path("/JSON/getDetail")
        @Produces("application/json")
        @org.apache.cxf.jaxrs.model.wadl.Description("Returns the
details of a UDDI entity in JSON, use query parameters"
                + "serviceKey,businessKey,tModelKey, bindingKey")
        public Object getDetailJSON(@QueryParam("serviceKey") String serviceKey,
                @QueryParam("businessKey") String businessKey,
                @QueryParam("tModelKey") String tModelKey,
                @QueryParam("bindingKey") String bindingKey) throws
WebApplicationException {
...}


however it won't passed the unit tests.
  testgetDetailJSON_SVC(org.apache.juddi.api.impl.rest.UDDIInquiryJAXRSTest):
.No message body reader has been found for
 class : class java.lang.Object, ContentType : application/json.



On Fri, Dec 6, 2013 at 7:04 PM, Alex O'Ree <sp...@gmail.com> wrote:
> @GET
>     @Path("/base?{entity}Key={key}")
>     @Produces("application/xml")
>      @org.apache.cxf.jaxrs.model.wadl.Description("Returns the
> selected UDDI entity as XML per section 6.5 of the UDDIv3
> specification. Use businessKey, tmodelKey, bindingKey or serviceKey ")
>     public Object getEntityAsXML(@PathParam("entity") String
> entity,@PathParam("key") String key) throws WebApplicationException {
> }
>
>
> basically i'm writing an adapter for juddi that implements this:
> http://uddi.org/pubs/uddi-v3.0.2-20041019.htm#_Toc85908158
>
>
> On Fri, Dec 6, 2013 at 7:26 AM, António Mota <am...@gmail.com> wrote:
>> What are you trying to do? Can you post some examples? And also what is the
>> signature of the method you are annotating?
>>
>>
>> * Melhores cumprimentos / Beir beannacht / Best regards *
>> *______________________________________________________*
>>
>> *António Manuel dos Santos Mota <http://gplus.to/amsmota>*
>> *http://www.linkedin.com/in/amsmota* <http://www.linkedin.com/in/amsmota>
>> *______________________________________________________*
>>
>>
>> On 6 December 2013 12:06, Alex O'Ree <sp...@gmail.com> wrote:
>>
>>> Can I setup a REST path something similar to this?
>>>
>>> @Path("/base?{entity}Key={key}")
>>>
>>> When attempting to execute that path, I get the following error
>>>
>>> WARNING: No operation matching request path
>>> "/juddiv3/services/inquiryRest/base" is found, Relative Path: /base,
>>> HTTP Me
>>> thod: GET, ContentType: */*, Accept:
>>>
>>> text/html,application/xhtml+xml,image/webp,application/xml;q=0.9,*/*;q=0.8,.
>>> Please
>>>  enable FINE/TRACE log level for more details.
>>>
>>> Here's what my pom has
>>>    <dependency>
>>>             <groupId>org.apache.cxf</groupId>
>>>             <artifactId>cxf-bundle-jaxrs</artifactId>
>>>             <version>2.7.5</version>
>>>             <scope>provided</scope>
>>>         </dependency>
>>>

Re: CXF REST, is this supported?

Posted by Alex O'Ree <sp...@gmail.com>.
@GET
    @Path("/base?{entity}Key={key}")
    @Produces("application/xml")
     @org.apache.cxf.jaxrs.model.wadl.Description("Returns the
selected UDDI entity as XML per section 6.5 of the UDDIv3
specification. Use businessKey, tmodelKey, bindingKey or serviceKey ")
    public Object getEntityAsXML(@PathParam("entity") String
entity,@PathParam("key") String key) throws WebApplicationException {
}


basically i'm writing an adapter for juddi that implements this:
http://uddi.org/pubs/uddi-v3.0.2-20041019.htm#_Toc85908158


On Fri, Dec 6, 2013 at 7:26 AM, António Mota <am...@gmail.com> wrote:
> What are you trying to do? Can you post some examples? And also what is the
> signature of the method you are annotating?
>
>
> * Melhores cumprimentos / Beir beannacht / Best regards *
> *______________________________________________________*
>
> *António Manuel dos Santos Mota <http://gplus.to/amsmota>*
> *http://www.linkedin.com/in/amsmota* <http://www.linkedin.com/in/amsmota>
> *______________________________________________________*
>
>
> On 6 December 2013 12:06, Alex O'Ree <sp...@gmail.com> wrote:
>
>> Can I setup a REST path something similar to this?
>>
>> @Path("/base?{entity}Key={key}")
>>
>> When attempting to execute that path, I get the following error
>>
>> WARNING: No operation matching request path
>> "/juddiv3/services/inquiryRest/base" is found, Relative Path: /base,
>> HTTP Me
>> thod: GET, ContentType: */*, Accept:
>>
>> text/html,application/xhtml+xml,image/webp,application/xml;q=0.9,*/*;q=0.8,.
>> Please
>>  enable FINE/TRACE log level for more details.
>>
>> Here's what my pom has
>>    <dependency>
>>             <groupId>org.apache.cxf</groupId>
>>             <artifactId>cxf-bundle-jaxrs</artifactId>
>>             <version>2.7.5</version>
>>             <scope>provided</scope>
>>         </dependency>
>>

Re: CXF REST, is this supported?

Posted by António Mota <am...@gmail.com>.
What are you trying to do? Can you post some examples? And also what is the
signature of the method you are annotating?


* Melhores cumprimentos / Beir beannacht / Best regards *
*______________________________________________________*

*António Manuel dos Santos Mota <http://gplus.to/amsmota>*
*http://www.linkedin.com/in/amsmota* <http://www.linkedin.com/in/amsmota>
*______________________________________________________*


On 6 December 2013 12:06, Alex O'Ree <sp...@gmail.com> wrote:

> Can I setup a REST path something similar to this?
>
> @Path("/base?{entity}Key={key}")
>
> When attempting to execute that path, I get the following error
>
> WARNING: No operation matching request path
> "/juddiv3/services/inquiryRest/base" is found, Relative Path: /base,
> HTTP Me
> thod: GET, ContentType: */*, Accept:
>
> text/html,application/xhtml+xml,image/webp,application/xml;q=0.9,*/*;q=0.8,.
> Please
>  enable FINE/TRACE log level for more details.
>
> Here's what my pom has
>    <dependency>
>             <groupId>org.apache.cxf</groupId>
>             <artifactId>cxf-bundle-jaxrs</artifactId>
>             <version>2.7.5</version>
>             <scope>provided</scope>
>         </dependency>
>

Re: CXF REST, is this supported?

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 06/12/13 12:06, Alex O'Ree wrote:
> Can I setup a REST path something similar to this?
>
> @Path("/base?{entity}Key={key}")
>
> When attempting to execute that path, I get the following error
>
> WARNING: No operation matching request path
> "/juddiv3/services/inquiryRest/base" is found, Relative Path: /base,
> HTTP Me
> thod: GET, ContentType: */*, Accept:
> text/html,application/xhtml+xml,image/webp,application/xml;q=0.9,*/*;q=0.8,.
> Please
>   enable FINE/TRACE log level for more details.

You have a query component separator in the Path expression, so that '?' 
character will be encoded

Try to have two methods with
@Path("/base")
and
@Path("/base/{entity}/{key}")

or something similar
Sergey

>
> Here's what my pom has
>     <dependency>
>              <groupId>org.apache.cxf</groupId>
>              <artifactId>cxf-bundle-jaxrs</artifactId>
>              <version>2.7.5</version>
>              <scope>provided</scope>
>          </dependency>
>