[jira] [Commented] (CXF-8408) Response.getLocation() returns null after update from CXF 3.3.6 to 3.4.1

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (CXF-8408) Response.getLocation() returns null after update from CXF 3.3.6 to 3.4.1

Colm O hEigeartaigh (Jira)

    [ https://issues.apache.org/jira/browse/CXF-8408?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17263633#comment-17263633 ]

Jörg Hohwiller commented on CXF-8408:
-------------------------------------

Hi [~amccright],

thanks for your quick response, analysis and explanation. This is actually not a bug but an intended behaviour. If fully understand that you want to comply with JAX-RS API specification and the spec also makes sense to me.

So instead this issue should been seen as a feature request to extend ResponseImpl such that it gets possible to retrieve the request URL without unwrapping CXF internal implementation details. This would be an awesome improvement to solve this issue.

You can see my ugly code where I try to get the URL:

[https://github.com/devonfw/devon4j/blob/0ac5c96673b4c5c2b08ab73b93692aac41b52ad3/modules/cxf-client-rest/src/main/java/com/devonfw/module/cxf/common/impl/client/rest/RestServiceExceptionMapper.java#L108]

as well as the operation (invoked method):

[https://github.com/devonfw/devon4j/blob/0ac5c96673b4c5c2b08ab73b93692aac41b52ad3/modules/cxf-client-rest/src/main/java/com/devonfw/module/cxf/common/impl/client/rest/RestServiceExceptionMapper.java#L65]

It currently works and in the worst case if something changes in the future inside CXF it will return null without causing NPE so I do not have any priority on your enhancement. But still it seems a valuable nice-to-have improvement and once released, I could replace my hack(s) with just one method call.

> Response.getLocation() returns null after update from CXF 3.3.6 to 3.4.1
> ------------------------------------------------------------------------
>
>                 Key: CXF-8408
>                 URL: https://issues.apache.org/jira/browse/CXF-8408
>             Project: CXF
>          Issue Type: Improvement
>    Affects Versions: 3.4.1
>            Reporter: Jörg Hohwiller
>            Priority: Major
>
> javax.ws.rs.core.Response.getLocation() used to return the URL of the service invoked. We used this information to enhance the error handling via a custom org.apache.cxf.jaxrs.client.ResponseExceptionMapper since CXF lacks to provide contextual information in error scenarios making it hard to use in productive environments when service client invocations fail without contextual information available.
> After we now updated from 3.3.6 to 3.4.1 one of our tests failed with an NPE since response.getLocation() now returns null instead of the correct URL and we were doing url.toString() on that without checking for null.
> I am working on ugly workarounds (casting to ResponseImpl and getting the Conduit to retrieve at least the base URL) but it would be great if CXF could fix this regression bug at the root.
> [https://github.com/devonfw/devon4j/pull/310/]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)