There are several things:
* The @CacheFor annotation is for server side caching. Correctly used
it can improve performances. If you want to set the cache header, you
should use response.cacheFor(duration). A max-age header will be
added.
* The Etag should always be there I think
* The exception is probably a bug in the @CacheFor annotation. If you
can reproduce it consistently could you open a report?
> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>
>
--
Erwan Loisant
Erwan Loisant wrote:
> There are several things:
> * The @CacheFor annotation is for server side caching. Correctly used
> it can improve performances. If you want to set the cache header, you
> should use response.cacheFor(duration). A max-age header will be
> added.
> * The Etag should always be there I think
In case of binary content a last-modified header should be sufficient as
well (without etag), but would have to set in the program logic as well.
Also highly depends of course of the uniqueness of your URL...
--Alexander
public void copyResponse(ChannelHandlerContext ctx, Request request,
Response response, HttpRequest nettyRequest) throws Exception {
Logger.trace("copyResponse: begin");
...
final boolean keepAlive = isKeepAlive(nettyRequest);
if (file != null && file.isFile()) {
try {
nettyResponse = addEtag(nettyRequest, nettyResponse, file);
..
And the addEtag() method is in the same JAVA file.
So, if you did a renderBinary() of a variable that is a File type,
ETag should be in HTTP response, unless you have disabled explicitly
the ETag header.
You can disable ETag header putting http.useETag=false in your application.conf.
Hope this helps.
2011/4/23 indrek <ind...@gmail.com>: