Class HttpUtil


  • public class HttpUtil
    extends org.apache.sling.api.servlets.HttpConstants
    A basic class for all '/bin/{service}/path/to/resource' servlets.
    • Constructor Detail

      • HttpUtil

        public HttpUtil()
    • Method Detail

      • notModifiedSince

        public static boolean notModifiedSince​(long ifModifiedSince,
                                               Calendar lastModified)
        Checks whether we can skip transmission of a resource because of a recent enough HttpConstants.HEADER_IF_MODIFIED_SINCE header. Returns true if the given lastModified date is after the {ifModifiedSince} or if there is no lastModified date, so that we don't know and have to transmit the resource, anyway.
        Parameters:
        ifModifiedSince - value of the HttpConstants.HEADER_IF_MODIFIED_SINCE header
        lastModified - date of the resource to be submitted
        Returns:
        if the resource transmission can be skipped since the browser has the current version
      • notModifiedSince

        public static boolean notModifiedSince​(long ifModifiedSince,
                                               Long lastModified)
        Checks whether we can skip transmission of a resource because of a recent enough HttpConstants.HEADER_IF_MODIFIED_SINCE header. Returns true if the given lastModified date is after the {ifModifiedSince} or if there is no lastModified date, so that we don't know and have to transmit the resource, anyway.
        Parameters:
        ifModifiedSince - value of the HttpConstants.HEADER_IF_MODIFIED_SINCE header
        lastModified - date of the resource to be submitted
        Returns:
        if the resource transmission can be skipped since the browser has the current version
      • isModifiedSince

        @Deprecated
        public static boolean isModifiedSince​(long ifModifiedSince,
                                              Long lastModified)
        Deprecated.
        please use notModifiedSince(long, Long) since that's cleaner; this will be removed soon