Class HeaderParser


  • public class HeaderParser
    extends java.lang.Object
    This class provides is useful for the nightmare of parsing multi-part HTTP/RFC822 headers sensibly:

     From a String like: 'timeout=15, max=5'
     create an array of Strings:
     { {"timeout", "15"},
       {"max", "5"}
     }
     From one like: 'Basic Realm="FuzzFace" Foo="Biz Bar Baz"'
     create one like (no quotes in literal):
     { {"basic", null},
       {"realm", "FuzzFace"}
       {"foo", "Biz Bar Baz"}
     }
     keys are converted to lower case, vals are left as is....
     
    • Constructor Summary

      Constructors 
      Constructor Description
      HeaderParser​(java.lang.String raw)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int findInt​(java.lang.String k, int Default)  
      java.lang.String findKey​(int i)  
      java.lang.String findValue​(int i)  
      java.lang.String findValue​(java.lang.String key)  
      java.lang.String findValue​(java.lang.String k, java.lang.String Default)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HeaderParser

        public HeaderParser​(java.lang.String raw)
    • Method Detail

      • findKey

        public java.lang.String findKey​(int i)
      • findValue

        public java.lang.String findValue​(int i)
      • findValue

        public java.lang.String findValue​(java.lang.String key)
      • findValue

        public java.lang.String findValue​(java.lang.String k,
                                          java.lang.String Default)
      • findInt

        public int findInt​(java.lang.String k,
                           int Default)