public class RequestUtil extends Object
Site
s. Also creates a Path
object based on a
ServletRequest
.
Mapping logic
VHostMode.IP_BASED
:
The value of ServletRequest.getLocalAddr()
is compared against the values returned by Site.getHost()
and Site.getHostAliases()
of each site. If a site matches, it is returned.
VHostMode.NAME_BASED
:
If the ServletRequest
contains the SERVER_LOCAL_NAME
attribute or the header X_APPNG_SITE
, it
is assumed that an upstream reverse-proxy has taken care of site-mapping already and the respective attribute
contains a site name (Nameable.getName()
). If a site with this name exists, it is returned.
Site.getHost()
and Site.getHostAliases()
are ignored.
If the mentioned attributes are not present, the value of ServletRequest.getServerName()
(corresponds to the
HOST
header) is compared against the values returned by Site.getHost()
and
Site.getHostAliases()
of each site. If a site matches, it is returned.
Modifier and Type | Method and Description |
---|---|
static String |
getHostIdentifier(javax.servlet.ServletRequest request,
Environment env)
Deprecated.
|
static PathInfo |
getPathInfo(Environment env,
Site site,
String servletPath)
Creates and returns a
PathInfo -object based upon the given parameters. |
static org.appng.api.RequestUtil.RequestIdentifier |
getRequestIdentifier(Environment env,
javax.servlet.ServletRequest request)
Retrieves a name according to the mapping logic described in the class documentation above together with the
matching scope to be applied.
|
static Site |
getSite(Environment env,
javax.servlet.ServletRequest servletRequest)
Retrieves a
Site using the mapping logic described in the class documentation above. |
static Site |
getSiteByHost(Environment env,
String host)
Retrieves a
Site by its hostnames (primary and aliases). |
static Site |
getSiteByName(Environment env,
String name)
Retrieves a
Site by its name. |
static String |
getSiteName(Environment env,
javax.servlet.ServletRequest request)
Deprecated.
|
static Set<String> |
getSiteNames(Environment env)
|
static Site |
waitForSite(Environment env,
String name)
Retrieves a
Site by its name, waiting up to Platform.Property#MAX_WAIT_TIME milliseconds until
it's state is SiteState#STARTED . |
public static Site getSite(Environment env, javax.servlet.ServletRequest servletRequest)
Site
using the mapping logic described in the class documentation above.env
- the current Environment
servletRequest
- the current ServletRequest
Site
or null, if no site matchedpublic static Site getSiteByHost(Environment env, String host)
Site
by its hostnames (primary and aliases).env
- the current Environment
host
- the name to be compared against the Site
's hostnamesSite
or null if no site matchesSite.getHost()
,
Site.getHostAliases()
public static Site getSiteByName(Environment env, String name)
Site
by its name.env
- the current Environment
name
- the name of the Site
Site
, if anyNameable.getName()
public static Site waitForSite(Environment env, String name)
Site
by its name, waiting up to Platform.Property#MAX_WAIT_TIME
milliseconds until
it's state is SiteState#STARTED
.env
- the current Environment
name
- the name of the Site
Site
, if anygetSiteByName(Environment, String)
,
Site.hasState(SiteState...)
public static Set<String> getSiteNames(Environment env)
env
- the current Environment
Site
namespublic static PathInfo getPathInfo(Environment env, Site site, String servletPath)
PathInfo
-object based upon the given parameters.env
- the current Environment
site
- the current Site
servletPath
- the current servlet-pathPathInfo
-object@Deprecated public static String getHostIdentifier(javax.servlet.ServletRequest request, Environment env)
getRequestIdentifier(Environment, ServletRequest)
@Deprecated public static String getSiteName(Environment env, javax.servlet.ServletRequest request)
getRequestIdentifier(Environment, ServletRequest)
public static org.appng.api.RequestUtil.RequestIdentifier getRequestIdentifier(Environment env, javax.servlet.ServletRequest request)
env
- an Environment
request
- the ServletRequest
RequestUtil.RequestIdentifier
objectCopyright © 2011–2023 aiticon GmbH. All rights reserved.