You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Stan Ioan Eugen <me...@ieugen.ro> on 2014/07/30 04:36:08 UTC

possbile bug in CXF Link implementation

Hello,

I think I've discovered a bug in CXF, but I'm not sure. Link class
messes links up, and doesn't include servlet and @ApplicationPath
paths from BaseUri:

Description:

I have CdiServlet deployed at '/rest',
I have Jax rs @ApplicationPath '/api'
Account resource at /account

I expect the following code to return links to my resources:

        log.info(" -- <<>> {}", uri.getBaseUri());
        return Response.ok().links(

Link.fromResource(AccountResource.class).baseUri(uri.getBaseUri()).rel("account").build(),
  Link.fromResource(PlatformResource.class).baseUri(uri.getBaseUri()).rel("self").build()
).build();

However, I get this on the client side:

Link=[<http://localhost:9001/>;rel="self",
<http://localhost:9001/account>;rel="account"],

And I expected links with full path. like ttp://localhost:9001/rest/api/account

UriInfo returns the correct uri. Link messes it up.

INFO  PlatformResource -  -- <<>> http://localhost:9001/rest/api

If you can confirm, I'll submit a bug to CXF and perhaps a patch + test.

Regards,

-- 
Ioan Eugen Stan / ieugen.ro

Re: possbile bug in CXF Link implementation

Posted by Sergey Beryozkin <sb...@gmail.com>.
Thanks...

Cheers, Sergey
On 31/07/14 18:17, Stan Ioan Eugen wrote:
> Hi,
>
> I've created issue https://issues.apache.org/jira/browse/CXF-5920 to
> follow this.
> I'll work on a patch these days.
>
> 2014-07-30 16:52 GMT+03:00 Sergey Beryozkin <sb...@gmail.com>:
>> Never mind, I've confirmed that CXF LinkImpl loses the 'context' part of the
>> base URI, strange issue, thanks for spotting it,
>>
>> Can you please open a JIRA issue ? A patch would be welcome indeed
>>
>> Thanks, Sergey
>>
>> On 30/07/14 16:29, Sergey Beryozkin wrote:
>>>
>>> Hi
>>> On 30/07/14 05:36, Stan Ioan Eugen wrote:
>>>>
>>>> Hello,
>>>>
>>>> I think I've discovered a bug in CXF, but I'm not sure. Link class
>>>> messes links up, and doesn't include servlet and @ApplicationPath
>>>> paths from BaseUri:
>>>>
>>>> Description:
>>>>
>>>> I have CdiServlet deployed at '/rest',
>>>> I have Jax rs @ApplicationPath '/api'
>>>> Account resource at /account
>>>>
>>>> I expect the following code to return links to my resources:
>>>>
>>>>           log.info(" -- <<>> {}", uri.getBaseUri());
>>>>           return Response.ok().links(
>>>>
>>>>
>>>> Link.fromResource(AccountResource.class).baseUri(uri.getBaseUri()).rel("account").build(),
>>>>
>>>>
>>>>
>>>> Link.fromResource(PlatformResource.class).baseUri(uri.getBaseUri()).rel("self").build()
>>>>
>>>> ).build();
>>>>
>>> Where is this call made from ? From a higher level root resource ?
>>>
>>> Cheers, Sergey
>>>
>>>> However, I get this on the client side:
>>>>
>>>> Link=[<http://localhost:9001/>;rel="self",
>>>> <http://localhost:9001/account>;rel="account"],
>>>>
>>>> And I expected links with full path. like
>>>> ttp://localhost:9001/rest/api/account
>>>>
>>>> UriInfo returns the correct uri. Link messes it up.
>>>>
>>>> INFO  PlatformResource -  -- <<>> http://localhost:9001/rest/api
>>>>
>>>> If you can confirm, I'll submit a bug to CXF and perhaps a patch + test.
>>>>
>>>> Regards,
>>>>
>>>
>>>
>>
>
>
>



Re: possbile bug in CXF Link implementation

Posted by Stan Ioan Eugen <me...@ieugen.ro>.
Hi,

I've created issue https://issues.apache.org/jira/browse/CXF-5920 to
follow this.
I'll work on a patch these days.

2014-07-30 16:52 GMT+03:00 Sergey Beryozkin <sb...@gmail.com>:
> Never mind, I've confirmed that CXF LinkImpl loses the 'context' part of the
> base URI, strange issue, thanks for spotting it,
>
> Can you please open a JIRA issue ? A patch would be welcome indeed
>
> Thanks, Sergey
>
> On 30/07/14 16:29, Sergey Beryozkin wrote:
>>
>> Hi
>> On 30/07/14 05:36, Stan Ioan Eugen wrote:
>>>
>>> Hello,
>>>
>>> I think I've discovered a bug in CXF, but I'm not sure. Link class
>>> messes links up, and doesn't include servlet and @ApplicationPath
>>> paths from BaseUri:
>>>
>>> Description:
>>>
>>> I have CdiServlet deployed at '/rest',
>>> I have Jax rs @ApplicationPath '/api'
>>> Account resource at /account
>>>
>>> I expect the following code to return links to my resources:
>>>
>>>          log.info(" -- <<>> {}", uri.getBaseUri());
>>>          return Response.ok().links(
>>>
>>>
>>> Link.fromResource(AccountResource.class).baseUri(uri.getBaseUri()).rel("account").build(),
>>>
>>>
>>>
>>> Link.fromResource(PlatformResource.class).baseUri(uri.getBaseUri()).rel("self").build()
>>>
>>> ).build();
>>>
>> Where is this call made from ? From a higher level root resource ?
>>
>> Cheers, Sergey
>>
>>> However, I get this on the client side:
>>>
>>> Link=[<http://localhost:9001/>;rel="self",
>>> <http://localhost:9001/account>;rel="account"],
>>>
>>> And I expected links with full path. like
>>> ttp://localhost:9001/rest/api/account
>>>
>>> UriInfo returns the correct uri. Link messes it up.
>>>
>>> INFO  PlatformResource -  -- <<>> http://localhost:9001/rest/api
>>>
>>> If you can confirm, I'll submit a bug to CXF and perhaps a patch + test.
>>>
>>> Regards,
>>>
>>
>>
>



-- 
Ioan Eugen Stan / ieugen.ro

Re: possbile bug in CXF Link implementation

Posted by Sergey Beryozkin <sb...@gmail.com>.
Never mind, I've confirmed that CXF LinkImpl loses the 'context' part of 
the base URI, strange issue, thanks for spotting it,

Can you please open a JIRA issue ? A patch would be welcome indeed

Thanks, Sergey
On 30/07/14 16:29, Sergey Beryozkin wrote:
> Hi
> On 30/07/14 05:36, Stan Ioan Eugen wrote:
>> Hello,
>>
>> I think I've discovered a bug in CXF, but I'm not sure. Link class
>> messes links up, and doesn't include servlet and @ApplicationPath
>> paths from BaseUri:
>>
>> Description:
>>
>> I have CdiServlet deployed at '/rest',
>> I have Jax rs @ApplicationPath '/api'
>> Account resource at /account
>>
>> I expect the following code to return links to my resources:
>>
>>          log.info(" -- <<>> {}", uri.getBaseUri());
>>          return Response.ok().links(
>>
>> Link.fromResource(AccountResource.class).baseUri(uri.getBaseUri()).rel("account").build(),
>>
>>
>> Link.fromResource(PlatformResource.class).baseUri(uri.getBaseUri()).rel("self").build()
>>
>> ).build();
>>
> Where is this call made from ? From a higher level root resource ?
>
> Cheers, Sergey
>
>> However, I get this on the client side:
>>
>> Link=[<http://localhost:9001/>;rel="self",
>> <http://localhost:9001/account>;rel="account"],
>>
>> And I expected links with full path. like
>> ttp://localhost:9001/rest/api/account
>>
>> UriInfo returns the correct uri. Link messes it up.
>>
>> INFO  PlatformResource -  -- <<>> http://localhost:9001/rest/api
>>
>> If you can confirm, I'll submit a bug to CXF and perhaps a patch + test.
>>
>> Regards,
>>
>
>


Re: possbile bug in CXF Link implementation

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 30/07/14 05:36, Stan Ioan Eugen wrote:
> Hello,
>
> I think I've discovered a bug in CXF, but I'm not sure. Link class
> messes links up, and doesn't include servlet and @ApplicationPath
> paths from BaseUri:
>
> Description:
>
> I have CdiServlet deployed at '/rest',
> I have Jax rs @ApplicationPath '/api'
> Account resource at /account
>
> I expect the following code to return links to my resources:
>
>          log.info(" -- <<>> {}", uri.getBaseUri());
>          return Response.ok().links(
>
> Link.fromResource(AccountResource.class).baseUri(uri.getBaseUri()).rel("account").build(),
>    Link.fromResource(PlatformResource.class).baseUri(uri.getBaseUri()).rel("self").build()
> ).build();
>
Where is this call made from ? From a higher level root resource ?

Cheers, Sergey

> However, I get this on the client side:
>
> Link=[<http://localhost:9001/>;rel="self",
> <http://localhost:9001/account>;rel="account"],
>
> And I expected links with full path. like ttp://localhost:9001/rest/api/account
>
> UriInfo returns the correct uri. Link messes it up.
>
> INFO  PlatformResource -  -- <<>> http://localhost:9001/rest/api
>
> If you can confirm, I'll submit a bug to CXF and perhaps a patch + test.
>
> Regards,
>


-- 
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com