public interface Client
Client
interface provides information and methods pertaining to the client browser,
including access to the request and response objects, methods to create and read cookies, and information on the capabilities of
the client browser.Modifier and Type | Method and Description |
---|---|
javax.servlet.http.Cookie |
addCookie(java.lang.String cookieName,
java.lang.String cookieValue,
int age)
Adds a cookie to the response object.
|
java.lang.String |
getCookieValue(java.lang.String cookieName)
Returns the value of the named cookie or
null if the cookie does not exist. |
FormSession |
getFormSession()
Returns a
FormSession object which represents a single browser window, usually a separate tab within the clilent browser. |
WrappedHttpSession |
getHttpSession()
Returns the
HttpSession object representing the client browser session. |
int |
getIEVersion()
Returns the MS Internet Explorer version.
|
javax.servlet.http.HttpServletRequest |
getRequest()
Returns the
HttpServletRequest object for the user request. |
javax.servlet.http.HttpServletResponse |
getResponse()
Returns the
HttpServletResponse object used to send a response to the user. |
java.lang.String |
getUserAgent()
Returns the
user-agent request header. |
java.lang.String |
getWebappUrlBase()
Returns a base URL to access the root of the current web application
i.e.
|
boolean |
isBackButtonUsed()
Returns
true if the user has clicked the back button immediately prior to the request currently being processed. |
boolean |
isChrome()
Returns
true when the client browser is Chrome, otherwise returns false . |
boolean |
isEdge()
Returns
true when the client browser is MS Edge, otherwise returns false . |
boolean |
isFirefox()
Returns
true when the client browser is Firefox, otherwise returns false . |
boolean |
isIE()
Returns
true when the client browser is MS Internet Explorer, otherwise returns false . |
boolean |
isJavascriptUsed()
Returns
true if Javascript is currently being used. |
boolean |
isMobile()
Returns
true when the client browser is a mobile phone. |
boolean |
isOpera()
Returns
true when the client browser is Opera, otherwise returns false . |
boolean |
isSafari()
Returns
true when the client browser is Safari, otherwise returns false . |
boolean |
isSecure()
Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.
|
boolean |
supportsCookies()
Returns
false if cookies are disabled on the client browser, otherwise returns true . |
boolean |
supportsJavascript()
Returns
false if Javascript is disabled on the client browser, otherwise returns true . |
javax.servlet.http.HttpServletRequest getRequest()
HttpServletRequest
object for the user request. This can be used to access
information such as request parameters, request headers, user's ip address etc.WrappedHttpSession getHttpSession()
HttpSession
object representing the client browser session.
When there is a need to get/set session attributes, consider using method getFormSession() instead of this method. This gives access to session attributes within a scope limited to just a single browser tab. This, in turn, allows the user to concurrently run the same form in multiple browser tabs without the risk that these might interfere with each other.
getFormSession()
javax.servlet.http.HttpServletResponse getResponse()
HttpServletResponse
object used to send a response to the user.java.lang.String getCookieValue(java.lang.String cookieName)
null
if the cookie does not exist.javax.servlet.http.Cookie addCookie(java.lang.String cookieName, java.lang.String cookieValue, int age)
age
parameter specifies the lifetime of the cookie in seconds.
A negative value denotes a session cookie i.e. not persisted on the client.
A value of 0 deletes the cookie.
NB The new cookie's value will not be available to getCookieValue() until the next request.cookieName
- the name of the new cookiecookieValue
- the value of the new cookieage
- age of the cookie in seconds, see above descriptionjava.lang.String getUserAgent()
user-agent
request header. This contains a description of the browser type.boolean supportsCookies()
false
if cookies are disabled on the client browser, otherwise returns true
.boolean supportsJavascript()
false
if Javascript is disabled on the client browser, otherwise returns true
.
Note that Javascript may not be used even though this is supported by the browser, as Javascript can be
disabled using system preferences. To check whether Javascript is being used, use method isJavascriptUsed()
.boolean isFirefox()
true
when the client browser is Firefox, otherwise returns false
.boolean isEdge()
true
when the client browser is MS Edge, otherwise returns false
.boolean isIE()
true
when the client browser is MS Internet Explorer, otherwise returns false
.boolean isChrome()
true
when the client browser is Chrome, otherwise returns false
.boolean isOpera()
true
when the client browser is Opera, otherwise returns false
.boolean isSafari()
true
when the client browser is Safari, otherwise returns false
.int getIEVersion()
boolean isMobile()
true
when the client browser is a mobile phone.boolean isBackButtonUsed()
true
if the user has clicked the back button immediately prior to the request currently being processed.
Note that when true
, any back button event specified at form level will be executed.boolean isJavascriptUsed()
true
if Javascript is currently being used. Returns false
if either
Javascript is disabled on the client, or Javascript is disabled on the Ebase server using system preferences.supportsJavascript()
,
SystemPreferences.isUseJavascript()
boolean isSecure()
FormSession getFormSession()
FormSession
object which represents a single browser window, usually a separate tab within the clilent browser.
The form session object gives access to form session attributes, which exist for the duration of the HTTP session,
but are limited in scope to just a single form session - usually a browser tab.getHttpSession()
java.lang.String getWebappUrlBase()