Package com.microsoft.graph.http
Interface IHttpRequest
- All Known Subinterfaces:
IHttpStreamRequest
- All Known Implementing Classes:
BaseActionCollectionRequest,BaseCollectionRequest,BaseCollectionWithReferencesRequest,BaseDeltaCollectionRequest,BaseEntityCollectionRequest,BaseFunctionCollectionRequest,BaseReferenceRequest,BaseRequest,BaseStreamRequest,BaseVoidActionCollectionRequest,BaseWithReferenceRequest,BatchRequest,CustomRequest,PrimitiveRequest
public interface IHttpRequest
An HTTP request
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a header to this requestlonggetDelay()Gets delay between retriesGets the headersGets the HTTP methoddefault <nativeRequestType>
nativeRequestTypeReturns the Request object to be executed<requestBodyType, responseType, nativeRequestType>
nativeRequestTypegetHttpRequest(requestBodyType serializedObject)Returns the Request object to be executedintGets the max redirectsintGets max retriesGets the optionsGets the request URLGets the should redirect callbackGets the should retry callbackbooleanGets useCaches parametervoidsetDelay(long delay)Sets the delay in seconds between retiresvoidsetMaxRedirects(int maxRedirects)Sets the max redirectsvoidsetMaxRetries(int maxRetries)Sets the max retriesvoidsetShouldRedirect(IShouldRedirect shouldRedirect)Sets the should redirect callbackvoidsetShouldRetry(IShouldRetry shouldretry)Sets the should retry callbackvoidsetUseCaches(boolean useCaches)Sets useCaches parameter to cache the responsewithHttpMethod(HttpMethod httpMethod)Sets the HTTP method and returns the current request
-
Method Details
-
getRequestUrl
Gets the request URL- Returns:
- the request URL
-
getHttpMethod
Gets the HTTP method- Returns:
- the HTTP method
-
getHeaders
Gets the headers- Returns:
- the headers
-
getOptions
Gets the options- Returns:
- the options
-
addHeader
Adds a header to this request- Parameters:
header- the name of the headervalue- the value of the header
-
setUseCaches
void setUseCaches(boolean useCaches)Sets useCaches parameter to cache the response- Parameters:
useCaches- the value of useCaches
-
getUseCaches
boolean getUseCaches()Gets useCaches parameter- Returns:
- the value of useCaches
-
setMaxRedirects
void setMaxRedirects(int maxRedirects)Sets the max redirects- Parameters:
maxRedirects- Max redirects that a request can take
-
getMaxRedirects
int getMaxRedirects()Gets the max redirects- Returns:
- Max redirects that a request can take
-
setShouldRedirect
Sets the should redirect callback- Parameters:
shouldRedirect- Callback called before doing a redirect
-
getShouldRedirect
Gets the should redirect callback- Returns:
- Callback which is called before redirect
-
setShouldRetry
Sets the should retry callback- Parameters:
shouldretry- The callback called before retry
-
getShouldRetry
Gets the should retry callback- Returns:
- Callback called before retry
-
setMaxRetries
void setMaxRetries(int maxRetries)Sets the max retries- Parameters:
maxRetries- Max retries for a request
-
getMaxRetries
int getMaxRetries()Gets max retries- Returns:
- Max retries for a request
-
setDelay
void setDelay(long delay)Sets the delay in seconds between retires- Parameters:
delay- Delay in seconds between retries
-
getDelay
long getDelay()Gets delay between retries- Returns:
- Delay between retries in seconds
-
withHttpMethod
Sets the HTTP method and returns the current request- Parameters:
httpMethod- the HTTP method- Returns:
- the current request
-
getHttpRequest
Returns the Request object to be executed- Type Parameters:
nativeRequestType- type of a request for the native http client- Returns:
- the Request object to be executed
- Throws:
ClientException
-
getHttpRequest
@Nullable <requestBodyType, responseType, nativeRequestType> nativeRequestType getHttpRequest(@Nullable requestBodyType serializedObject) throws ClientExceptionReturns the Request object to be executed- Type Parameters:
requestBodyType- the type of the serialized objectresponseType- the type of the responsenativeRequestType- type of a request for the native http client- Parameters:
serializedObject- the object to serialize at the body of the request- Returns:
- the Request object to be executed
- Throws:
ClientException
-