users@jersey.java.net

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

From: Ari Heino <ext.ari.heino_at_tieto.com>
Date: Fri, 13 Nov 2009 01:38:13 -0800 (PST)

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.

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.).


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.