public class URLUtils extends Object
Modifier and Type | Method and Description |
---|---|
static String |
decode(String url)
Decodes the specified (portion of a) URL.
|
static String |
pathJoin(String... strings)
Joins all the given strings, ignoring nulls so that they form a URL with / between the paths without a // if the previous path ends with / and the next path starts with / unless a path item is blank
|
static URLConnection |
prepareForAuthentication(URLConnection connection)
Prepares an url connection for authentication if necessary.
|
static URLConnection |
prepareForSSL(URLConnection connection)
Prepares an url connection for authentication if necessary.
|
static InputStream |
prepareInputStream(URL url,
boolean acceptAnyCertificate)
Prepare url for authentication and ssl if necessary and returns the input stream from the url.
|
static String |
urlPathJoin(String first,
String second)
Joins two parts of a URL together to ensure there is a / in between the strings but ensuring there is not a "//".
|
public static URLConnection prepareForAuthentication(URLConnection connection)
connection
- the connection to be preparedpublic static String decode(String url)
url
- The URL to decode, may be null
.null
if the input was null
.public static URLConnection prepareForSSL(URLConnection connection)
connection
- the connection to be preparedpublic static InputStream prepareInputStream(URL url, boolean acceptAnyCertificate) throws IOException
url
- url to prepareacceptAnyCertificate
- true if the certicate check should be skippedIOException
- re-thrownpublic static String urlPathJoin(String first, String second)
Copyright © 2011–2016 Red Hat. All rights reserved.