Best code examples for Android HttpRequest class (org.apache.http.HttpRequest)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android HttpRequest class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android HttpRequest examples from Open Source projects
This code example shows how to use the following methods: getParams, getRequestLine
61:	HttpRequest request = new BasicHttpRequest("GET", "/stuff"); 
62:	request.getParams().setParameter( 
-
64:	assertEquals("GET", request.getRequestLine().getMethod()); 
65:	assertEquals("/stuff", request.getRequestLine().getUri()); 
66:	assertEquals(HttpVersion.HTTP_1_0, request.getRequestLine().getProtocolVersion()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader, getParams
27:	if(request.containsHeader(SOAP_Action)){ 
-
30:	if(request.getParams().getParameter(SOAP_Action)!=null){ 
31:	request.addHeader(SOAP_Action,(String) request.getParams().getParameter(SOAP_Action)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
196:	if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { 
197:	request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: containsHeader, getProtocolVersion, getRequestLine
91:	Assert.assertEquals(HttpVersion.HTTP_1_1, request.getProtocolVersion()); 
92:	Assert.assertEquals("/", request.getRequestLine().getUri()); 
93:	Assert.assertEquals("GET", request.getRequestLine().getMethod()); 
94:	Assert.assertTrue(request.containsHeader("User-Agent")); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addHeader
36:	request.addHeader("provider", "GoogleOpenIDConnect"); 
37:	request.addHeader("response_type", "code"); 
38:	request.addHeader("token", mToken); 
-
40:	request.addHeader("scope", "https://www.googleapis.com/auth/userinfo.email"); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addHeader
29:	request.addHeader("X-User-Id", mLogin); 
30:	request.addHeader("X-Device-Id", mDeviceId); 
31:	request.addHeader("X-Application-Name", mAppname); 
32:	request.addHeader("X-Temporary-Authentication-Token", mToken); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getAllHeaders, getFirstHeader, getRequestLine
133:	assertEquals("/whatever", request.getRequestLine().getUri()); 
134:	assertEquals(1, request.getAllHeaders().length); 
135:	assertEquals("stuff more stuff", request.getFirstHeader("Some header").getValue()); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getRequestLine
88:	v("Executing OAuthProcessor : " + request.getRequestLine().getUri()); 
-
99:	consumer.sign(request); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getRequestLine
54:	String uri = request.getRequestLine().getUri(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
130:	if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { 
131:	request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader
19:	req.addHeader("Host", "api.runkeeper.com"); 
20:	req.addHeader("Authorization", "Bearer " + ReboundmeActivity.getAccessToken()); 
21:	req.addHeader("Accept", "application/vnd.com.runkeeper.StrengthTrainingActivityFeed+json"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
96:	if (!request.containsHeader("Accept-Encoding")) { 
97:	request.addHeader("Accept-Encoding", "gzip"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getRequestLine
174:	Log.d(TAG, "Intercepted: " + request.getRequestLine().toString()); 
175:	mLastRequest = request; 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getRequestLine
91:	String uriPath = request.getRequestLine().getUri(); 
-
111:	Args.notNull(request, "HTTP request"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: containsHeader, getRequestLine
63:	Args.notNull(request, "HTTP request"); 
-
65:	if (!request.containsHeader(HTTP.EXPECT_DIRECTIVE)) { 
-
67:	final ProtocolVersion ver = request.getRequestLine().getProtocolVersion(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
196:	if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { 
197:	request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getRequestLine
87:	Mockito.when(this.request.getRequestLine()).thenReturn(new BasicRequestLine("GET", "/", HttpVersion.HTTP_1_0)); 
-
92:	Mockito.eq(this.request), Mockito.eq(this.response), Mockito.eq(this.context)); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getRequestLine
84:	this.log.debug(this.id + ": "  + request.getRequestLine().toString()); 
-
86:	super.submitRequest(request); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
45:	if (!request.containsHeader("Accept-Encoding")) { 
46:	request.addHeader("Accept-Encoding", "gzip"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setHeader
108:	request.setHeader("Accept", "application/json"); 
109:	request.setHeader("Content-type", "application/json"); 
110:	request.setHeader("Accept-Encoding", "gzip"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
218:	if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { 
219:	request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getRequestLine
94:	this.log.debug(this.id + ": "  + request.getRequestLine().toString()); 
-
96:	super.submitRequest(request); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setHeader
207:	request.setHeader("Cookie", cookie); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
71:	if (!request.containsHeader("Accept-Encoding")) { 
72:	request.addHeader("Accept-Encoding", "gzip"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getRequestLine
174:	Log.d(TAG, "Intercepted: " + request.getRequestLine().toString()); 
175:	mLastRequest = request; 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
148:	if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { 
149:	request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
148:	if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { 
149:	request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
116:	if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { 
117:	request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
64:	if (!request.containsHeader("Accept-Encoding")) { 
65:	request.addHeader("Accept-Encoding", "gzip"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
233:	if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { 
234:	request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
48:	if (!request.containsHeader("Accept-Encoding")) { 
49:	request.addHeader("Accept-Encoding", "gzip"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
48:	if (!request.containsHeader("Accept-Encoding")) { 
49:	request.addHeader("Accept-Encoding", "gzip"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
50:	if (!request.containsHeader(ACCEPT_ENCODING)) { 
51:	request.addHeader(ACCEPT_ENCODING, GZIP_CODEC); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
50:	if (!request.containsHeader(ACCEPT_ENCODING)) { 
51:	request.addHeader(ACCEPT_ENCODING, GZIP_CODEC); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
88:	if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { 
89:	request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
251:	if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { 
252:	request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
202:	if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { 
203:	request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
12:	if (!request.containsHeader("Accept-Encoding")) { 
13:	request.addHeader("Accept-Encoding", "gzip"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader, containsHeader
158:	if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { 
159:	request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getRequestLine
20:	if(response.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY && request.getRequestLine().getMethod().equalsIgnoreCase(HttpPost.METHOD_NAME)) 
-
23:	return super.isRedirected(request, response, context); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getRequestLine
128:	String uriStr = request.getRequestLine().getUri(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getRequestLine
20:	sessionID = HttpServerUtil.getCookie(req, "SessionID"); 
-
26:	HttpServerUtil.redirect(resp, "/init.session?url=" + req.getRequestLine().getUri()); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader
208:	request.addHeader("Accept-Encoding", "gzip"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getRequestLine
30:	if (!"GET".equals(request.getRequestLine().getMethod())) { 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addHeader
199:	request.addHeader("Accept-Encoding", "gzip"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getAllHeaders, getRequestLine
75:	Assert.assertNotSame(request, newRequest); 
-
77:	Assert.assertEquals(theMethod, newRequest.getRequestLine().getMethod()); 
78:	Assert.assertEquals(theUri, newRequest.getRequestLine().getUri()); 
-
80:	.getRequestLine().getProtocolVersion()); 
81:	Assert.assertEquals(2, newRequest.getAllHeaders().length); 
-
83:	Assert.assertEquals("Accept-Encoding", newRequest.getAllHeaders()[0].getName()); 
84:	Assert.assertEquals("gzip", newRequest.getAllHeaders()[0].getValue()); 
-
86:	Assert.assertEquals("If-Modified-Since", newRequest.getAllHeaders()[1].getName()); 
87:	Assert.assertEquals(lastModified, newRequest.getAllHeaders()[1].getValue()); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setHeader
114:	req.setHeader(OPEN_ROSA_VERSION_HEADER, OPEN_ROSA_VERSION); 
-
116:	req.setHeader(DATE_HEADER, DateFormat.format("E,dd MMM yyyy hh:mm:ss zz	",g).toString()); 
-
141:	req.setHeader("Authorization", "GoogleLogin auth=" + auth); 
Full Snippet Info
5
CodeRank
Related Android HttpRequest Questions & Answers:
Other Android HttpRequest Examples
50:	
51:				HttpRequestFactory httpRequestFactory = createRequestFactory(HTTP_TRANSPORT);
52:				HttpRequest request = httpRequestFactory
53:						.buildGetRequest(new GenericUrl(PLACES_SEARCH_URL));
54:				request.getUrl().put("key", API_KEY);
-
80:	
81:				HttpRequestFactory httpRequestFactory = createRequestFactory(HTTP_TRANSPORT);
82:				HttpRequest request = httpRequestFactory
83:						.buildGetRequest(new GenericUrl(PLACES_DETAILS_URL));
84:				request.getUrl().put("key", API_KEY);
-
102:				final HttpTransport transport) {
103:			return transport.createRequestFactory(new HttpRequestInitializer() {
104:				public void initialize(HttpRequest request) {
105:					GoogleHeaders headers = new GoogleHeaders();
106:					headers.setApplicationName("AndroidHive-Places-Test");

Read More

See Code Examples for Android HttpRequest Methods: