Share via


IHttpRequest Interface

public interface IHttpRequest

An HTTP request

Method Summary

Modifier and Type Method and Description
default nativeRequestType getHttpRequest()

Returns the Request object to be executed

abstract nativeRequestType <requestBodyType,responseType,nativeRequestType>getHttpRequest(requestBodyType serializedObject)

Returns the Request object to be executed

abstract void addHeader(String header, String value)

Adds a header to this request

abstract long getDelay()

Gets delay between retries

abstract java.util.List<HeaderOption> getHeaders()

Gets the headers

abstract HttpMethod getHttpMethod()

Gets the HTTP method

abstract int getMaxRedirects()

Gets the max redirects

abstract int getMaxRetries()

Gets max retries

abstract java.util.List<Option> getOptions()

Gets the options

abstract java.net.URL getRequestUrl()

Gets the request URL

abstract IShouldRedirect getShouldRedirect()

Gets the should redirect callback

abstract IShouldRetry getShouldRetry()

Gets the should retry callback

abstract boolean getUseCaches()

Gets useCaches parameter

abstract void setDelay(long delay)

Sets the delay in seconds between retires

abstract void setMaxRedirects(int maxRedirects)

Sets the max redirects

abstract void setMaxRetries(int maxRetries)

Sets the max retries

abstract void setShouldRedirect(IShouldRedirect shouldRedirect)

Sets the should redirect callback

abstract void setShouldRetry(IShouldRetry shouldretry)

Sets the should retry callback

abstract void setUseCaches(boolean useCaches)

Sets useCaches parameter to cache the response

abstract IHttpRequest withHttpMethod(HttpMethod httpMethod)

Sets the HTTP method and returns the current request

Method Details

getHttpRequest

public default nativeRequestType getHttpRequest()

Returns the Request object to be executed

Returns:

the Request object to be executed

Throws:

<requestBodyType,responseType,nativeRequestType>getHttpRequest

public abstract nativeRequestType getHttpRequest(requestBodyType serializedObject)

Returns the Request object to be executed

Parameters:

serializedObject - the object to serialize at the body of the request

Returns:

the Request object to be executed

Throws:

addHeader

public abstract void addHeader(String header, String value)

Adds a header to this request

Parameters:

header - the name of the header
value - the value of the header

getDelay

public abstract long getDelay()

Gets delay between retries

Returns:

Delay between retries in seconds

getHeaders

public abstract List getHeaders()

Gets the headers

Returns:

the headers

getHttpMethod

public abstract HttpMethod getHttpMethod()

Gets the HTTP method

Returns:

the HTTP method

getMaxRedirects

public abstract int getMaxRedirects()

Gets the max redirects

Returns:

Max redirects that a request can take

getMaxRetries

public abstract int getMaxRetries()

Gets max retries

Returns:

Max retries for a request

getOptions

public abstract List

Gets the options

Returns:

the options

getRequestUrl

public abstract URL getRequestUrl()

Gets the request URL

Returns:

the request URL

getShouldRedirect

public abstract IShouldRedirect getShouldRedirect()

Gets the should redirect callback

Returns:

Callback which is called before redirect

getShouldRetry

public abstract IShouldRetry getShouldRetry()

Gets the should retry callback

Returns:

Callback called before retry

getUseCaches

public abstract boolean getUseCaches()

Gets useCaches parameter

Returns:

the value of useCaches

setDelay

public abstract void setDelay(long delay)

Sets the delay in seconds between retires

Parameters:

delay - Delay in seconds between retries

setMaxRedirects

public abstract void setMaxRedirects(int maxRedirects)

Sets the max redirects

Parameters:

maxRedirects - Max redirects that a request can take

setMaxRetries

public abstract void setMaxRetries(int maxRetries)

Sets the max retries

Parameters:

maxRetries - Max retries for a request

setShouldRedirect

public abstract void setShouldRedirect(IShouldRedirect shouldRedirect)

Sets the should redirect callback

Parameters:

shouldRedirect - Callback called before doing a redirect

setShouldRetry

public abstract void setShouldRetry(IShouldRetry shouldretry)

Sets the should retry callback

Parameters:

shouldretry - The callback called before retry

setUseCaches

public abstract void setUseCaches(boolean useCaches)

Sets useCaches parameter to cache the response

Parameters:

useCaches - the value of useCaches

withHttpMethod

public abstract IHttpRequest withHttpMethod(HttpMethod httpMethod)

Sets the HTTP method and returns the current request

Parameters:

httpMethod - the HTTP method

Returns:

the current request

Applies to