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:23:09 +0100

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
>