Class ETagUtils


  • public class ETagUtils
    extends Object
    Author:
    Stuart Douglas
    • Constructor Detail

      • ETagUtils

        public ETagUtils()
    • Method Detail

      • handleIfMatch

        public static boolean handleIfMatch​(HttpServerExchange exchange,
                                            ETag etag,
                                            boolean allowWeak)
        Handles the if-match header. returns true if the request should proceed, false otherwise
        Parameters:
        exchange - the exchange
        etag - The etags
        Returns:
      • handleIfMatch

        public static boolean handleIfMatch​(HttpServerExchange exchange,
                                            List<ETag> etags,
                                            boolean allowWeak)
        Handles the if-match header. returns true if the request should proceed, false otherwise
        Parameters:
        exchange - the exchange
        etags - The etags
        Returns:
      • handleIfMatch

        public static boolean handleIfMatch​(String ifMatch,
                                            ETag etag,
                                            boolean allowWeak)
        Handles the if-match header. returns true if the request should proceed, false otherwise
        Parameters:
        ifMatch - The if match header
        etag - The etags
        Returns:
      • handleIfMatch

        public static boolean handleIfMatch​(String ifMatch,
                                            List<ETag> etags,
                                            boolean allowWeak)
        Handles the if-match header. returns true if the request should proceed, false otherwise
        Parameters:
        ifMatch - The ifMatch header
        etags - The etags
        Returns:
      • handleIfNoneMatch

        public static boolean handleIfNoneMatch​(HttpServerExchange exchange,
                                                ETag etag,
                                                boolean allowWeak)
        Handles the if-none-match header. returns true if the request should proceed, false otherwise
        Parameters:
        exchange - the exchange
        etag - The etags
        Returns:
      • handleIfNoneMatch

        public static boolean handleIfNoneMatch​(HttpServerExchange exchange,
                                                List<ETag> etags,
                                                boolean allowWeak)
        Handles the if-none-match header. returns true if the request should proceed, false otherwise
        Parameters:
        exchange - the exchange
        etags - The etags
        Returns:
      • handleIfNoneMatch

        public static boolean handleIfNoneMatch​(String ifNoneMatch,
                                                ETag etag,
                                                boolean allowWeak)
        Handles the if-none-match header. returns true if the request should proceed, false otherwise
        Parameters:
        ifNoneMatch - the header
        etag - The etags
        Returns:
      • handleIfNoneMatch

        public static boolean handleIfNoneMatch​(String ifNoneMatch,
                                                List<ETag> etags,
                                                boolean allowWeak)
        Handles the if-none-match header. returns true if the request should proceed, false otherwise
        Parameters:
        ifNoneMatch - the header
        etags - The etags
        Returns:
      • parseETagList

        public static List<ETag> parseETagList​(String header)
      • getETag

        public static ETag getETag​(HttpServerExchange exchange)
        Parameters:
        exchange - The exchange
        Returns:
        The ETag for the exchange, or null if the etag is not set