Code example for HttpURLConnection

Methods: getErrorStreamgetResponseCodegetContentEncodinggetInputStream

0
    	this.method = method; 
    } 
     
    public Response(HttpURLConnection con) throws IOException { 
        this.con = con; 
        this.statusCode = con.getResponseCode(); 
        if(null == (is = con.getErrorStream())){ 
            is = con.getInputStream(); 
        } 
        if (null != is && "gzip".equals(con.getContentEncoding())) { 
            // the response is gzipped 
            is = new GZIPInputStream(is); 
        } 
    } 
 
    public int getStatusCode() { 
        return statusCode; 
    } 
 
    public String getResponseHeader(String name) { 
Experience pair programming with AI  Get Codota for Java