Code example for HttpUriRequest

Methods: modifyRequestToAcceptGzipResponse, setHeader

0
	protected HttpRequestBase createRequest(DataSourceRequest request) {
		return mRequestBuilder.build(request);
	} 
 
	public InputStream getInputSteam(HttpUriRequest request) throws IllegalStateException, IOException {
		request.setHeader(ACCEPT_KEY, ACCEPT_DEFAULT_VALUE);
		request.setHeader(USER_AGENT_KEY, sUserAgent);
		AndroidHttpClient.modifyRequestToAcceptGzipResponse(request);
		Log.xd(this, request);
		HttpResponse response = mClient.execute(request);
		int statusCode = response.getStatusLine().getStatusCode();
		if (statusCode == HttpStatus.SC_MOVED_TEMPORARILY || statusCode == HttpStatus.SC_MOVED_PERMANENTLY) {
			Header firstHeader = response.getFirstHeader("Location");
			if (firstHeader != null) {
				HttpGet redirectUri = new HttpGet(firstHeader.getValue());
				/*Header[] allHeaders = response.getAllHeaders(); 
				for (Header resHeader : allHeaders) { 
					redirectUri.addHeader(resHeader);	 
				}*/ 
				request.abort();
				return getInputSteam(redirectUri);
			} 
		} 
		Log.xd(this, request);
		if (mResponseStatusHandler != null) {
			mResponseStatusHandler.statusHandle(this, request, response);
		} 
		/*Header contentEncoding = response.getFirstHeader(CONTENT_ENCODING); 
		boolean isGzipResponse = false; 
		if (contentEncoding != null) { 
			isGzipResponse = contentEncoding != null && GZIP.equalsIgnoreCase(contentEncoding.getValue());