public static boolean isNotModified(HttpServletRequest request,HttpServletResponse response,String tag){
  tag=tag != null ? (QUOTE + tag + QUOTE) : null;
  String inputTag=request.getHeader(HEADER_IF_NONE_MATCH);
  response.setHeader(HEADER_ETAG,tag);
  if (inputTag != null && inputTag.equals(tag)) {
    response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
    return true;
  }
  return false;
}

public static boolean isNotModified ( HttpServletRequest request , HttpServletResponse response , String tag ) { tag = tag != null ? ( QUOTE + tag + QUOTE ) : null ; String inputTag = request . getHeader ( HEADER_IF_NONE_MATCH ) ; response . setHeader ( HEADER_ETAG , tag ) ; if ( inputTag != null && inputTag . equals ( tag ) ) { response . setStatus ( HttpServletResponse . SC_NOT_MODIFIED ) ; return true ; } return false ; }
this method looks up the etag sent in the request from the " if - none - match " header value and compares it to the given tag . if they match , it will set status code 304 not modified on the response . it will set the etag header on the response in any case . it will wrap the given tag in quotes .
