CoreHttpProvider Class
- java.lang.Object
- com.microsoft.graph.http.CoreHttpProvider
Implements
public class CoreHttpProvider
implements IHttpProvider<okhttp3.Request>
HTTP provider based off of OkHttp and msgraph-sdk-java-core library
Constructor Summary
Method Summary
| Modifier and Type |
Method and Description |
|
Result
|
<Result,Body,DeserializeType>send(IHttpRequest request, Class<Result> resultClass, Body serializable, IStatefulResponseHandler<Result,DeserializeType> handler)
Sends the HTTP request
|
|
okhttp3.Request
|
<Result,Body>getHttpRequest(IHttpRequest request, Class<Result> resultClass, Body serializable)
Sends the HTTP request
|
|
Result
|
<Result,Body>send(IHttpRequest request, Class<Result> resultClass, Body serializable)
Sends the HTTP request
|
|
java.util.concurrent.CompletableFuture<Result>
|
<Result,Body>sendAsync(IHttpRequest request, Class<Result> resultClass, Body serializable)
Sends the HTTP request asynchronously
|
|
java.util.concurrent.CompletableFuture<Result>
|
<Result,BodyType,DeserializeType>sendAsync(IHttpRequest request, Class<Result> resultClass, BodyType serializable, IStatefulResponseHandler<Result,DeserializeType> handler)
Sends the HTTP request
|
|
ILogger
|
getLogger()
Gets the logger in use
|
|
ISerializer
|
getSerializer()
Gets the serializer for this HTTP provider
|
|
static
java.lang.String
|
streamToString(InputStream input)
Reads in a stream and converts it into a string
|
Methods inherited from java.lang.Object
java.lang.Object.clone
java.lang.Object.equals
java.lang.Object.finalize
java.lang.Object.getClass
java.lang.Object.hashCode
java.lang.Object.notify
java.lang.Object.notifyAll
java.lang.Object.toString
java.lang.Object.wait
java.lang.Object.wait
java.lang.Object.wait
Constructor Details
CoreHttpProvider
public CoreHttpProvider(ISerializer serializer, ILogger logger, OkHttpClient httpClient)
Creates the CoreHttpProvider
Parameters:
serializer
- the serializer
logger
- the logger for diagnostic information
httpClient
- the client to send http requests with
Method Details
<Result,Body,DeserializeType>send
public Result send(IHttpRequest request, Class resultClass, Body serializable, IStatefulResponseHandler handler)
Sends the HTTP request
Parameters:
request
- the request description
resultClass
- the class of the response from the service
serializable
- the object to send to the service in the body of the request
handler
- the handler for stateful response
Returns:
the result from the request
Throws:
ClientException
- this exception occurs if the request was unable to complete for any reason
<Result,Body>getHttpRequest
public Request getHttpRequest(IHttpRequest request, Class resultClass, Body serializable)
Sends the HTTP request
Parameters:
request
- the request description
resultClass
- the class of the response from the service
serializable
- the object to send to the service in the body of the request
Returns:
the result from the request
Throws:
ClientException
- an exception occurs if the request was unable to complete for any reason
<Result,Body>send
public Result send(IHttpRequest request, Class resultClass, Body serializable)
Sends the HTTP request
Parameters:
request
- the request description
resultClass
- the class of the response from the service
serializable
- the object to send to the service in the body of the request
Returns:
the result from the request
Throws:
ClientException
- an exception occurs if the request was unable to complete for any reason
<Result,Body>sendAsync
public CompletableFuture sendAsync(IHttpRequest request, Class resultClass, Body serializable)
Sends the HTTP request asynchronously
Parameters:
request
- the request description
resultClass
serializable
- the object to send to the service in the body of the request
Returns:
a future with the result
<Result,BodyType,DeserializeType>sendAsync
public CompletableFuture sendAsync(IHttpRequest request, Class resultClass, BodyType serializable, IStatefulResponseHandler handler)
Sends the HTTP request
Parameters:
request
- the request description
resultClass
- the class of the response from the service
serializable
- the object to send to the service in the body of the request
handler
- the handler for stateful response
Returns:
a future with the result
Throws:
ClientException
- this exception occurs if the request was unable to complete for any reason
getLogger
public ILogger getLogger()
Gets the logger in use
Returns:
the logger
getSerializer
public ISerializer getSerializer()
Gets the serializer for this HTTP provider
Returns:
the serializer for this provider
streamToString
public static String streamToString(InputStream input)
Reads in a stream and converts it into a string
Parameters:
input
- the response body stream
Returns:
the string result
Applies to