You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Roman Kalukiewicz (JIRA)" <ji...@apache.org> on 2009/11/26 16:38:39 UTC

[jira] Created: (CXF-2560) WebClient doesns't read response body if status code means some error

WebClient doesns't read response body if status code means some error
---------------------------------------------------------------------

                 Key: CXF-2560
                 URL: https://issues.apache.org/jira/browse/CXF-2560
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 2.2.5
            Reporter: Roman Kalukiewicz


In {{org.apache.cxf.jaxrs.client.AbstractClient.readBody(Response, HttpURLConnection, Message, Class<?>, Type, Annotation[])}} there is a conddition that causes {{WebClient}} not to read the content of the response if status code describes some kind of error.

I believe that if some response is sent by the server I should be able to read it even if the status is for example 404.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2560) WebClient doesns't read response body if status code means some error

Posted by "Roman Kalukiewicz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782933#action_12782933 ] 

Roman Kalukiewicz commented on CXF-2560:
----------------------------------------

I have such code:

Response response = WebClient.create("http://localhost:1235/")
			.accept("*/*")
			.path("/path/not-exist")
			.get();
Assert.assertEquals(Status.NOT_FOUND.getStatusCode(), response.getStatus());

// Due to the bug in WebClient response.getEntity() returns null, and it is impossible
// to retrieve message.
// Assert.assertThat(response.getEntity().toString(), JUnitMatchers.containsString("not found"));

BTW I see, that the payload is sent via HTTP protocol back to the client.

> WebClient doesns't read response body if status code means some error
> ---------------------------------------------------------------------
>
>                 Key: CXF-2560
>                 URL: https://issues.apache.org/jira/browse/CXF-2560
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.5
>            Reporter: Roman Kalukiewicz
>
> In {{org.apache.cxf.jaxrs.client.AbstractClient.readBody(Response, HttpURLConnection, Message, Class<?>, Type, Annotation[])}} there is a conddition that causes {{WebClient}} not to read the content of the response if status code describes some kind of error.
> I believe that if some response is sent by the server I should be able to read it even if the status is for example 404.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2560) WebClient doesns't read response body if status code means some error

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782931#action_12782931 ] 

Sergey Beryozkin commented on CXF-2560:
---------------------------------------

HI,

how do you use WebClient ?

If you do something like 

Response r = webClient.get();

then

r.getEntity() will point to the underlying connection's error input stream

but if you do 

Book b = webClient.get(Book.class);

then the only option for the runtime is to actually throw the WebApplicationException

can you give more details please ?




> WebClient doesns't read response body if status code means some error
> ---------------------------------------------------------------------
>
>                 Key: CXF-2560
>                 URL: https://issues.apache.org/jira/browse/CXF-2560
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.5
>            Reporter: Roman Kalukiewicz
>
> In {{org.apache.cxf.jaxrs.client.AbstractClient.readBody(Response, HttpURLConnection, Message, Class<?>, Type, Annotation[])}} there is a conddition that causes {{WebClient}} not to read the content of the response if status code describes some kind of error.
> I believe that if some response is sent by the server I should be able to read it even if the status is for example 404.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-2560) WebClient doesns't read response body if status code means some error

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-2560.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.3
         Assignee: Sergey Beryozkin

> WebClient doesns't read response body if status code means some error
> ---------------------------------------------------------------------
>
>                 Key: CXF-2560
>                 URL: https://issues.apache.org/jira/browse/CXF-2560
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.5
>            Reporter: Roman Kalukiewicz
>            Assignee: Sergey Beryozkin
>             Fix For: 2.3
>
>
> In {{org.apache.cxf.jaxrs.client.AbstractClient.readBody(Response, HttpURLConnection, Message, Class<?>, Type, Annotation[])}} there is a conddition that causes {{WebClient}} not to read the content of the response if status code describes some kind of error.
> I believe that if some response is sent by the server I should be able to read it even if the status is for example 404.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2560) WebClient doesns't read response body if status code means some error

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782934#action_12782934 ] 

Sergey Beryozkin commented on CXF-2560:
---------------------------------------

ok... Will add another test... By the way, at the moment, if NOT_FOUND then a lot of extra logging is done at the client side's HttpConduit - will be fixed too.

> WebClient doesns't read response body if status code means some error
> ---------------------------------------------------------------------
>
>                 Key: CXF-2560
>                 URL: https://issues.apache.org/jira/browse/CXF-2560
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.5
>            Reporter: Roman Kalukiewicz
>
> In {{org.apache.cxf.jaxrs.client.AbstractClient.readBody(Response, HttpURLConnection, Message, Class<?>, Type, Annotation[])}} there is a conddition that causes {{WebClient}} not to read the content of the response if status code describes some kind of error.
> I believe that if some response is sent by the server I should be able to read it even if the status is for example 404.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.