Thanks for the reply Leif. But I'm actually using response builder to build my 
response. This is the stripped out version. But gives you a basic idea on how 
I'm doing it.


ResponseBuilderImpl builder = new ResponseBuilderImpl();


builder.status(200);

builder.type(MediaType.APPLICATION_JSON);

builder.entity(jsonStringResponse.toString());


CacheControl cc = new CacheControl();

cc.setMaxAge(30000);

builder.cacheControl(cc);


return builder.build();


When I look at the response, this is what I'm seeing:


Date: Mon, 09 May 2011 16:32:49 GMT

Via: HTTP/1.1 foo.bar.baz (ApacheTrafficServer/2.0.1 [cHs f ])

Age: 19

Connection: keep-alive

Content-Length: 284

Server: ATS/2.0.1

Content-Type: application/json

Cache-Control: no-transform;max-age=30000


So do you think org.apache.cxf.jaxrs.impl.ResponseBuilderImpl is setting the 
headers wrong? Or ATS is not taking this into consideration? I'm kind of new to 
ATS so forgive my ignorance.


One more question: If I just use max-age as my caching policy and nothing else, 
which value am I supposed to use for CONFIG 
proxy.config.http.cache.required_headers? (1 or 2)?


Thanks,

-Sairam.



From: Leif Hedstrom <[email protected]<mailto:[email protected]>>
Date: Mon, 9 May 2011 11:42:16 -0700
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Cc: Sairam Chilappagari 
<[email protected]<mailto:[email protected]>>
Subject: Re: ATS is not abiding the cache-control's max-age in response header.

On 05/09/2011 11:51 AM, Chilappagari, Sairam wrote:
Hi,

I'm trying to control the ATS's cache based on the max-age parameter in the 
Cache-Control response header. But Seems like ATS is not abiding this config. I 
tried setting the following Config.


CONFIG proxy.config.http.cache.required_headers INT 1.  (Also tried setting it 
to 2).

In my response from server I'm setting just "Cache-Control: 
no-transform;max-age=30000". Am I supposed to set anything else other than 
max-age? (like "Last-modified" or "expires")?

Any sort of pointers on why it's not working would be much appreciated.


Change "no-transform; max-age=30000" to "no-transform, max-age=30000"

',' is the only allowed separator for HTTP message headers, afaik (';' would 
typically be used for additional parameters for the value).

-- Leif

Reply via email to