public class ManUrlExt extends Object
Constructor and Description |
---|
ManUrlExt() |
Modifier and Type | Method and Description |
---|---|
static String |
encode(String urlPart)
Convenience method to encode a URL string and not have to handle the
UnsupportedEncodingException.
|
static byte[] |
getBinaryContent(URL thiz) |
static Object |
getCsvContent(URL thiz) |
static Object |
getJsonContent(URL thiz) |
static String |
getTextContent(URL thiz) |
static Object |
getXmlContent(URL thiz) |
static Object |
getYamlContent(URL thiz) |
static URL |
makeUrl(String url,
Object jsonValue)
Make a JSON-compatible URL with the arguments from the
jsonValue . |
static Object |
sendCsvRequest(URL url,
Proxy proxy,
String httpMethod,
Object jsonValue,
Map<String,String> headers,
int timeout) |
static Object |
sendCsvRequest(URL url,
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 CSV response.
|
static Object |
sendJsonRequest(URL url,
Proxy proxy,
String httpMethod,
Object jsonValue,
Map<String,String> headers,
int timeout) |
static Object |
sendJsonRequest(URL url,
String httpMethod,
Object jsonValue)
Use HTTP GET, POST, PUT, or PATCH to send JSON bindings to a URL with a JSON response.
|
static Object |
sendJsonRequest(URL url,
String httpMethod,
Object jsonValue,
Map<String,String> headers,
int timeout) |
static String |
sendPlainTextRequest(URL url,
Proxy proxy,
String httpMethod,
Object jsonValue,
Map<String,String> headers,
int timeout) |
static String |
sendPlainTextRequest(URL url,
String httpMethod,
Object jsonValue)
Use HTTP GET, POST, PUT, or PATCH to send JSON bindings to a URL with a plain text response.
|
static String |
sendPlainTextRequest(URL url,
String httpMethod,
Object jsonValue,
Map<String,String> headers,
int timeout) |
static Object |
sendXmlRequest(URL url,
Proxy proxy,
String httpMethod,
Object jsonValue,
Map<String,String> headers,
int timeout) |
static Object |
sendXmlRequest(URL url,
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 XML response.
|
static Object |
sendYamlRequest(URL url,
Proxy proxy,
String httpMethod,
Object jsonValue,
Map<String,String> headers,
int timeout) |
static Object |
sendYamlRequest(URL url,
String httpMethod,
Object jsonValue)
Use HTTP GET, POST, PUT, or PATCH to send JSON bindings to a URL with a YAML response.
|
static Object |
sendYamlRequest(URL url,
String httpMethod,
Object jsonValue,
Map<String,String> headers,
int timeout) |
public static URL makeUrl(String url, Object jsonValue)
jsonValue
. Encodes
the arguments in UTF-8 and appends them to the list using standard URL query delimiters.
If an individual argument is a Bindings
or a List
, it is transformed to JSON.
Otherwise, the argument is coerced to a String and URL encoded.public static String encode(String urlPart)
public static Object sendJsonRequest(URL url, String httpMethod, Object jsonValue)
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)sendRequest(URL, String, Object, Map, int)
public static Object sendJsonRequest(URL url, String httpMethod, Object jsonValue, Map<String,String> headers, int timeout)
public static Object sendJsonRequest(URL url, Proxy proxy, String httpMethod, Object jsonValue, Map<String,String> headers, int timeout)
public static Object sendYamlRequest(URL url, String httpMethod, Object jsonValue)
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)sendRequest(URL, String, Object, Map, int)
public static Object sendYamlRequest(URL url, String httpMethod, Object jsonValue, Map<String,String> headers, int timeout)
public static Object sendYamlRequest(URL url, Proxy proxy, String httpMethod, Object jsonValue, Map<String,String> headers, int timeout)
public static Object sendXmlRequest(URL url, 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)sendRequest(URL, String, Object, Map, int)
public static Object sendXmlRequest(URL url, Proxy proxy, String httpMethod, Object jsonValue, Map<String,String> headers, int timeout)
public static Object sendCsvRequest(URL url, 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)sendRequest(URL, String, Object, Map, int)
public static Object sendCsvRequest(URL url, Proxy proxy, String httpMethod, Object jsonValue, Map<String,String> headers, int timeout)
public static String sendPlainTextRequest(URL url, String httpMethod, Object jsonValue)
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)sendRequest(URL, String, Object, Map, int)
public static String sendPlainTextRequest(URL url, String httpMethod, Object jsonValue, Map<String,String> headers, int timeout)
public static String sendPlainTextRequest(URL url, Proxy proxy, String httpMethod, Object jsonValue, Map<String,String> headers, int timeout)
public static String getTextContent(URL thiz)
public static byte[] getBinaryContent(URL thiz)
public static Object getJsonContent(URL thiz)
RuntimeException
results if the
content is not a JSON document.public static Object getYamlContent(URL thiz)
RuntimeException
results if the
content is not a YAML document.public static Object getXmlContent(URL thiz)
RuntimeException
results if the
content is not a XML document.public static Object getCsvContent(URL thiz)
RuntimeException
results if the
content is not a CSV document.Copyright © 2024. All rights reserved.