Reusable Java library of general tools with minimal external dependencies.
For questions or support, please contact us:
Email: support@aoindustries.com
Phone: 1-800-519-9541
Phone: +1-251-607-9556
Web: https://aoindustries.com/contact
public class UrlUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
buildUrl(JspContext jspContext,
String src,
HttpParameters params,
boolean srcAbsolute,
LastModifiedServlet.AddLastModifiedWhen addLastModified) |
static String |
buildUrl(PageContext pageContext,
String href,
HttpParameters params,
boolean hrefAbsolute,
LastModifiedServlet.AddLastModifiedWhen addLastModified) |
static String |
buildUrl(ServletContext servletContext,
HttpServletRequest request,
HttpServletResponse response,
String href,
HttpParameters params,
boolean hrefAbsolute,
LastModifiedServlet.AddLastModifiedWhen addLastModified)
Performs all the proper URL conversions along with optionally adding a lastModified parameter.
|
static String |
decodeUrlPath(String href,
String encoding)
Decodes the URL up to the first ?, if present.
|
static String |
encodeUrlPath(String href,
String encoding)
Encodes the characters in the URL up to trailing '?' or '#' (the first found of the two),
not including any characters defined in RFC 3986: Reserved Characters.
|
static String |
getScheme(String href)
Gets the scheme for a URL, or
null when no scheme found. |
static boolean |
isScheme(String href,
String scheme)
Checks if a URL starts with the given scheme.
|
public static boolean isScheme(String href, String scheme)
scheme - The scheme to look for, not including colon.
For example "http".public static final String getScheme(String href)
null when no scheme found.
The scheme must start the URL, and contain only (A-Z, a-z) before the first colon (:)
found. The scheme is normalized to lower-case. An empty scheme will not be returned.null when not found.
For example "http".public static String encodeUrlPath(String href, String encoding) throws UnsupportedEncodingException
Additionally, for tel: (case-insensitive) urls, replaces spaces (and non-breaking spaces) with hyphens.
public static String decodeUrlPath(String href, String encoding) throws UnsupportedEncodingException
Characters that are percent-decoded into a reserve character are left percent-encoded to avoid ambiguity.
public static String buildUrl(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, String href, HttpParameters params, boolean hrefAbsolute, LastModifiedServlet.AddLastModifiedWhen addLastModified) throws MalformedURLException, UnsupportedEncodingException
public static String buildUrl(PageContext pageContext, String href, HttpParameters params, boolean hrefAbsolute, LastModifiedServlet.AddLastModifiedWhen addLastModified) throws MalformedURLException, UnsupportedEncodingException
MalformedURLExceptionUnsupportedEncodingExceptionbuildUrl(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, com.aoindustries.net.HttpParameters, boolean, com.aoindustries.servlet.http.LastModifiedServlet.AddLastModifiedWhen)public static String buildUrl(JspContext jspContext, String src, HttpParameters params, boolean srcAbsolute, LastModifiedServlet.AddLastModifiedWhen addLastModified) throws MalformedURLException, UnsupportedEncodingException
Copyright © 2000–2019 AO Industries, Inc.. All rights reserved.