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
IOException
public static String pageContents(URL url) throws IOException
IOException
public 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 getIOException
public 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 getIOException
public 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 getIOException
public 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 getIOException
protected 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.
IOException
protected static String createQueryString(String[] data, boolean post) throws UnsupportedEncodingException
data
- Array of "key=value"
StringsUnsupportedEncodingException
Copyright © 2010-2018 Nikhef / Stichting FOM. All Rights Reserved.