Package jodd.http

Class HttpResponse

    • Field Detail

      • statusCode

        protected int statusCode
      • statusPhrase

        protected java.lang.String statusPhrase
    • Constructor Detail

      • HttpResponse

        public HttpResponse()
    • Method Detail

      • statusCode

        public int statusCode()
        Returns response status code.
      • statusCode

        public HttpResponse statusCode​(int statusCode)
        Sets response status code.
      • statusPhrase

        public java.lang.String statusPhrase()
        Returns response status phrase.
      • statusPhrase

        public HttpResponse statusPhrase​(java.lang.String statusPhrase)
        Sets response status phrase.
      • location

        public java.lang.String location()
        Parses the 'location' header and returns an absolute URL for the provided path. Returns null if no location was specified or throws HttpException if it was impossible to assemble a valid URL.

        RFC 2616 still required an absolute URL, whereas RFC 9110 introduced the support for relative paths.

      • cookies

        public Cookie[] cookies()
        Returns list of valid cookies sent from server. If no cookie found, returns an empty array. Invalid cookies are ignored.
        Overrides:
        cookies in class HttpBase<HttpResponse>
      • unzip

        public HttpResponse unzip()
        Unzips GZip-ed body content, removes the content-encoding header and sets the new content-length value.
      • readFrom

        public static HttpResponse readFrom​(java.io.InputStream in)
        Reads response input stream and returns response. Supports both streamed and chunked response.
      • close

        public HttpResponse close()
        Closes requests connection if it was open. Should be called when using keep-alive connections. Otherwise, connection will be already closed.