users@jersey.java.net

Re: [Jersey] 1.1.4 & response codes with Atom feeds

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 13 Nov 2009 10:54:54 +0100

On Nov 13, 2009, at 10:38 AM, Ari Heino wrote:

>
> Yes, in the example code i was intentionally trying to trigger the
> 304 code
> happening.
> And yes, 304 code gets executed, also verified with LoggingFilter log
> messages that response has a '304' code in it. But on client side same
> LoggingFilter shows http code 200.
>

Any response entity present?

Do you have any filters configured on the client or server?

Can you try using curl to see if a 200 response is returned from the
server?

I did a quick test and cannot reproduce using GF or Grizzly with the
Client API and curl.

The Jersey client API will not modify the status of a received response.


> And your assumptions on the use cases are correct. But for this case
> all
> that is really needed that i explicitly send response code 304 and
> that
> client somehow receives that as 200 (verified with 1.1.4.).
>

The only other thing i can suggest is you provide a simple maven-based
test case that reproduces the issue.

Paul.


>
> Paul Sandoz wrote:
>>
>> HI Ari,
>>
>> On Nov 13, 2009, at 9:49 AM, Ari Heino wrote:
>>
>>>
>>> Hi!
>>>
>>> I upgraded to 1.1.4. (from 1.0.3.1) and my Atom feeds started
>>> behaving
>>> weirdly.
>>>
>>> I return 304 http code if feed hasn't changed:
>>>
>>> r =
>>> Response
>>> .status
>>> (Response.Status.NOT_MODIFIED).lastModified(lastCheck).build();
>>>
>>
>> Have you verified if the above statement is getting executed?
>>
>> How do you verify if the feed has changed?
>>
>>
>>> But the calling client receives http code 200 when I use Jersey
>>> 1.1.4:
>>>
>>> ClientResponse r =
>>> resource.path("/containers/SystemTestContainer/
>>> eventfeed").header("If-Modified-Since",
>>> " Fri, 13 Nov 2009 16:39:57 GMT
>>> ").accept(MediaType.APPLICATION_ATOM_XML).type(
>>>
>>> MediaType.APPLICATION_ATOM_XML).get(ClientResponse.class);
>>>
>>> int status = r.getStatus();
>>> System.out.println("status: " + status);
>>>
>>
>> I notice the date is actually in the future so i am assume you are
>> trying to intentionally trigger a 304 response
>>
>> For my benefit:
>>
>> - If the last modified date is greater than the If-Modified-Since
>> date then the condition If-Modified-Since is met
>> and a 200 response will be returned.
>>
>> - If the last modified date is less than or equal to the If-
>> Modified-Since date then the condition If-Modified-Since
>> is not met and a 304 response will be returned.
>>
>> Paul.
>>
>>
>>> With Jersey 1.0.3.1. I receive 304 correctly.
>>>
>>> Any ideas what I would be doing wrong? I have OSGi environment, and
>>> I had
>>> updated all dependencies from jersey 1.1.4. archive.
>>> --
>>> View this message in context:
>>> http://n2.nabble.com/1-1-4-response-codes-with-Atom-feeds-tp3998025p3998025.html
>>> Sent from the Jersey mailing list archive at Nabble.com.
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/1-1-4-response-codes-with-Atom-feeds-tp3998025p3998224.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>