public class Endpoint extends Object
Endpoint
class are called indirectly through higher level APIs.Constructor and Description |
---|
Endpoint(String urlBase) |
Endpoint(String urlBase,
String proxyAddr,
int proxyPort)
Makes an
HTTP proxied endpoint. |
Endpoint(String urlBase,
String proxyAddr,
int proxyPort,
Proxy.Type proxyType)
Makes a proxied endpoint at the specified
urlBase . |
Endpoint(String urlBase,
String proxyAddr,
Proxy.Type proxyType)
Makes an proxied endpoint on port
8080 . |
Modifier and Type | Method and Description |
---|---|
URLConnection |
openConnection()
Opens a connection on this endpoint's URL and Proxy.
|
Object |
sendCsvRequest(String httpMethod,
Object jsonValue,
Map<String,String> headers,
int timeout)
Use HTTP GET, POST, PUT, or PATCH to send JSON bindings to the endpoint with a CSV response.
|
Object |
sendJsonRequest(String httpMethod,
Object jsonValue,
Map<String,String> headers,
int timeout)
Use HTTP GET, POST, PUT, or PATCH to send JSON bindings to the endpoint with a JSON response.
|
Object |
sendPlainTextRequest(String httpMethod,
Object jsonValue,
Map<String,String> headers,
int timeout)
Use HTTP GET, POST, PUT, or PATCH to send JSON bindings to a URL with a plain text response.
|
Object |
sendXmlRequest(String httpMethod,
Object jsonValue,
Map<String,String> headers,
int timeout)
Use HTTP GET, POST, PUT, or PATCH to send JSON bindings to a URL with an XML response.
|
Object |
sendYamlRequest(String httpMethod,
Object jsonValue,
Map<String,String> headers,
int timeout)
Use HTTP GET, POST, PUT, or PATCH to send JSON bindings to a URL with a YAML response.
|
Endpoint |
withUrlSuffix(String urlSuffix)
Creates a new
Endpoint with a base URL consisting of this endpoint's base URL + urlSuffix . |
public Endpoint(String urlBase)
urlBase
- The base URL for the endpoint. Can have name=value arguments.public Endpoint(String urlBase, String proxyAddr, int proxyPort)
HTTP
proxied endpoint.urlBase
- The base URL for the endpoint. Can have name=value arguments.proxyAddr
- The address of the proxy server, such as "http://my.proxyserver.com".proxyPort
- The port number of the proxy server, typically 8080.public Endpoint(String urlBase, String proxyAddr, Proxy.Type proxyType)
8080
.urlBase
- The base URL for the endpoint. Can have name=value arguments.proxyAddr
- The address of the proxy server, such as "http://my.proxyserver.com".proxyType
- The proxy type: HTTP or SOCKS
. Use Endpoint(String)
if there is no
proxy server.public Endpoint(String urlBase, String proxyAddr, int proxyPort, Proxy.Type proxyType)
urlBase
.urlBase
- The base URL for the endpoint. Can have name=value arguments.proxyAddr
- The address of the proxy server, such as "http://my.proxyserver.com".proxyPort
- The port number of the proxy server, typically 8080.proxyType
- The proxy type: HTTP or SOCKS
. Use Endpoint(String)
if there is no
proxy server.public Endpoint withUrlSuffix(String urlSuffix)
Endpoint
with a base URL consisting of this endpoint's base URL + urlSuffix
.urlSuffix
- Use the suffix to make a new url consisting of this endpoint's base URL + urlSuffix
.Endpoint
with a base URL consisting of this endpoint's base URL + urlSuffix
.public URLConnection openConnection() throws IOException
IOException
URL.openConnection(Proxy)
public Object sendCsvRequest(String httpMethod, Object jsonValue, Map<String,String> headers, int timeout)
httpMethod
- The HTTP method to use: "GET", "POST", "PUT", or "PATCH"jsonValue
- A JSON value to send (primitive/boxed type, String, List of JSON values, or Bindings of String/JSON value)public Object sendJsonRequest(String httpMethod, Object jsonValue, Map<String,String> headers, int timeout)
httpMethod
- The HTTP method to use: "GET", "POST", "PUT", or "PATCH"jsonValue
- A JSON value to send (primitive/boxed type, String, List of JSON values, or Bindings of String/JSON value)public Object sendPlainTextRequest(String httpMethod, Object jsonValue, Map<String,String> headers, int timeout)
httpMethod
- The HTTP method to use: "GET", "POST", "PUT", or "PATCH"jsonValue
- A JSON value to send (primitive/boxed type, String, List of JSON values, or Bindings of String/JSON value)public Object sendXmlRequest(String httpMethod, Object jsonValue, Map<String,String> headers, int timeout)
httpMethod
- The HTTP method to use: "GET", "POST", "PUT", or "PATCH"jsonValue
- A JSON value to send (primitive/boxed type, String, List of JSON values, or Bindings of String/JSON value)public Object sendYamlRequest(String httpMethod, Object jsonValue, Map<String,String> headers, int timeout)
httpMethod
- The HTTP method to use: "GET", "POST", "PUT", or "PATCH"jsonValue
- A JSON value to send (primitive/boxed type, String, List of JSON values, or Bindings of String/JSON value)Copyright © 2024. All rights reserved.