Class HttpParser


  • @Deprecated
    public class HttpParser
    extends java.lang.Object
    Deprecated.
    Jakarta Commons HttpClient 3.x is deprecated in the Jenkins project. It is not recommended to use it in any new code. Instead, use HTTP client API plugins as a dependency in your code. E.g. Apache HttpComponents Client API 4.x Plugin or Async HTTP Client Plugin.
    A utility class for parsing http header values according to RFC-2616 Section 4 and 19.3.
    Since:
    2.0beta1
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static Header[] parseHeaders​(java.io.InputStream is)
      Deprecated.
      use #parseHeaders(InputStream, String)
      static Header[] parseHeaders​(java.io.InputStream is, java.lang.String charset)
      Deprecated.
      Parses headers from the given stream.
      static java.lang.String readLine​(java.io.InputStream inputStream)
      Deprecated.
      use #readLine(InputStream, String)
      static java.lang.String readLine​(java.io.InputStream inputStream, java.lang.String charset)
      Deprecated.
      Read up to "\n" from an (unchunked) input stream.
      static byte[] readRawLine​(java.io.InputStream inputStream)
      Deprecated.
      Return byte array from an (unchunked) input stream.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • readRawLine

        public static byte[] readRawLine​(java.io.InputStream inputStream)
                                  throws java.io.IOException
        Deprecated.
        Return byte array from an (unchunked) input stream. Stop reading when "\n" terminator encountered If the stream ends before the line terminator is found, the last part of the string will still be returned. If no input data available, null is returned.
        Parameters:
        inputStream - the stream to read from
        Returns:
        a byte array from the stream
        Throws:
        java.io.IOException - if an I/O problem occurs
      • readLine

        public static java.lang.String readLine​(java.io.InputStream inputStream,
                                                java.lang.String charset)
                                         throws java.io.IOException
        Deprecated.
        Read up to "\n" from an (unchunked) input stream. If the stream ends before the line terminator is found, the last part of the string will still be returned. If no input data available, null is returned.
        Parameters:
        inputStream - the stream to read from
        charset - charset of HTTP protocol elements
        Returns:
        a line from the stream
        Throws:
        java.io.IOException - if an I/O problem occurs
        Since:
        3.0
      • readLine

        public static java.lang.String readLine​(java.io.InputStream inputStream)
                                         throws java.io.IOException
        Deprecated.
        use #readLine(InputStream, String)
        Read up to "\n" from an (unchunked) input stream. If the stream ends before the line terminator is found, the last part of the string will still be returned. If no input data available, null is returned
        Parameters:
        inputStream - the stream to read from
        Returns:
        a line from the stream
        Throws:
        java.io.IOException - if an I/O problem occurs
      • parseHeaders

        public static Header[] parseHeaders​(java.io.InputStream is,
                                            java.lang.String charset)
                                     throws java.io.IOException,
                                            HttpException
        Deprecated.
        Parses headers from the given stream. Headers with the same name are not combined.
        Parameters:
        is - the stream to read headers from
        charset - the charset to use for reading the data
        Returns:
        an array of headers in the order in which they were parsed
        Throws:
        java.io.IOException - if an IO error occurs while reading from the stream
        HttpException - if there is an error parsing a header value
        Since:
        3.0
      • parseHeaders

        public static Header[] parseHeaders​(java.io.InputStream is)
                                     throws java.io.IOException,
                                            HttpException
        Deprecated.
        use #parseHeaders(InputStream, String)
        Parses headers from the given stream. Headers with the same name are not combined.
        Parameters:
        is - the stream to read headers from
        Returns:
        an array of headers in the order in which they were parsed
        Throws:
        java.io.IOException - if an IO error occurs while reading from the stream
        HttpException - if there is an error parsing a header value