Code example for HttpRequestBase

Methods: setURIaddHeader

0
			request = new HttpPost();
		else 
			return null; 
 
		try {			 
			request.setURI(new URI(uri.toString()));
			 
			// Set Headers 
            request.addHeader("User-Agent", "YP Mobile Android/2.1");
             
            // Execute 
            HttpResponse response = m_client.execute(request);
         
            // Get Response Text 
            return EntityUtils.toByteArray(response.getEntity());
		} 
	    catch (Exception e) {
	        e.printStackTrace();
	    } 
 
Contextual code suggestions in your IDE  Get Codota for Java