Class ResponseUtils


  • public class ResponseUtils
    extends Object
    • Constructor Detail

      • ResponseUtils

        public ResponseUtils()
    • Method Detail

      • responseCharset

        public static Charset responseCharset​(String contentTypeHeader)
                                       throws IllegalCharsetNameException,
                                              UnsupportedCharsetException
        Returns the response charset of a HTTP response based on the Content-Type of the response (see RFC 7230). If the Content-Type header is missing or invalid, the response is assumed to be encoded as UTF-8. Note that a charset usually makes sense only for "text/plain" and other "text based" responses.
        Throws:
        IllegalCharsetNameException - if the response specified charset is illegal.
        UnsupportedCharsetException - if the response specified charset is unsupported.