You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tfredrich edited this page Sep 17, 2012
·
5 revisions
public class LastModifiedHeaderPostprocessor
implements Postprocessor
{
DateAdapter fmt = new HttpHeaderTimestampAdapter();
@Override
public void process(Request request, Response response)
{
if (!request.isMethodGet()) return;
if (!response.hasBody()) return;
Object body = response.getBody();
if (!response.hasHeader(LAST_MODIFIED) && Timestamped.class.isAssignableFrom(body.getClass()))
{
response.addHeader(LAST_MODIFIED, fmt.format(((Timestamped) body).getUpdatedAt()));
}
}
}