Class AbstractEnvironment
- java.lang.Object
-
- com.github.bordertech.wcomponents.AbstractEnvironment
-
- All Implemented Interfaces:
Environment
,Serializable
- Direct Known Subclasses:
HttpServletHelper.HttpServletEnvironment
public abstract class AbstractEnvironment extends Object implements Environment
A base implementation for WEnvironment.- Author:
- Martin Shevchenko
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface com.github.bordertech.wcomponents.Environment
CONTENT_CACHE_KEY, SESSION_TOKEN_VARIABLE, STEP_ACTION_VARIABLE, STEP_VARIABLE, TARGET_ID, THEME_RESOURCE_PATH_NAME, UNIQUE_RANDOM_PARAM
-
-
Constructor Summary
Constructors Constructor Description AbstractEnvironment()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
getActionStep()
Deprecated.portal specificString
getAppHostPath()
Gets the base URL under which web applications are hosted.String
getAppId()
Deprecated.no longer used.String
getBaseUrl()
Get the base url at which this web application is hosted.String
getFormEncType()
Map<String,String>
getHiddenParameters()
Return a Map containing the hidden parameters that are needed for the WServlet to work correctly.String
getHostFreeBaseUrl()
Get the "host-free" part of the base url for this web application.String
getPostPath()
Gets the relative URL path to which this WComponent application should post its requests.String
getSessionToken()
Gets the session token.int
getStep()
Gets the page step number.String
getThemePath()
Gets the base URL under which the web content for the Theme is hosted.UserAgentInfo
getUserAgentInfo()
String
getWServletPath()
Construct the path to the support servlet.void
setActionStep(int actionStep)
Deprecated.portal specificprotected void
setAppHostPath(String appHostPath)
Sets the app host path.void
setAppId(String appId)
Deprecated.no longer used.protected void
setBaseUrl(String baseUrl)
Sets the base url.void
setFormEncType(String formEncType)
Sets the form encoding type.protected void
setHostFreeBaseUrl(String hostFreeBaseUrl)
Sets the host free base url.void
setPostPath(String postPath)
Sets the post path.void
setSessionToken(String sessionToken)
Sets the current session token.void
setStep(int step)
Sets the current set.void
setUserAgentInfo(UserAgentInfo userAgentInfo)
Sets the user-agent info.
-
-
-
Method Detail
-
getWServletPath
public String getWServletPath()
Construct the path to the support servlet. Web components that need to construct a URL to target this servlet will use this method.- Specified by:
getWServletPath
in interfaceEnvironment
- Returns:
- the path to the AJAX servlet.
-
getThemePath
public String getThemePath()
Description copied from interface:Environment
Gets the base URL under which the web content for the Theme is hosted. Web content is static content such as css, js, html, and image files.- Specified by:
getThemePath
in interfaceEnvironment
- Returns:
- the theme path.
-
getPostPath
public String getPostPath()
Description copied from interface:Environment
Gets the relative URL path to which this WComponent application should post its requests.Examples of what this method may return:
- Servlet
- /app
- Specified by:
getPostPath
in interfaceEnvironment
- Returns:
- the post path.
-
setPostPath
public void setPostPath(String postPath)
Sets the post path.- Specified by:
setPostPath
in interfaceEnvironment
- Parameters:
postPath
- the post path.
-
getAppHostPath
public String getAppHostPath()
Description copied from interface:Environment
Gets the base URL under which web applications are hosted. This AppHostPath can be used to create url links to applications that have been given fixed relative names.- Specified by:
getAppHostPath
in interfaceEnvironment
- Returns:
- the app host path.
-
getBaseUrl
public String getBaseUrl()
Description copied from interface:Environment
Get the base url at which this web application is hosted.Implementations ensure that this method returns a URL WITHOUT a trailing slash, as in above example.
- Specified by:
getBaseUrl
in interfaceEnvironment
- Returns:
- the base url.
-
getHostFreeBaseUrl
public String getHostFreeBaseUrl()
Description copied from interface:Environment
Get the "host-free" part of the base url for this web application. Eg, if the base url is http://localhost:8080/visas, then the "host-free" part is "/visas".- Specified by:
getHostFreeBaseUrl
in interfaceEnvironment
- Returns:
- the host name free base url.
-
getAppId
@Deprecated public String getAppId()
Deprecated.no longer used. UseWApplication.getIdName()
instead.Description copied from interface:Environment
Get a unique "app" id. This is intended to help with portals where multiple applications are present in the one document. The app id will be a machine generated unique identifier, but must not contain the characterWComponent.ID_CONTEXT_SEPERATOR
.- Specified by:
getAppId
in interfaceEnvironment
- Returns:
- the application id.
-
setAppId
@Deprecated public void setAppId(String appId)
Deprecated.no longer used. UseAbstractWComponent.setIdName(String)
instead.Sets the application id. The applicationId must not containWComponent.ID_CONTEXT_SEPERATOR
.- Specified by:
setAppId
in interfaceEnvironment
- Parameters:
appId
- the appId to set.
-
getSessionToken
public String getSessionToken()
Description copied from interface:Environment
Gets the session token. This is intended to make sure the request is for the correct session.- Specified by:
getSessionToken
in interfaceEnvironment
- Returns:
- the current session token.
-
setSessionToken
public void setSessionToken(String sessionToken)
Sets the current session token.- Specified by:
setSessionToken
in interfaceEnvironment
- Parameters:
sessionToken
- the session token to set.
-
getStep
public int getStep()
Description copied from interface:Environment
Gets the page step number. This is intended to make sure the request being processed is on the correct step.- Specified by:
getStep
in interfaceEnvironment
- Returns:
- the current step.
-
setStep
public void setStep(int step)
Sets the current set.- Specified by:
setStep
in interfaceEnvironment
- Parameters:
step
- the step to set.
-
getActionStep
@Deprecated public int getActionStep()
Deprecated.portal specificGets the page action step number. This is intended to make sure the request being processed is on the correct action step.- Specified by:
getActionStep
in interfaceEnvironment
- Returns:
- the page action step number.
-
setActionStep
@Deprecated public void setActionStep(int actionStep)
Deprecated.portal specificSets the page action step number.- Specified by:
setActionStep
in interfaceEnvironment
- Parameters:
actionStep
- the step action number.
-
getHiddenParameters
public Map<String,String> getHiddenParameters()
Description copied from interface:Environment
Return a Map containing the hidden parameters that are needed for the WServlet to work correctly. Amongst these are the step number and the window id. This map may be mutated (ie, a new Map instance is created and returned). The map may have additional variables added, and it may be turned into a path usingWebUtilities.getPath(java.lang.String, java.util.Map<java.lang.String, java.lang.String>)
- Specified by:
getHiddenParameters
in interfaceEnvironment
- Returns:
- the hidden parameter map.
-
getFormEncType
public String getFormEncType()
- Specified by:
getFormEncType
in interfaceEnvironment
- Returns:
- the form encoding type.
-
setFormEncType
public void setFormEncType(String formEncType)
Sets the form encoding type.- Specified by:
setFormEncType
in interfaceEnvironment
- Parameters:
formEncType
- the form encoding type.
-
getUserAgentInfo
public UserAgentInfo getUserAgentInfo()
- Specified by:
getUserAgentInfo
in interfaceEnvironment
- Returns:
- the user agent info.
-
setAppHostPath
protected void setAppHostPath(String appHostPath)
Sets the app host path.- Parameters:
appHostPath
- the app host path.
-
setBaseUrl
protected void setBaseUrl(String baseUrl)
Sets the base url.- Parameters:
baseUrl
- the base url
-
setHostFreeBaseUrl
protected void setHostFreeBaseUrl(String hostFreeBaseUrl)
Sets the host free base url.- Parameters:
hostFreeBaseUrl
- the host free base url.
-
setUserAgentInfo
public void setUserAgentInfo(UserAgentInfo userAgentInfo)
Sets the user-agent info.- Parameters:
userAgentInfo
- the user-agent info to set.
-
-