@Test public void testMatchTag() throws Exception { assertTrue(ResourceUtils.matchTag("\"123-4567890\"", "W/\"123-4567890\"")); assertTrue(ResourceUtils.matchTag("\"123-4567890\"", "W/\"123-4567890\", \"123-4567891\"")); assertTrue(ResourceUtils.matchTag("W/\"123-4567891\"", "W/\"123-4567890\", \"123-4567891\"")); assertFalse(ResourceUtils.matchTag("\"123-4567890\"", "W/\"023-4567890\"")); assertFalse(ResourceUtils.matchTag("\"123-4567890\"", "W/\"023-4567890\", \"023-4567891\"")); assertFalse(ResourceUtils.matchTag("W/\"123-4567891\"", "W/\"023-4567890\", \"023-4567891\"")); try { ResourceUtils.matchTag(null, "W/\"123-4567890\", \"123-4567891\""); fail(); } catch (IllegalArgumentException e) { } try { ResourceUtils.matchTag("W/\"123-4567890\"", null); fail(); } catch (IllegalArgumentException e) { } try { ResourceUtils.matchTag("123\"456789", "W/\"123\""); fail(); } catch (IllegalArgumentException e) { } }
public static boolean matchTag(String eTag, String eTagHeaderValue) { if ((eTag == null) || (eTagHeaderValue == null)) { throw new IllegalArgumentException("tag and tagHeaderValue must be not null"); } Matcher eTagMatcher = ETAG_PATTERN.matcher(eTag); if (!eTagMatcher.find()) { throw new IllegalArgumentException(); } String tag = eTagMatcher.group(1); Matcher eTagHeaderMatcher = ETAG_PATTERN.matcher(eTagHeaderValue); while (eTagHeaderMatcher.find()) { if (tag.equals(eTagHeaderMatcher.group(1))) { return true; } } return false; }
ResourceUtils { public static boolean matchTag(String eTag, String eTagHeaderValue) { if ((eTag == null) || (eTagHeaderValue == null)) { throw new IllegalArgumentException("tag and tagHeaderValue must be not null"); } Matcher eTagMatcher = ETAG_PATTERN.matcher(eTag); if (!eTagMatcher.find()) { throw new IllegalArgumentException(); } String tag = eTagMatcher.group(1); Matcher eTagHeaderMatcher = ETAG_PATTERN.matcher(eTagHeaderValue); while (eTagHeaderMatcher.find()) { if (tag.equals(eTagHeaderMatcher.group(1))) { return true; } } return false; } }
ResourceUtils { public static boolean matchTag(String eTag, String eTagHeaderValue) { if ((eTag == null) || (eTagHeaderValue == null)) { throw new IllegalArgumentException("tag and tagHeaderValue must be not null"); } Matcher eTagMatcher = ETAG_PATTERN.matcher(eTag); if (!eTagMatcher.find()) { throw new IllegalArgumentException(); } String tag = eTagMatcher.group(1); Matcher eTagHeaderMatcher = ETAG_PATTERN.matcher(eTagHeaderValue); while (eTagHeaderMatcher.find()) { if (tag.equals(eTagHeaderMatcher.group(1))) { return true; } } return false; } private  ResourceUtils(); }
ResourceUtils { public static boolean matchTag(String eTag, String eTagHeaderValue) { if ((eTag == null) || (eTagHeaderValue == null)) { throw new IllegalArgumentException("tag and tagHeaderValue must be not null"); } Matcher eTagMatcher = ETAG_PATTERN.matcher(eTag); if (!eTagMatcher.find()) { throw new IllegalArgumentException(); } String tag = eTagMatcher.group(1); Matcher eTagHeaderMatcher = ETAG_PATTERN.matcher(eTagHeaderValue); while (eTagHeaderMatcher.find()) { if (tag.equals(eTagHeaderMatcher.group(1))) { return true; } } return false; } private  ResourceUtils(); static String getMappingForRequest(FacesContext context); static Date parseHttpDate(String s); static String formatHttpDate(Object object); static byte[] decodeBytesData(String encodedData); static Object decodeObjectData(String encodedData); static String encodeBytesData(byte[] data); static String encodeObjectData(Object data); static String encodeJSFURL(FacesContext context, String url); static Map<String, String> parseResourceParameters(String resourceName); static String decodeResourceURL(FacesContext context); static void copyStreamContent(InputStream is, OutputStream os); static String encodeURIQueryPart(String s); static Object saveResourceState(FacesContext context, Object resource); static void restoreResourceState(FacesContext context, Object resource, Object state); static Charset getCharsetFromContentType(String contentType); static String formatWeakTag(String eTag); static String formatTag(String eTag); static boolean matchTag(String eTag, String eTagHeaderValue); static long millisToSecond(long millisecond); static long secondToMillis(long second); }
ResourceUtils { public static boolean matchTag(String eTag, String eTagHeaderValue) { if ((eTag == null) || (eTagHeaderValue == null)) { throw new IllegalArgumentException("tag and tagHeaderValue must be not null"); } Matcher eTagMatcher = ETAG_PATTERN.matcher(eTag); if (!eTagMatcher.find()) { throw new IllegalArgumentException(); } String tag = eTagMatcher.group(1); Matcher eTagHeaderMatcher = ETAG_PATTERN.matcher(eTagHeaderValue); while (eTagHeaderMatcher.find()) { if (tag.equals(eTagHeaderMatcher.group(1))) { return true; } } return false; } private  ResourceUtils(); static String getMappingForRequest(FacesContext context); static Date parseHttpDate(String s); static String formatHttpDate(Object object); static byte[] decodeBytesData(String encodedData); static Object decodeObjectData(String encodedData); static String encodeBytesData(byte[] data); static String encodeObjectData(Object data); static String encodeJSFURL(FacesContext context, String url); static Map<String, String> parseResourceParameters(String resourceName); static String decodeResourceURL(FacesContext context); static void copyStreamContent(InputStream is, OutputStream os); static String encodeURIQueryPart(String s); static Object saveResourceState(FacesContext context, Object resource); static void restoreResourceState(FacesContext context, Object resource, Object state); static Charset getCharsetFromContentType(String contentType); static String formatWeakTag(String eTag); static String formatTag(String eTag); static boolean matchTag(String eTag, String eTagHeaderValue); static long millisToSecond(long millisecond); static long secondToMillis(long second);  }