public class AddETagFilter implements ContainerResponseFilter {
@Override
public void filter(final ContainerRequestContext reqCtx, final ContainerResponseContext resCtx) throws IOException {
if (resCtx.getEntity() instanceof AbstractSysInfoTO && resCtx.getEntityTag() == null) {
AbstractSysInfoTO sysInfo = (AbstractSysInfoTO) resCtx.getEntity();
String etagValue = sysInfo.getETagValue();
if (StringUtils.isNotBlank(etagValue)) {
resCtx.getHeaders().add(HttpHeaders.ETAG, new EntityTag(etagValue).toString());
}
}
}