public class ConnectionUtils extends Object
| Constructor | Description |
|---|---|
ConnectionUtils() |
| Modifier and Type | Method | Description |
|---|---|---|
protected static String |
createQueryString(String[] data,
boolean post) |
Return a query string from arguments for pre or post
|
static String |
pageContents(URL url) |
Return the contents of a URL
|
static String |
pageContents(URL url,
String[] data,
boolean post) |
Return the contents of a URL with pre or post data
|
static String |
pageContents(URL url,
String data,
boolean post) |
Return the contents of a URL with pre or post data
|
static Reader |
pageReader(URL url) |
Return a Reader for a URL
|
static Reader |
pageReader(URL url,
String[] data,
boolean post) |
Return a reader for a URL with pre or post data
|
static Reader |
pageReader(URL url,
String data,
boolean post) |
Return a Reader for a URL with pre or post data
|
protected static URLConnection |
URLopenConnection(URL url) |
Open connection with workarounds.
|
public static Reader pageReader(URL url) throws IOException
IOExceptionpublic static String pageContents(URL url) throws IOException
IOExceptionpublic static Reader pageReader(URL url, String[] data, boolean post) throws IOException
url - URL to submit todata - Array of "key","value","key2","value2",...post - true to post data, false for getIOExceptionpublic static String pageContents(URL url, String[] data, boolean post) throws IOException
url - URL to submit todata - Array of "key","value","key2","value2",...post - true to post data, false for getIOExceptionpublic static String pageContents(URL url, String data, boolean post) throws IOException
url - URL to submit todata - String of "key=value&otherkey=othervalue" post datapost - true to post data, false for getIOExceptionpublic static Reader pageReader(URL url, String data, boolean post) throws IOException
url - URL to submit todata - String of "{code key=value&otherkey=othervalue}" post datapost - true to post data, false for getIOExceptionprotected static URLConnection URLopenConnection(URL url) throws IOException
Currently specifically sets user-agent because with Java Web Start the system property http.agent does not properly set the user-agent for connections.
IOExceptionprotected static String createQueryString(String[] data, boolean post) throws UnsupportedEncodingException
data - Array of "key=value" StringsUnsupportedEncodingExceptionCopyright © 2010-2018 Nikhef / Stichting FOM. All Rights Reserved.