Package com.microsoft.graph.http
Class BaseStreamRequest<T>
java.lang.Object
com.microsoft.graph.http.BaseStreamRequest<T>
- Type Parameters:
T- the class of the response type
- All Implemented Interfaces:
IHttpRequest,IHttpStreamRequest
A request for a binary stream
-
Constructor Summary
ConstructorsConstructorDescriptionBaseStreamRequest(String requestUrl, IBaseClient<?> client, List<? extends Option> options, Class<T> responseClass) Creates the stream request. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a header to this requestlonggetDelay()Gets delay between retriesGets the headersGets the HTTP method<requestBodyType,responseType, nativeRequestType>
nativeRequestTypegetHttpRequest(requestBodyType serializedObject) Returns the Request object to be executedintGets the max redirectsintGets max retriesGets the query options for this requestGets the request URLGets the should redirect callbackGets the should retry callbackbooleanGets useCaches parameterprotected InputStreamsend()Sends this requestprotected Tsend(byte[] fileContents) Sends this requestprotected CompletableFuture<InputStream>Sends this requestprotected CompletableFuture<T>sendAsync(byte[] fileContents) Sends this requestvoidsetDelay(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 requestMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.microsoft.graph.http.IHttpRequest
getHttpRequest
-
Constructor Details
-
BaseStreamRequest
public BaseStreamRequest(@Nonnull String requestUrl, @Nonnull IBaseClient<?> client, @Nullable List<? extends Option> options, @Nonnull Class<T> responseClass) Creates the stream request.- Parameters:
requestUrl- the URL to make the request againstclient- the client which can issue the requestoptions- the options for this requestresponseClass- the class for the response
-
-
Method Details
-
sendAsync
Sends this request- Returns:
- a future with the result
-
send
Sends this request- Returns:
- the stream that the caller needs to close
- Throws:
ClientException- an exception occurs if there was an error while the request was sent
-
sendAsync
Sends this request- Parameters:
fileContents- the file to upload- Returns:
- a future with the result
-
send
Sends this request- Parameters:
fileContents- the file to upload- Returns:
- the stream that the caller needs to close
-
getRequestUrl
Gets the request URL- Specified by:
getRequestUrlin interfaceIHttpRequest- Returns:
- the request URL
-
getHttpMethod
Gets the HTTP method- Specified by:
getHttpMethodin interfaceIHttpRequest- Returns:
- the HTTP method
-
addHeader
Adds a header to this request- Specified by:
addHeaderin interfaceIHttpRequest- Parameters:
header- the name of the headervalue- the value of the header
-
setUseCaches
public void setUseCaches(boolean useCaches) Sets useCaches parameter to cache the response- Specified by:
setUseCachesin interfaceIHttpRequest- Parameters:
useCaches- the value of useCaches
-
getUseCaches
public boolean getUseCaches()Gets useCaches parameter- Specified by:
getUseCachesin interfaceIHttpRequest- Returns:
- the value of useCaches
-
getHeaders
Gets the headers- Specified by:
getHeadersin interfaceIHttpRequest- Returns:
- the headers
-
getOptions
Gets the query options for this request- Specified by:
getOptionsin interfaceIHttpRequest- Returns:
- the query options for this request
-
setMaxRedirects
public void setMaxRedirects(int maxRedirects) Sets the max redirects- Specified by:
setMaxRedirectsin interfaceIHttpRequest- Parameters:
maxRedirects- Max redirects that a request can take
-
getMaxRedirects
public int getMaxRedirects()Gets the max redirects- Specified by:
getMaxRedirectsin interfaceIHttpRequest- Returns:
- Max redirects that a request can take
-
setShouldRedirect
Sets the should redirect callback- Specified by:
setShouldRedirectin interfaceIHttpRequest- Parameters:
shouldRedirect- Callback called before doing a redirect
-
getShouldRedirect
Gets the should redirect callback- Specified by:
getShouldRedirectin interfaceIHttpRequest- Returns:
- Callback which is called before redirect
-
setShouldRetry
Sets the should retry callback- Specified by:
setShouldRetryin interfaceIHttpRequest- Parameters:
shouldretry- The callback called before retry
-
getShouldRetry
Gets the should retry callback- Specified by:
getShouldRetryin interfaceIHttpRequest- Returns:
- Callback called before retry
-
setMaxRetries
public void setMaxRetries(int maxRetries) Sets the max retries- Specified by:
setMaxRetriesin interfaceIHttpRequest- Parameters:
maxRetries- Max retries for a request
-
getMaxRetries
public int getMaxRetries()Gets max retries- Specified by:
getMaxRetriesin interfaceIHttpRequest- Returns:
- Max retries for a request
-
setDelay
public void setDelay(long delay) Sets the delay in seconds between retires- Specified by:
setDelayin interfaceIHttpRequest- Parameters:
delay- Delay in seconds between retries
-
getDelay
public long getDelay()Gets delay between retries- Specified by:
getDelayin interfaceIHttpRequest- Returns:
- Delay between retries in seconds
-
withHttpMethod
Sets the HTTP method and returns the current request- Specified by:
withHttpMethodin interfaceIHttpRequest- Parameters:
httpMethod- the HTTP method- Returns:
- the current request
-
getHttpRequest
@Nullable public <requestBodyType,responseType, nativeRequestType getHttpRequestnativeRequestType> (@Nullable requestBodyType serializedObject) throws ClientException Returns the Request object to be executed- Specified by:
getHttpRequestin interfaceIHttpRequest- 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
-