Code example for HttpRequest

Methods: setHeader

0
		return response;
	} 
 
	public static void setUserAgent(HttpRequest request) {
		if (request != null) {
			request.setHeader("User-Agent", System.getProperty("http.agent")
					+ " BaiduMusic"); 
		} 
	} 
 
	public static String encodeUrl(String value) {
		String encoded = null;
		try { 
			encoded = URLEncoder.encode(value, "UTF-8");
		} catch (UnsupportedEncodingException ignore) {
			encoded = value;
		} 
		StringBuilder sb = new StringBuilder(encoded.length());
		char focus;
		for (int i = 0; i < encoded.length(); i++) {
			focus = encoded.charAt(i);