@ThreadSafe public final class LinkHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_STREAM_SERVLET_NAME
The default name of the stream servlet.
|
static String |
STREAM_SERVLET_NAME_REGEX |
| Modifier and Type | Method and Description |
|---|---|
static com.helger.commons.url.SimpleURL |
getHomeLinkWithoutSession() |
static String |
getStreamServletName() |
static String |
getStreamServletPath() |
static com.helger.commons.url.SimpleURL |
getStreamURL(com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope,
String sURL)
Get the default URL to stream the passed URL.
|
static String |
getURIWithContext(com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope,
String sHRef)
Prefix the passed href with the relative context path in case the passed
href has no protocol yet.
|
static String |
getURIWithContext(String sHRef)
Prefix the passed href with the relative context path in case the passed
href has no protocol yet.
|
static String |
getURIWithServerAndContext(com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope,
String sHRef)
Prefix the passed href with the absolute server + context path in case the
passed href has no protocol yet.
|
static String |
getURIWithServerAndContext(String sHRef)
Prefix the passed href with the absolute server + context path in case the
passed href has no protocol yet.
|
static com.helger.commons.url.SimpleURL |
getURLWithContext(com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope,
String sHRef)
Prefix the passed href with the relative context path in case the passed
href has no protocol yet.
|
static com.helger.commons.url.SimpleURL |
getURLWithContext(String sHRef)
Prefix the passed href with the relative context path in case the passed
href has no protocol yet.
|
static com.helger.commons.url.SimpleURL |
getURLWithServerAndContext(com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope,
String sHRef)
Prefix the passed href with the absolute server + context path in case the
passed href has no protocol yet.
|
static com.helger.commons.url.SimpleURL |
getURLWithServerAndContext(String sHRef)
Prefix the passed href with the absolute server + context path in case the
passed href has no protocol yet.
|
static boolean |
hasKnownProtocol(String sURI)
Special "has known protocol" version that also supports the pseudo protocol
"//" that maps to either "http" or "https" depending on the surrounding
setup.
|
static void |
setStreamServletName(String sStreamServletName) |
public static final String STREAM_SERVLET_NAME_REGEX
public static final String DEFAULT_STREAM_SERVLET_NAME
public static void setStreamServletName(@Nonnull @Nonempty String sStreamServletName)
@Nonnull @Nonempty public static String getStreamServletName()
streamgetStreamServletPath()@Nonnull @Nonempty public static String getStreamServletPath()
/streamgetStreamServletName()public static boolean hasKnownProtocol(@Nullable String sURI)
sURI - Source URI. MAy be null.true if the URI has a known protocol or "//".@Nonnull public static String getURIWithContext(@Nonnull String sHRef)
sHRef - The href to be extended. May not be null./webapp-context/href otherwise. Never
null.@Nonnull public static String getURIWithContext(@Nonnull com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope, @Nonnull String sHRef)
aRequestScope - The request web scope to be used. Required for cookie-less handling.
May not be null.sHRef - The href to be extended. May not be null./webapp-context/href otherwise. Never
null.@Nonnull public static com.helger.commons.url.SimpleURL getURLWithContext(@Nonnull String sHRef)
sHRef - The href to be extended. May not be null./webapp-context/href otherwise. Never
null.@Nonnull public static com.helger.commons.url.SimpleURL getURLWithContext(@Nonnull com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope, @Nonnull String sHRef)
aRequestScope - The request web scope to be used. Required for cookie-less handling.
May not be null.sHRef - The href to be extended. May not be null./webapp-context/href otherwise. Never
null.@Nonnull public static String getURIWithServerAndContext(@Nonnull String sHRef)
sHRef - The href to be extended. May not be null.http://servername:8123/webapp-context/href
otherwise. Never null.@Nonnull public static String getURIWithServerAndContext(@Nonnull com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope, @Nonnull String sHRef)
aRequestScope - The request web scope to be used. Required for cookie-less handling.
May not be null.sHRef - The href to be extended. May not be null.http://servername:8123/webapp-context/href
otherwise. Never null.@Nonnull public static com.helger.commons.url.SimpleURL getURLWithServerAndContext(@Nonnull String sHRef)
sHRef - The href to be extended.http://servername:8123/webapp-context/href
otherwise.@Nonnull public static com.helger.commons.url.SimpleURL getURLWithServerAndContext(@Nonnull com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope, @Nonnull String sHRef)
aRequestScope - The request web scope to be used. Required for cookie-less handling.
May not be null.sHRef - The href to be extended.http://servername:8123/webapp-context/href
otherwise.@Nonnull public static com.helger.commons.url.SimpleURL getHomeLinkWithoutSession()
null. E.g. / or /context.
This is useful for logout links.@Nonnull public static com.helger.commons.url.SimpleURL getStreamURL(@Nonnull com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope, @Nonnull @Nonempty String sURL)
aRequestScope - The request web scope to be used. Required for cookie-less handling.
May not be null.sURL - The URL to be streamed. If it does not start with a slash ("/") one
is prepended automatically. If the URL already has a protocol, it is
returned unchanged. May neither be null nor empty./webapp-context/stream/URL.Copyright © 2014–2023 Philip Helger. All rights reserved.