MCPcopy Create free account
hub / github.com/curtcox/JLHTTP / match

Method match

src/main/java/net/freeutils/httpserver/HTTPServer.java:2836–2843  ·  view source on GitHub ↗

Matches the given ETag value against the given ETags. A match is found if the given ETag is not null, and either the ETags contain a " " value, or one of them is identical to the given ETag. If strong comparison is used, tags beginning with the weak ETag prefix "W/" never match. See RFC2616#3.11, RF

(boolean strong, String[] etags, String etag)

Source from the content-addressed store, hash-verified

2834 * @return true if the ETag is matched, false otherwise
2835 */
2836 public static boolean match(boolean strong, String[] etags, String etag) {
2837 if (etag == null || strong && etag.startsWith("W/"))
2838 return false;
2839 for (String e : etags)
2840 if (e.equals("*") || (e.equals(etag) && !(strong && (e.startsWith("W/")))))
2841 return true;
2842 return false;
2843 }
2844
2845 /**
2846 * Calculates the appropriate response status for the given request and

Callers 1

getConditionalStatusMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected