Code example for HttpURLConnection

Methods: getErrorStreamgetResponseCodegetContentEncodinggetInputStream

0
    public Response()  { 
    	 
    } 
    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);
        } 
    } 
 
    // for test purpose 
    /*package*/ Response(String content) {
        this.responseAsString = content;
    } 
 
Stop searching for code, let great code find you!  Add Codota to your java IDE