public final class HTTP extends Object
HTTP
protocol.Modifier and Type | Method and Description |
---|---|
static String |
createQuery(Map<String,String[]> parameters,
String charset)
Create a query string based on the specified parameter map and the provided
charset encoding.
|
static InputStream |
doGet(String url,
Map<String,String[]> parameters)
Invoke a GET request on the specified URL with the provided parameter map which
will be encoded as UTF-8.
|
static InputStream |
doGet(String url,
Map<String,String[]> parameters,
String charset)
Invoke a GET request on the specified URL with the provided parameter map
and charset encoding.
|
static InputStream |
doPost(URL url,
Map<String,String[]> parameters)
Invoke a POST request on the specified URL with the provided parameter map which
will be encoded as UTF-8.
|
static InputStream |
doPost(URL url,
Map<String,String[]> parameters,
Properties properties)
Invoke a POST request on the specified URL with the provided parameter map which
will be encoded as UTF-8.
|
static InputStream |
doPost(URL url,
Map<String,String[]> parameters,
Properties properties,
List<String> cookies)
Invoke a POST request on the specified URL with the provided parameter map which
will be encoded as UTF-8.
|
public static InputStream doGet(String url, Map<String,String[]> parameters) throws IOException
InputStream
after processing.url
- The URL to be invoked.parameters
- The parameters to be processed as query parameters.MalformedURLException
- If the specified URL is invalid.IOException
- If an I/O error has occurred.NullPointerException
- If url
is null.public static InputStream doGet(String url, Map<String,String[]> parameters, String charset) throws IOException, UnsupportedEncodingException
InputStream
after processing.url
- The URL to be invoked.parameters
- The parameters to be processed as query parameters.charset
- The encoding to be applied.MalformedURLException
- If the specified URL is invalid.IOException
- If an I/O error has occurred.UnsupportedEncodingException
- If the provided charset is not supported.NullPointerException
- If url
is null.public static InputStream doPost(URL url, Map<String,String[]> parameters) throws IOException
InputStream
after processing.url
- The URL to be invoked.parameters
- The parameters to be processed as query parameters.MalformedURLException
- If the specified URL is invalid.IOException
- If an I/O error has occurred.NullPointerException
- If url
is null.public static InputStream doPost(URL url, Map<String,String[]> parameters, Properties properties) throws IOException
InputStream
after processing.url
- The URL to be invoked.parameters
- The parameters to be processed as query parameters.properties
- The request properties to be processed as header
properties.MalformedURLException
- If the specified URL is invalid.IOException
- If an I/O error has occurred.NullPointerException
- If url
is null.public static InputStream doPost(URL url, Map<String,String[]> parameters, Properties properties, List<String> cookies) throws IOException
InputStream
after processing.url
- The URL to be invoked.parameters
- The parameters to be processed as query parameters.properties
- The request properties to be processed as header
properties.cookies
- The cookies to be injected into the header.MalformedURLException
- If the specified URL is invalid.IOException
- If an I/O error has occurred.NullPointerException
- If url
is null.public static String createQuery(Map<String,String[]> parameters, String charset) throws UnsupportedEncodingException
parameters
- The parameter map to be processed as query parameters.charset
- The encoding to be applied.UnsupportedEncodingException
- If the provided charset is not supported.Copyright © 2019 LibJ. All rights reserved.