Package com.vaadin.flow.server
Class WrappedHttpSession
- java.lang.Object
-
- com.vaadin.flow.server.WrappedHttpSession
-
- All Implemented Interfaces:
WrappedSession,Serializable
public class WrappedHttpSession extends Object implements WrappedSession
Wrapper forHttpSession.- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
WrappedSession, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description WrappedHttpSession(javax.servlet.http.HttpSession session)Creates a new wrapped http session.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetAttribute(String name)Gets an attribute from this session.Set<String>getAttributeNames()Gets the current set of attribute names stored in this session.longgetCreationTime()Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.javax.servlet.http.HttpSessiongetHttpSession()Gets the wrappedHttpSession.StringgetId()Gets a string with a unique identifier for the session.longgetLastAccessedTime()Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight January 1, 1970 GMT, and marked by the time the container received the request.intgetMaxInactiveInterval()Returns the maximum time interval, in seconds, that this session will be kept open between client accesses.voidinvalidate()Invalidates this session then unbinds any objects bound to it.booleanisNew()Returns true if the client does not yet know about the session or if the client chooses not to join the session.voidremoveAttribute(String name)Removes the object bound with the specified name from this session.voidsetAttribute(String name, Object value)Saves an attribute value in this session.voidsetMaxInactiveInterval(int interval)Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.
-
-
-
Method Detail
-
getMaxInactiveInterval
public int getMaxInactiveInterval()
Description copied from interface:WrappedSessionReturns the maximum time interval, in seconds, that this session will be kept open between client accesses.- Specified by:
getMaxInactiveIntervalin interfaceWrappedSession- Returns:
- an integer specifying the number of seconds this session remains open between client requests
- See Also:
HttpSession.getMaxInactiveInterval()
-
getAttribute
public Object getAttribute(String name)
Description copied from interface:WrappedSessionGets an attribute from this session.- Specified by:
getAttributein interfaceWrappedSession- Parameters:
name- the name of the attribute- Returns:
- the attribute value, or
nullif the attribute is not defined in the session - See Also:
HttpSession.getAttribute(String)
-
setAttribute
public void setAttribute(String name, Object value)
Description copied from interface:WrappedSessionSaves an attribute value in this session.- Specified by:
setAttributein interfaceWrappedSession- Parameters:
name- the name of the attributevalue- the attribute value- See Also:
HttpSession.setAttribute(String, Object)
-
getHttpSession
public javax.servlet.http.HttpSession getHttpSession()
Gets the wrappedHttpSession.- Returns:
- the wrapped http session
-
getAttributeNames
public Set<String> getAttributeNames()
Description copied from interface:WrappedSessionGets the current set of attribute names stored in this session.- Specified by:
getAttributeNamesin interfaceWrappedSession- Returns:
- an unmodifiable set of the current attribute names
- See Also:
HttpSession.getAttributeNames()
-
invalidate
public void invalidate()
Description copied from interface:WrappedSessionInvalidates this session then unbinds any objects bound to it.- Specified by:
invalidatein interfaceWrappedSession- See Also:
HttpSession.invalidate()
-
getId
public String getId()
Description copied from interface:WrappedSessionGets a string with a unique identifier for the session.- Specified by:
getIdin interfaceWrappedSession- Returns:
- a unique session id string
- See Also:
HttpSession.getId()
-
getCreationTime
public long getCreationTime()
Description copied from interface:WrappedSessionReturns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.- Specified by:
getCreationTimein interfaceWrappedSession- Returns:
- a long specifying when this session was created, expressed in milliseconds since 1/1/1970 GMT
- See Also:
HttpSession.getCreationTime()
-
getLastAccessedTime
public long getLastAccessedTime()
Description copied from interface:WrappedSessionReturns the last time the client sent a request associated with this session, as the number of milliseconds since midnight January 1, 1970 GMT, and marked by the time the container received the request.Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.
- Specified by:
getLastAccessedTimein interfaceWrappedSession- Returns:
- a long representing the last time the client sent a request associated with this session, expressed in milliseconds since 1/1/1970 GMT
- See Also:
HttpSession.getLastAccessedTime()
-
isNew
public boolean isNew()
Description copied from interface:WrappedSessionReturns true if the client does not yet know about the session or if the client chooses not to join the session. For example, if the server used only cookie-based sessions, and the client had disabled the use of cookies, then a session would be new on each request.- Specified by:
isNewin interfaceWrappedSession- Returns:
- true if the server has created a session, but the client has not yet joined
- See Also:
HttpSession.isNew()
-
removeAttribute
public void removeAttribute(String name)
Description copied from interface:WrappedSessionRemoves the object bound with the specified name from this session. If the session does not have an object bound with the specified name, this method does nothing.- Specified by:
removeAttributein interfaceWrappedSession- Parameters:
name- the name of the object to remove from this session- See Also:
HttpSession.removeAttribute(String)
-
setMaxInactiveInterval
public void setMaxInactiveInterval(int interval)
Description copied from interface:WrappedSessionSpecifies the time, in seconds, between client requests before the servlet container will invalidate this session. A negative time indicates the session should never timeout.- Specified by:
setMaxInactiveIntervalin interfaceWrappedSession- Parameters:
interval- An integer specifying the number of seconds- See Also:
HttpSession.setMaxInactiveInterval(int)
-
-