|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.catalina.deploy.SessionCookie
public class SessionCookie
Field Summary | |
---|---|
protected java.lang.String |
comment
|
protected java.lang.String |
domain
|
protected boolean |
httpOnly
|
protected int |
maxAge
|
protected java.lang.String |
name
|
protected java.lang.String |
path
|
protected boolean |
secure
|
Constructor Summary | |
---|---|
SessionCookie()
|
Method Summary | |
---|---|
java.lang.String |
getComment()
Gets the comment that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired. |
java.lang.String |
getDomain()
Gets the domain name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired. |
int |
getMaxAge()
Gets the lifetime (in seconds) of the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired. |
java.lang.String |
getName()
Gets the name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired. |
java.lang.String |
getPath()
Gets the path that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired. |
boolean |
isHttpOnly()
Checks if the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired will be marked as HttpOnly. |
boolean |
isSecure()
Checks if the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired will be marked as secure even if the request that initiated the corresponding session is using plain HTTP instead of HTTPS. |
void |
setComment(java.lang.String comment)
Sets the comment that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired. |
void |
setDomain(java.lang.String domain)
Sets the domain name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired. |
void |
setHttpOnly(boolean httpOnly)
Marks or unmarks the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired as HttpOnly. |
void |
setMaxAge(int maxAge)
Sets the lifetime (in seconds) for the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired. |
void |
setName(java.lang.String name)
Sets the name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired. |
void |
setPath(java.lang.String path)
Sets the path that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired. |
void |
setSecure(boolean secure)
Marks or unmarks the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired as secure. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String domain
protected java.lang.String path
protected java.lang.String comment
protected boolean httpOnly
protected boolean secure
protected int maxAge
protected java.lang.String name
Constructor Detail |
---|
public SessionCookie()
Method Detail |
---|
public java.lang.String getDomain()
javax.servlet.SessionCookieConfig
getDomain
in interface javax.servlet.SessionCookieConfig
SessionCookieConfig.setDomain(java.lang.String)
, or
null if SessionCookieConfig.setDomain(java.lang.String)
was never calledCookie.getDomain()
public java.lang.String getPath()
javax.servlet.SessionCookieConfig
By default, the context path of the ServletContext from which this SessionCookieConfig was acquired will be used.
getPath
in interface javax.servlet.SessionCookieConfig
SessionCookieConfig.setPath(java.lang.String)
, or null
if SessionCookieConfig.setPath(java.lang.String)
was never calledCookie.getPath()
public java.lang.String getComment()
javax.servlet.SessionCookieConfig
getComment
in interface javax.servlet.SessionCookieConfig
SessionCookieConfig.setComment(java.lang.String)
, or
null if SessionCookieConfig.setComment(java.lang.String)
was never calledCookie.getComment()
public boolean isHttpOnly()
javax.servlet.SessionCookieConfig
isHttpOnly
in interface javax.servlet.SessionCookieConfig
Cookie.isHttpOnly()
public boolean isSecure()
javax.servlet.SessionCookieConfig
isSecure
in interface javax.servlet.SessionCookieConfig
Cookie.getSecure()
,
ServletRequest.isSecure()
public void setDomain(java.lang.String domain)
javax.servlet.SessionCookieConfig
setDomain
in interface javax.servlet.SessionCookieConfig
domain
- the cookie domain to useCookie.setDomain(String)
public void setPath(java.lang.String path)
javax.servlet.SessionCookieConfig
setPath
in interface javax.servlet.SessionCookieConfig
path
- the cookie path to useCookie.setPath(String)
public void setComment(java.lang.String comment)
javax.servlet.SessionCookieConfig
As a side effect of this call, the session tracking cookies
will be marked with a Version
attribute equal to
1
.
setComment
in interface javax.servlet.SessionCookieConfig
comment
- the cookie comment to useCookie.setComment(String)
,
Cookie.getVersion()
public void setHttpOnly(boolean httpOnly)
javax.servlet.SessionCookieConfig
A cookie is marked as HttpOnly by adding the HttpOnly attribute to it. HttpOnly cookies are not supposed to be exposed to client-side scripting code, and may therefore help mitigate certain kinds of cross-site scripting attacks.
setHttpOnly
in interface javax.servlet.SessionCookieConfig
httpOnly
- true if the session tracking cookies created
on behalf of the application represented by the
ServletContext from which this SessionCookieConfig
was acquired shall be marked as HttpOnly, false otherwiseCookie.setHttpOnly(boolean)
public void setSecure(boolean secure)
javax.servlet.SessionCookieConfig
One use case for marking a session tracking cookie as secure, even though the request that initiated the session came over HTTP, is to support a topology where the web container is front-ended by an SSL offloading load balancer. In this case, the traffic between the client and the load balancer will be over HTTPS, whereas the traffic between the load balancer and the web container will be over HTTP.
setSecure
in interface javax.servlet.SessionCookieConfig
secure
- true if the session tracking cookies created on
behalf of the application represented by the ServletContext
from which this SessionCookieConfig was acquired shall be
marked as secure even if the request that initiated the
corresponding session is using plain HTTP instead of HTTPS, and false
if they shall be marked as secure only if the request that
initiated the corresponding session was also secureCookie.setSecure(boolean)
,
ServletRequest.isSecure()
public int getMaxAge()
javax.servlet.SessionCookieConfig
By default, -1 is returned.
getMaxAge
in interface javax.servlet.SessionCookieConfig
Cookie.getMaxAge()
public void setMaxAge(int maxAge)
javax.servlet.SessionCookieConfig
setMaxAge
in interface javax.servlet.SessionCookieConfig
maxAge
- the lifetime (in seconds) of the session tracking
cookies created on behalf of the application represented by the
ServletContext from which this SessionCookieConfig
was acquired.Cookie.setMaxAge(int)
public java.lang.String getName()
javax.servlet.SessionCookieConfig
By default, JSESSIONID will be used as the cookie name.
getName
in interface javax.servlet.SessionCookieConfig
SessionCookieConfig.setName(java.lang.String)
, or
null if SessionCookieConfig.setName(java.lang.String)
was never calledCookie.getName()
public void setName(java.lang.String name)
javax.servlet.SessionCookieConfig
NOTE: Changing the name of session tracking cookies may break other tiers (for example, a load balancing frontend) that assume the cookie name to be equal to the default JSESSIONID, and therefore should only be done cautiously.
setName
in interface javax.servlet.SessionCookieConfig
name
- the cookie name to use
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |