users@jersey.java.net

Re: [Jersey] Re: Hangs when trying to read an entity

From: Imran M Yousuf <imyousuf_at_smartitengineering.com>
Date: Mon, 9 Aug 2010 15:33:50 +0600

Hi Paul,

On Mon, Aug 9, 2010 at 3:30 PM, Imran M Yousuf
<imyousuf_at_smartitengineering.com> wrote:
> Hi Paul,
>
> On Mon, Aug 9, 2010 at 2:27 PM, Paul Sandoz <Paul.Sandoz_at_oracle.com> wrote:
>> <snip />
>> returning 204 then GET. I suspect it might if the HEAD response returns a
>> 204 with chunked encoding.
>>
>> You should be able to easily verify if Jetty does that using curl.

Looks like your suspicion is right. I just blocked out the HEAD
request and all worked just fine with Client.create(config).

Best regards,

Imran

>
> Following is the output of the HEAD request using curl.
>
> $ curl -X HEAD -v http://localhost:9090/
> * About to connect() to localhost port 9090 (#0)
> *   Trying ::1... connected
> * Connected to localhost (::1) port 9090 (#0)
>> HEAD / HTTP/1.1
>> User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
>> Host: localhost:9090
>> Accept: */*
>>
> < HTTP/1.1 204 No Content
> < Content-Type: application/atom+xml
> < Server: Jetty(7.1.5.v20100705)
> <
> * Connection #0 to host localhost left intact
> * Closing connection #0
>
> Please let me know whether it is sufficient or not.
>
> Thank you,
>
> Imran
>
>>
>> Paul.
>>
>> On Aug 9, 2010, at 9:38 AM, Imran M Yousuf wrote:
>>
>>> Hi Paul,
>>>
>>>> There is a bug in HttpURLConnection where if you make a POST/PUT request
>>>> and
>>>> the server returns a 204 response with chunked encoding and you make a
>>>> subsequent GET the client hangs. I cannot recall the bug number or if it
>>>> was
>>>> fixed in a JDK release.
>>>> Did you make just one request or say a PUT then a GET?
>>>
>>> No there ain't any POST/PUT only GET operations. The resource class is
>>>
>>> http://github.com/imyousuf/smart-util/blob/rest-util/rest/atom/src/test/java/com/smartitengineering/util/rest/atom/resources/SomeDomainResource.java
>>>
>>> The resource uses Abdera Feed to deserialize Atom Feed.
>>>
>>> The DTO that is serialized as JSON.
>>>
>>> http://github.com/imyousuf/smart-util/blob/rest-util/rest/atom/src/test/java/com/smartitengineering/util/rest/atom/resources/domain/SomeDomain.java
>>>
>>> The test case that starts Jetty programmatically and makes GET requests
>>> only -
>>>
>>> http://github.com/imyousuf/smart-util/blob/rest-util/rest/atom/src/test/java/com/smartitengineering/util/rest/atom/AppTest.java
>>>
>>> I knew about the bug from earlier google in context to PUT/POST, but
>>> this problem was quite strange to me.
>>>
>>> Thank you,
>>>
>>> --
>>> Imran
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>
>
>
> --
> Imran M Yousuf
> Entrepreneur & CEO
> Smart IT Engineering Ltd.
> 25/5B, Block F, Haji Chinu Miah Road Bylane
> Joint Quarter, Mohammadpur
> Dhaka - 1207, Bangladesh
> Email: imran_at_smartitengineering.com
> Blog: http://imyousuf-tech.blogs.smartitengineering.com/
> Mobile: +880-1711402557
>



-- 
Imran M Yousuf
Entrepreneur & CEO
Smart IT Engineering Ltd.
25/5B, Block F, Haji Chinu Miah Road Bylane
Joint Quarter, Mohammadpur
Dhaka - 1207, Bangladesh
Email: imran_at_smartitengineering.com
Blog: http://imyousuf-tech.blogs.smartitengineering.com/
Mobile: +880-1711402557