Module org.htmlunit

Class HeaderUtils

java.lang.Object
org.htmlunit.util.HeaderUtils

public final class HeaderUtils extends Object
Utility class for HTTP header analysis.
Author:
Anton Demydenko, Lai Quang Duong, Ronald Brill
  • Method Details

    • containsPrivate

      public static boolean containsPrivate(WebResponse response)
      Returns whether the Cache-Control header is present and contains the private directive.
      Parameters:
      response - the WebResponse to check
      Returns:
      true if the Cache-Control header contains private
    • containsPublic

      public static boolean containsPublic(WebResponse response)
      Returns whether the Cache-Control header is present and contains the public directive.
      Parameters:
      response - the WebResponse to check
      Returns:
      true if the Cache-Control header contains public
    • containsNoStore

      public static boolean containsNoStore(WebResponse response)
      Returns whether the Cache-Control header is present and contains the no-store directive.
      Parameters:
      response - the WebResponse to check
      Returns:
      true if the Cache-Control header contains no-store
    • containsNoCache

      public static boolean containsNoCache(WebResponse response)
      Returns whether the Cache-Control header is present and contains the no-cache directive.
      Parameters:
      response - the WebResponse to check
      Returns:
      true if the Cache-Control header contains no-cache
    • containsETag

      public static boolean containsETag(WebResponse response)
      Returns whether the ETag header is present.
      Parameters:
      response - the WebResponse to check
      Returns:
      true if the ETag header is present
    • containsLastModified

      public static boolean containsLastModified(WebResponse response)
      Returns whether the Last-Modified header is present.
      Parameters:
      response - the WebResponse to check
      Returns:
      true if the Last-Modified header is present
    • containsSMaxage

      public static boolean containsSMaxage(WebResponse response)
      Returns whether the Cache-Control header is present and contains the s-maxage directive.
      Parameters:
      response - the WebResponse to check
      Returns:
      true if the Cache-Control header contains s-maxage
    • containsMaxAge

      public static boolean containsMaxAge(WebResponse response)
      Returns whether the Cache-Control header is present and contains the max-age directive.
      Parameters:
      response - the WebResponse to check
      Returns:
      true if the Cache-Control header contains max-age
    • containsMaxAgeOrSMaxage

      public static boolean containsMaxAgeOrSMaxage(WebResponse response)
      Returns whether the Cache-Control header is present and contains either the max-age or the s-maxage directive.
      Parameters:
      response - the WebResponse to check
      Returns:
      true if the Cache-Control header contains max-age or s-maxage
    • sMaxage

      public static long sMaxage(WebResponse response)
      Returns the value of the s-maxage directive, or 0 if it is absent.
      Parameters:
      response - the WebResponse to check
      Returns:
      the value of the s-maxage directive, or 0
    • maxAge

      public static long maxAge(WebResponse response)
      Returns the value of the max-age directive, or 0 if it is absent.
      Parameters:
      response - the WebResponse to check
      Returns:
      the value of the max-age directive, or 0