Class Headers


  • public class Headers
    extends Object
    Retrieve and process Webdav header values
    Author:
    Mike Douglass douglm rpi.edu
    • Constructor Detail

      • Headers

        public Headers()
    • Method Detail

      • depth

        public static int depth​(javax.servlet.http.HttpServletRequest req)
                         throws WebdavException
        Get the depth header
        Parameters:
        req - HttpServletRequest
        Returns:
        int depth - depthInfinity if absent
        Throws:
        WebdavException
      • depth

        public static int depth​(javax.servlet.http.HttpServletRequest req,
                                int def)
                         throws WebdavException
        Get the depth header
        Parameters:
        req - HttpServletRequest
        def - int default if no header
        Returns:
        int depth -
        Throws:
        WebdavException
      • brief

        public static boolean brief​(javax.servlet.http.HttpServletRequest req)
        Parameters:
        req -
        Returns:
        true if we have a (MS) "brief" header or the Prefer header with "return-minimal" or "return=minimal"
      • returnRepresentation

        public static boolean returnRepresentation​(javax.servlet.http.HttpServletRequest req)
        Parameters:
        req -
        Returns:
        true if we have a Prefer header with "return-representation" or "return=representation"
      • makeLocation

        public static void makeLocation​(javax.servlet.http.HttpServletResponse resp,
                                        String url)
        Create a location header
        Parameters:
        resp -
        url -
      • testIfHeader

        public static Headers.IfHeader testIfHeader​(javax.servlet.http.HttpServletRequest req)
                                             throws WebdavException
        From Webdav RFC4918 Section 10.4
          If = "If" ":" ( 1*No-tag-list | 1*Tagged-list )
        
          No-tag-list = List
          Tagged-list = Resource-Tag 1*List
        
          List = "(" 1*Condition ")"
          Condition = ["Not"] (State-token | "[" entity-tag "]")
          ; entity-tag: see Section 3.11 of [RFC2616]
          ; No LWS allowed between "[", entity-tag and "]"
        
          State-token = Coded-URL
        
          Resource-Tag = "<" Simple-ref ">"
          ; Simple-ref: see Section 8.3
          ; No LWS allowed in Resource-Tag
         
        Parameters:
        req -
        Returns:
        populated IfHeader or null
        Throws:
        WebdavException
      • ifNoneMatchAny

        public static boolean ifNoneMatchAny​(javax.servlet.http.HttpServletRequest req)
                                      throws WebdavException
        Look for the If-None-Match * header
        Parameters:
        req - HttpServletRequest
        Returns:
        boolean true if present
        Throws:
        WebdavException
      • ifNoneMatch

        public static String ifNoneMatch​(javax.servlet.http.HttpServletRequest req)
                                  throws WebdavException
        Look for the If-None-Match header
        Parameters:
        req - HttpServletRequest
        Returns:
        String null if not present
        Throws:
        WebdavException
      • ifMatch

        public static String ifMatch​(javax.servlet.http.HttpServletRequest req)
                              throws WebdavException
        Look for the If-Match header
        Parameters:
        req - HttpServletRequest
        Returns:
        String null if not present
        Throws:
        WebdavException
      • ifScheduleTagMatch

        public static String ifScheduleTagMatch​(javax.servlet.http.HttpServletRequest req)
                                         throws WebdavException
        Look for the If-Schedule-Tag-Match header
        Parameters:
        req - HttpServletRequest
        Returns:
        String null if not present
        Throws:
        WebdavException