Package org.appng.api
Class RequestUtil
- java.lang.Object
-
- org.appng.api.RequestUtil
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PathInfo
getPathInfo(Environment env, Site site, String servletPath)
Creates and returns aPathInfo
-object based upon the given parameters.static Site
getSite(Environment env, javax.servlet.ServletRequest servletRequest)
Retrieves aSite
by its name.static Site
getSiteByName(Environment env, String name)
Retrieves aSite
by its name.static String
getSiteName(Environment env, javax.servlet.ServletRequest request)
Retrieves aSite
's name for the givenServletRequest
, using the givenEnvironment
to retrieve theVHostMode
.static Set<String>
getSiteNames(Environment env)
static Site
waitForSite(Environment env, String name)
Retrieves aSite
by its name, waiting up toPlatform.Property#MAX_WAIT_TIME
milliseconds until it's state isSiteState#STARTED
.
-
-
-
Method Detail
-
getSite
public static Site getSite(Environment env, javax.servlet.ServletRequest servletRequest)
Retrieves aSite
by its name.- Parameters:
env
- the currentEnvironment
servletRequest
- the currentServletRequest
- Returns:
- the
Site
, if any - See Also:
getSiteName(Environment, ServletRequest)
-
getSiteByName
public static Site getSiteByName(Environment env, String name)
Retrieves aSite
by its name.- Parameters:
env
- the currentEnvironment
name
- the name of theSite
- Returns:
- the
Site
, if any - See Also:
Nameable.getName()
-
waitForSite
public static Site waitForSite(Environment env, String name)
Retrieves aSite
by its name, waiting up toPlatform.Property#MAX_WAIT_TIME
milliseconds until it's state isSiteState#STARTED
.- Parameters:
env
- the currentEnvironment
name
- the name of theSite
- Returns:
- the
Site
, if any - See Also:
getSiteByName(Environment, String)
,Site.hasState(SiteState...)
-
getSiteNames
public static Set<String> getSiteNames(Environment env)
- Parameters:
env
- the currentEnvironment
- Returns:
- the
Site
names
-
getPathInfo
public static PathInfo getPathInfo(Environment env, Site site, String servletPath)
Creates and returns aPathInfo
-object based upon the given parameters.- Parameters:
env
- the currentEnvironment
site
- the currentSite
servletPath
- the current servlet-path- Returns:
- a
PathInfo
-object
-
getSiteName
public static String getSiteName(Environment env, javax.servlet.ServletRequest request)
Retrieves aSite
's name for the givenServletRequest
, using the givenEnvironment
to retrieve theVHostMode
.- Parameters:
env
- anEnvironment
request
- theServletRequest
- Returns:
- the IP-address, if
VHostMode.IP_BASED
is used (seeServletRequest.getLocalAddr()
) - the value of the request-attribute "SERVER_LOCAL_NAME", if present.
This header has to be added by the webserver of choice (usually Apache httpd), in case a
Site
needs to be accessible from a domain that is different from the one configured bySite.getDomain()
. - the value of the request-header "X-appNG-site", if present.
- the server name, otherwise (see
ServletRequest.getServerName()
)
- the IP-address, if
-
-