Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.koushikdutta.ion.builder;
  
  import  android.app.ProgressDialog;
  import  android.os.Handler;
  import  android.widget.ProgressBar;
  
  import  com.google.gson.JsonArray;
  import  com.google.gson.JsonObject;
  import  com.google.gson.reflect.TypeToken;
 
 import  org.apache.http.NameValuePair;
 
 import java.io.File;
 import java.util.List;
 import java.util.Map;

Created by koush on 5/30/13.
  // set parameters
 public interface RequestBuilder<F, R extends RequestBuilder, M extends MultipartBodyBuilder, U extends UrlEncodedBuilderextends MultipartBodyBuilder<M>, UrlEncodedBuilder<U> {
    
Enable logging for this request

Parameters:
tag LOGTAG to use
level Log level of messages to display
Returns:
 
     public R setLogging(String tagint level);

    
Route the request through the given proxy server.

Parameters:
host
port
 
     public R proxy(String hostint port);

    
Specify a callback that is invoked on download progress. This will not be invoked on the UI thread.

Parameters:
callback
Returns:
 
     public R progress(ProgressCallback callback);

    
Specify a callback that is invoked on download progress. This will be invoked on the UI thread.

Parameters:
callback
Returns:
 
     public R progressHandler(ProgressCallback callback);

    
Specify a ProgressBar to update during the request

Parameters:
progressBar
Returns:
 
     public R progressBar(ProgressBar progressBar);

    
Specify a ProgressDialog to update during the request

Parameters:
progressDialog
Returns:
 
     public R progressDialog(ProgressDialog progressDialog);

    
Specify a callback that is invoked on upload progress of a HTTP request body.

Parameters:
callback
Returns:
 
     public R uploadProgress(ProgressCallback callback);

    
Specify a callback that is invoked on upload progress of a HTTP request body. This will be invoked on the UI thread.

Parameters:
callback
Returns:
 
     public R uploadProgressHandler(ProgressCallback callback);

    
Specify a ProgressBar to update while uploading a request body.

Parameters:
progressBar
Returns:
 
     public R uploadProgressBar(ProgressBar progressBar);

    
Specify a ProgressDialog to update while uploading a request body.

Parameters:
progressDialog
Returns:
 
    public R uploadProgressDialog(ProgressDialog progressDialog);

    
Post the Future callback onto the given handler. Not specifying this explicitly results in the default handle of Thread.currentThread to be used, if one exists.

Parameters:
handler Handler to use or null
Returns:
    public R setHandler(Handler handler);

    
Set a HTTP header

Parameters:
name Header name
value Header value
Returns:
    public R setHeader(String nameString value);

    
Set HTTP headers

Parameters:
header
Returns:
    public R setHeader(NameValuePair... header);

    
Disable usage of the cache for this request

Returns:
    public R noCache();

    
Set whether this request will follow redirects
    public R followRedirect(boolean follow);

    
Add an HTTP header

Parameters:
name Header name
value Header value
Returns:
    public R addHeader(String nameString value);

    
Add multiple headers at once

Parameters:
params
Returns:
    public R addHeaders(Map<StringList<String>> params);

    
Add a query parameter

Parameters:
name
value
Returns:
    public R addQuery(String nameString value);

    
Add multiple query parameters at once

Parameters:
params
Returns:
    public R addQueries(Map<StringList<String>> params);

    
Set the user agent of this request.

Parameters:
userAgent
Returns:
    public R userAgent(String userAgent);

    
Specify the timeout in milliseconds before the request will cancel. A CancellationException will be returned as the result.

Parameters:
timeoutMilliseconds Timeout in milliseconds
Returns:
    public R setTimeout(int timeoutMilliseconds);

    
Invoke the given callback when the http request headers are received.

Parameters:
callback
Returns:
    public R onHeaders(HeadersCallback callback);

    
Provide Basic authentication credentials to be sent with the request.

Parameters:
username
password
Returns:
    public R basicAuthentication(String usernameString password);

    
Specify a JsonObject to send to the HTTP server. If no HTTP method was explicitly provided in the load call, the default HTTP method, POST, is used.

Parameters:
jsonObject JsonObject to send with the request
Returns:
    public F setJsonObjectBody(JsonObject jsonObject);

    
Specify a JsonObject to send to the HTTP server. If no HTTP method was explicitly provided in the load call, the default HTTP method, POST, is used.

Parameters:
object Object to serialize with Json and send with the request
token Type token to assist with generic type serialization
Returns:
    public <T> F setJsonObjectBody(T object, TypeToken<T> token);

    
Specify a JsonObject to send to the HTTP server. If no HTTP method was explicitly provided in the load call, the default HTTP method, POST, is used.

Parameters:
object Object to serialize with Json and send with the request
Returns:
    public <T> F setJsonObjectBody(T object);

    
Specify a JsonArray to send to the HTTP server. If no HTTP method was explicitly provided in the load call, the default HTTP method, POST, is used.

Parameters:
jsonArray JsonObject to send with the request
Returns:
    public F setJsonArrayBody(JsonArray jsonArray);

    
Specify a String to send to the HTTP server. If no HTTP method was explicitly provided in the load call, the default HTTP method, POST, is used.

Parameters:
string String to send with the request
Returns:
    public F setStringBody(String string);

    
Specify an XML Document to send to the HTTP server. If no HTTP method was explicitly provided in the load call, the default HTTP method, POST, is used.

Parameters:
document Document to send with the request
Returns:
    public F setDocumentBody(Document document);

    
Specify a File to send to the HTTP server. If no HTTP method was explicitly provided in the load call, the default HTTP method, POST, is used.

Parameters:
file File to send with the request
Returns:
    public F setFileBody(File file);

    
Specify a byte array to send to the HTTP server. If no HTTP method was explicitly provided in the load call, the default HTTP method, POST, is used.

Parameters:
bytes Bytes to send with the request
Returns:
    public F setByteArrayBody(byte[] bytes);

    
Specify an InputStream to send to the HTTP server. If no HTTP method was explicitly provided in the load call, the default HTTP method, POST, is used.

Parameters:
inputStream InputStream to send with the request
Returns:
    public Builders.Any.F setStreamBody(InputStream inputStream);

    
Specify an InputStream to send to the HTTP server. If no HTTP method was explicitly provided in the load call, the default HTTP method, POST, is used.

Parameters:
inputStream InputStream to send with the request
length length of the input stream (in bytes) to read
Returns:
    public Builders.Any.F setStreamBody(InputStream inputStreamint length);
New to GrepCode? Check out our FAQ X