Code example for HttpURLConnection

Methods: getContentEncoding, setConnectTimeout, setReadTimeout, setRequestMethod

0
		try { 
			connect(); 
		} catch (IOException ex) {
			return ""; 
		} 
		return this.connection.getContentEncoding();
	} 
	 
	public String getHeaderField(String name) throws IOException {
		connect(); 
		return this.connection.getHeaderField(name);
	} 
	 
	public String getHeaderField(int n) throws IOException {
		connect(); 
		return this.connection.getHeaderField(n);
	} 
	 
	public int getResponseCode()  throws IOException { 
		connect(); 
		int responseCode = this.connection.getResponseCode();