Interface B2WebApiClient
-
- All Superinterfaces:
java.lang.AutoCloseable
public interface B2WebApiClient extends java.lang.AutoCloseable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Closes this object and its underlying resources.voidgetContent(java.lang.String url, B2Headers headersOrNull, B2ContentSink handler)GETs from a web service that returns content.B2Headershead(java.lang.String url, B2Headers headersOrNull)HEADSs to a web service that returns content, and returns the headers.<ResponseType>
ResponseTypepostDataReturnJson(java.lang.String url, B2Headers headersOrNull, java.io.InputStream contentSource, long contentLength, java.lang.Class<ResponseType> responseClass)POSTs to a web service that takes content and returns JSON.<ResponseType>
ResponseTypepostJsonReturnJson(java.lang.String url, B2Headers headersOrNull, java.lang.Object request, java.lang.Class<ResponseType> responseClass)POSTs to a web service that takes JSON and returns JSON.
-
-
-
Method Detail
-
postJsonReturnJson
<ResponseType> ResponseType postJsonReturnJson(java.lang.String url, B2Headers headersOrNull, java.lang.Object request, java.lang.Class<ResponseType> responseClass) throws B2ExceptionPOSTs to a web service that takes JSON and returns JSON.- Type Parameters:
ResponseType- the class- Parameters:
url- the url to post toheadersOrNull- if non-null, some headers to include in the postrequest- the object to be converted to json (with B2Json) and posted as the body of the requestresponseClass- the class to convert the response body into (with B2Json)- Returns:
- the response object (converted from json by B2Json)
- Throws:
B2Exception- if there's any trouble
-
postDataReturnJson
<ResponseType> ResponseType postDataReturnJson(java.lang.String url, B2Headers headersOrNull, java.io.InputStream contentSource, long contentLength, java.lang.Class<ResponseType> responseClass) throws B2ExceptionPOSTs to a web service that takes content and returns JSON.- Type Parameters:
ResponseType- the class- Parameters:
url- the url to post toheadersOrNull- if non-null, some headers to include in the postcontentSource- the content to post as the body of the requestcontentLength- the number of bytes in the content to postresponseClass- the class to convert the response body into (with B2Json)- Returns:
- the response object (converted from json by B2Json)
- Throws:
B2Exception- if there's any trouble
-
getContent
void getContent(java.lang.String url, B2Headers headersOrNull, B2ContentSink handler) throws B2ExceptionGETs from a web service that returns content.- Parameters:
url- the url to post toheadersOrNull- if non-null, some headers to include in the posthandler- the object which will be called with the response's headers and content- Throws:
B2Exception- if there's any trouble
-
head
B2Headers head(java.lang.String url, B2Headers headersOrNull) throws B2Exception
HEADSs to a web service that returns content, and returns the headers.- Parameters:
url- the url to head toheadersOrNull- the headers, if any.- Returns:
- the headers of the response.
- Throws:
B2Exception- if there's any trouble
-
close
void close()
Closes this object and its underlying resources. This is overridden from AutoCloseable to declare that it can't throw any exception.- Specified by:
closein interfacejava.lang.AutoCloseable
-
-