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 intgetActionStep()Deprecated.portal specificStringgetAppHostPath()Gets the base URL under which web applications are hosted.StringgetAppId()Deprecated.no longer used.StringgetBaseUrl()Get the base url at which this web application is hosted.StringgetFormEncType()Map<String,String>getHiddenParameters()Return a Map containing the hidden parameters that are needed for the WServlet to work correctly.StringgetHostFreeBaseUrl()Get the "host-free" part of the base url for this web application.StringgetPostPath()Gets the relative URL path to which this WComponent application should post its requests.StringgetSessionToken()Gets the session token.intgetStep()Gets the page step number.StringgetThemePath()Gets the base URL under which the web content for the Theme is hosted.UserAgentInfogetUserAgentInfo()StringgetWServletPath()Construct the path to the support servlet.voidsetActionStep(int actionStep)Deprecated.portal specificprotected voidsetAppHostPath(String appHostPath)Sets the app host path.voidsetAppId(String appId)Deprecated.no longer used.protected voidsetBaseUrl(String baseUrl)Sets the base url.voidsetFormEncType(String formEncType)Sets the form encoding type.protected voidsetHostFreeBaseUrl(String hostFreeBaseUrl)Sets the host free base url.voidsetPostPath(String postPath)Sets the post path.voidsetSessionToken(String sessionToken)Sets the current session token.voidsetStep(int step)Sets the current set.voidsetUserAgentInfo(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:
getWServletPathin interfaceEnvironment- Returns:
- the path to the AJAX servlet.
-
getThemePath
public String getThemePath()
Description copied from interface:EnvironmentGets 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:
getThemePathin interfaceEnvironment- Returns:
- the theme path.
-
getPostPath
public String getPostPath()
Description copied from interface:EnvironmentGets the relative URL path to which this WComponent application should post its requests.Examples of what this method may return:
- Servlet
- /app
- Specified by:
getPostPathin interfaceEnvironment- Returns:
- the post path.
-
setPostPath
public void setPostPath(String postPath)
Sets the post path.- Specified by:
setPostPathin interfaceEnvironment- Parameters:
postPath- the post path.
-
getAppHostPath
public String getAppHostPath()
Description copied from interface:EnvironmentGets 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:
getAppHostPathin interfaceEnvironment- Returns:
- the app host path.
-
getBaseUrl
public String getBaseUrl()
Description copied from interface:EnvironmentGet 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:
getBaseUrlin interfaceEnvironment- Returns:
- the base url.
-
getHostFreeBaseUrl
public String getHostFreeBaseUrl()
Description copied from interface:EnvironmentGet 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:
getHostFreeBaseUrlin interfaceEnvironment- Returns:
- the host name free base url.
-
getAppId
@Deprecated public String getAppId()
Deprecated.no longer used. UseWApplication.getIdName()instead.Description copied from interface:EnvironmentGet 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:
getAppIdin 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:
setAppIdin interfaceEnvironment- Parameters:
appId- the appId to set.
-
getSessionToken
public String getSessionToken()
Description copied from interface:EnvironmentGets the session token. This is intended to make sure the request is for the correct session.- Specified by:
getSessionTokenin interfaceEnvironment- Returns:
- the current session token.
-
setSessionToken
public void setSessionToken(String sessionToken)
Sets the current session token.- Specified by:
setSessionTokenin interfaceEnvironment- Parameters:
sessionToken- the session token to set.
-
getStep
public int getStep()
Description copied from interface:EnvironmentGets the page step number. This is intended to make sure the request being processed is on the correct step.- Specified by:
getStepin interfaceEnvironment- Returns:
- the current step.
-
setStep
public void setStep(int step)
Sets the current set.- Specified by:
setStepin 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:
getActionStepin interfaceEnvironment- Returns:
- the page action step number.
-
setActionStep
@Deprecated public void setActionStep(int actionStep)
Deprecated.portal specificSets the page action step number.- Specified by:
setActionStepin interfaceEnvironment- Parameters:
actionStep- the step action number.
-
getHiddenParameters
public Map<String,String> getHiddenParameters()
Description copied from interface:EnvironmentReturn 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:
getHiddenParametersin interfaceEnvironment- Returns:
- the hidden parameter map.
-
getFormEncType
public String getFormEncType()
- Specified by:
getFormEncTypein interfaceEnvironment- Returns:
- the form encoding type.
-
setFormEncType
public void setFormEncType(String formEncType)
Sets the form encoding type.- Specified by:
setFormEncTypein interfaceEnvironment- Parameters:
formEncType- the form encoding type.
-
getUserAgentInfo
public UserAgentInfo getUserAgentInfo()
- Specified by:
getUserAgentInfoin 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.
-
-