public class URLUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
URLUtils.BaseResourceURLEncoder |
static class |
URLUtils.FacesResourceURLEncoder |
static interface |
URLUtils.ISharedResourceURLEncoder |
static interface |
URLUtils.IURLFactory |
static class |
URLUtils.ServletResponseURLEncoder |
Modifier and Type | Field and Description |
---|---|
static String |
ATTR_FRONT_END_URL |
protected static String[] |
hex |
static String |
INIT_PARAM_SHARED_CONTEXT_PATH |
static String |
MWS_ROOT_CONTEXT |
static String |
PATH_SHARED_CONTEXT |
static String |
QUERY_LOCALE |
protected static Pattern |
RE_FE_URL |
static Pattern |
RE_SAFE_URL_SCHEME |
static String |
SHARED_CONTEXT |
Constructor and Description |
---|
URLUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
addAppVersionToUrl(FacesContext context,
String url)
Adds app version param (v=) to specified url.
|
static String |
appendURLParameters(String url,
Map<String,?> parameters)
Append parameters specified by map to existing url.
|
static IURL |
createRenderURL(FacesContext context)
Creates a PortletURL based on the current request,
even if request isn't a portlet request.
|
static String |
createSharedResourceURL(FacesContext context,
String path)
Creates url to CAF shared resource.
|
static String |
createSharedResourceURL(FacesContext context,
String base,
String path)
Creates url to CAF resource in a war other than wm_cafshared.
|
static URLUtils.ISharedResourceURLEncoder |
createSharedResourceURLEncoder(Object encoderDelegate) |
static URLUtils.ISharedResourceURLEncoder |
createSharedResourceURLEncoder(String frontEndUrl,
String sharedContexPath,
Object encoderDelegate) |
static String |
createSharedResourceURLforFe(FacesContext context,
String path) |
static String |
decodeURIComponent(String s)
Decodes from URL-escaped format.
|
static String |
encodeImageURL(FacesContext context,
String url)
Encodes unencoded image url.
|
static String |
encodeURIComponent(String s)
Encode a string to the "x-www-form-urlencoded" form, enhanced
with the UTF-8-in-URL proposal.
|
static String |
getFrontEndURL(Object delegate)
Calculate front-end url for current request, up to but not including context path for current war.
|
static String |
getSharedContextPath(FacesContext context) |
static String |
getSharedResourceBase(FacesContext context,
String base) |
static boolean |
isImageSkinned(FacesContext context,
String imageName)
Returns true if the image is skinned, false if un-skinned.
|
static boolean |
isRenderRequest(FacesContext context) |
static boolean |
isSafeURLScheme(String url)
True if url uses safe scheme (like "http:", "ftp:", etc.),
false if null, empty string, or not sure.
|
static void |
registerURLFactory(URLUtils.IURLFactory urlFactory,
boolean highPriority) |
public static final String ATTR_FRONT_END_URL
public static final String INIT_PARAM_SHARED_CONTEXT_PATH
public static final String MWS_ROOT_CONTEXT
public static final String SHARED_CONTEXT
public static final String PATH_SHARED_CONTEXT
public static final String QUERY_LOCALE
protected static final Pattern RE_FE_URL
public static Pattern RE_SAFE_URL_SCHEME
protected static final String[] hex
public static void registerURLFactory(URLUtils.IURLFactory urlFactory, boolean highPriority)
public static IURL createRenderURL(FacesContext context)
public static boolean isRenderRequest(FacesContext context)
public static URLUtils.ISharedResourceURLEncoder createSharedResourceURLEncoder(String frontEndUrl, String sharedContexPath, Object encoderDelegate)
public static URLUtils.ISharedResourceURLEncoder createSharedResourceURLEncoder(Object encoderDelegate)
public static String createSharedResourceURL(FacesContext context, String path)
context
- Current context.path
- Resource path relative to wm_cafshared war (ie '/base.js').public static String createSharedResourceURL(FacesContext context, String base, String path)
context
- Current context.base
- War name (ie 'wm_myportlet').path
- Resource path relative to shared war (ie '/custom.js').public static String encodeImageURL(FacesContext context, String url)
context
- Current context.url
- Unencoded image url.public static String addAppVersionToUrl(FacesContext context, String url)
context
- Current context.url
- Url to add.public static boolean isImageSkinned(FacesContext context, String imageName)
context
- Current context.imageName
- Image name, like "SelectAll.gif" (not "images/SelectAll.gif" or "/skin/images/SelectAll.gif").public static String getFrontEndURL(Object delegate)
public static boolean isSafeURLScheme(String url)
public static String appendURLParameters(String url, Map<String,?> parameters)
url
- Url. May be null or empty. May include query part.parameters
- Map of parameters. May be null or empty.public static String encodeURIComponent(String s)
The ASCII characters 'a' through 'z', 'A' through 'Z', and '0' through '9' remain the same.
The unreserved characters - _ . ! ~ * ' ( ) remain the same.
The space character ' ' is not converted into a plus sign '+'.
All other ASCII characters are converted into the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the character code
All non-ASCII characters are encoded in two steps: first to a sequence of 2 or 3 bytes, using the UTF-8 algorithm; secondly each of these bytes is encoded as "%xx".
public static String decodeURIComponent(String s)
public static String getSharedResourceBase(FacesContext context, String base)
public static String createSharedResourceURLforFe(FacesContext context, String path)
public static String getSharedContextPath(FacesContext context)