com.vaadin.server.
Class WrappedPortletSession
- java.lang.Object
-
- com.vaadin.server.WrappedPortletSession
-
All Implemented Interfaces:
public class WrappedPortletSession extends Object implements WrappedSession
Wrapper for
PortletSession
.Since:
7.0.0
Author:
Vaadin Ltd
See Also:
-
-
Constructor Summary
Constructors Constructor and Description WrappedPortletSession(PortletSession session)
Creates a new wrapped portlet session.
-
Method Summary
All Methods Modifier and Type Method and Description Object
getAttribute(String name)
Gets an attribute from this session.
Object
getAttribute(String name, int scope)
Returns the object bound with the specified name in this session, or
null
if no object is bound under the name in the given scope.Set<String>
getAttributeNames()
Gets the current set of attribute names stored in this session.
Set<String>
getAttributeNames(int scope)
Gets the current set of attribute names bound to this session in the given scope.
long
getCreationTime()
Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.
String
getId()
Gets a string with a unique identifier for the session.
long
getLastAccessedTime()
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.
int
getMaxInactiveInterval()
Returns the maximum time interval, in seconds, that this session will be kept open between client accesses.
PortletSession
getPortletSession()
Gets the wrapped
PortletSession
.void
invalidate()
Invalidates this session then unbinds any objects bound to it.
boolean
isNew()
Returns true if the client does not yet know about the session or if the client chooses not to join the session.
void
removeAttribute(String name)
Removes the object bound with the specified name from this session.
void
removeAttribute(String name, int scope)
Removes the object bound with the specified name and the given scope from this session.
void
setAttribute(String name, Object value)
Saves an attribute value in this session.
void
setAttribute(String name, Object value, int scope)
Binds an object to this session in the given scope, using the name specified.
void
setMaxInactiveInterval(int interval)
Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.
-
-
-
Constructor Detail
-
WrappedPortletSession
public WrappedPortletSession(PortletSession session)
Creates a new wrapped portlet session.
Parameters:
session
- the portlet session to wrap.
-
-
Method Detail
-
getMaxInactiveInterval
public int getMaxInactiveInterval()
Description copied from interface:
WrappedSession
Returns the maximum time interval, in seconds, that this session will be kept open between client accesses.
Specified by:
getMaxInactiveInterval
in interfaceWrappedSession
Returns:
an integer specifying the number of seconds this session remains open between client requests
See Also:
HttpSession.getMaxInactiveInterval()
,javax.portlet.PortletSession#getMaxInactiveInterval()
-
getAttribute
public Object getAttribute(String name)
Description copied from interface:
WrappedSession
Gets an attribute from this session.
Specified by:
getAttribute
in interfaceWrappedSession
Parameters:
name
- the name of the attributeReturns:
the attribute value, or
null
if the attribute is not defined in the sessionSee Also:
HttpSession.getAttribute(String)
,javax.portlet.PortletSession#getAttribute(String)
-
getAttribute
public Object getAttribute(String name, int scope)
Returns the object bound with the specified name in this session, or
null
if no object is bound under the name in the given scope.Parameters:
name
- a string specifying the name of the objectscope
- session scope of this attributeReturns:
the object with the specified name
Throws:
IllegalStateException
- if this method is called on an invalidated session, or the scope is unknown to the container.IllegalArgumentException
- if name isnull
.Since:
7.6
See Also:
PortletSession#getAttribute(String, int)
,PortletSession#PORTLET_SCOPE
,PortletSession#APPLICATION_SCOPE
-
setAttribute
public void setAttribute(String name, Object value)
Description copied from interface:
WrappedSession
Saves an attribute value in this session.
Specified by:
setAttribute
in interfaceWrappedSession
Parameters:
name
- the name of the attributevalue
- the attribute valueSee Also:
HttpSession.setAttribute(String, Object)
,javax.portlet.PortletSession#setAttribute(String, Object)
-
setAttribute
public void setAttribute(String name, Object value, int scope)
Binds an object to this session in the given scope, using the name specified. If an object of the same name in this scope is already bound to the session, that object is replaced.
If the value is
null
, this has the same effect as callingremoveAttribute()
.Parameters:
name
- the name to which the object is bound; this cannot benull
.value
- the object to be boundscope
- session scope of this attributeThrows:
IllegalStateException
- if this method is called on a session which has been invalidatedIllegalArgumentException
- if name isnull
or scope is unknown to the container.Since:
7.6
See Also:
PortletSession#setAttribute(String, Object, int)
,PortletSession#PORTLET_SCOPE
,PortletSession#APPLICATION_SCOPE
-
getPortletSession
public PortletSession getPortletSession()
Gets the wrapped
PortletSession
.Returns:
the wrapped portlet session
-
getAttributeNames
public Set<String> getAttributeNames()
Description copied from interface:
WrappedSession
Gets the current set of attribute names stored in this session.
Specified by:
getAttributeNames
in interfaceWrappedSession
Returns:
an unmodifiable set of the current attribute names
See Also:
HttpSession.getAttributeNames()
,PortletSession#getAttributeNames()
-
getAttributeNames
public Set<String> getAttributeNames(int scope)
Gets the current set of attribute names bound to this session in the given scope.
Parameters:
scope
- session scope of the attribute namesReturns:
an unmodifiable set of the current attribute names in the given scope
Since:
7.6
See Also:
PortletSession#getAttributeNames()
-
invalidate
public void invalidate()
Description copied from interface:
WrappedSession
Invalidates this session then unbinds any objects bound to it.
Specified by:
invalidate
in interfaceWrappedSession
See Also:
HttpSession.invalidate()
,PortletSession#invalidate()
-
getId
public String getId()
Description copied from interface:
WrappedSession
Gets a string with a unique identifier for the session.
Specified by:
getId
in interfaceWrappedSession
Returns:
a unique session id string
See Also:
HttpSession.getId()
,PortletSession#getId()
-
getCreationTime
public long getCreationTime()
Description copied from interface:
WrappedSession
Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.
Specified by:
getCreationTime
in interfaceWrappedSession
Returns:
a long specifying when this session was created, expressed in milliseconds since 1/1/1970 GMT
See Also:
HttpSession.getCreationTime()
,PortletSession#getCreationTime()
-
getLastAccessedTime
public long getLastAccessedTime()
Description copied from interface:
WrappedSession
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.
Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.
Specified by:
getLastAccessedTime
in 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()
,PortletSession#getLastAccessedTime()
-
isNew
public boolean isNew()
Description copied from interface:
WrappedSession
Returns 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:
isNew
in interfaceWrappedSession
Returns:
true if the server has created a session, but the client has not yet joined
See Also:
HttpSession.isNew()
,PortletSession#isNew()
-
removeAttribute
public void removeAttribute(String name)
Description copied from interface:
WrappedSession
Removes 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:
removeAttribute
in interfaceWrappedSession
Parameters:
name
- the name of the object to remove from this sessionSee Also:
HttpSession.removeAttribute(String)
,PortletSession#removeAttribute(String)
-
removeAttribute
public void removeAttribute(String name, int scope)
Removes the object bound with the specified name and the given scope from this session. If the session does not have an object bound with the specified name, this method does nothing.
Parameters:
name
- the name of the object to be removed from this sessionscope
- session scope of this attributeThrows:
IllegalStateException
- if this method is called on a session which has been invalidatedIllegalArgumentException
- if name isnull
.Since:
7.6
See Also:
PortletSession#removeAttribute(String, int)
,PortletSession#PORTLET_SCOPE
,PortletSession#APPLICATION_SCOPE
-
setMaxInactiveInterval
public void setMaxInactiveInterval(int interval)
Description copied from interface:
WrappedSession
Specifies 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:
setMaxInactiveInterval
in interfaceWrappedSession
Parameters:
interval
- An integer specifying the number of secondsSee Also:
HttpSession.setMaxInactiveInterval(int)
,PortletSession#setMaxInactiveInterval(int)
-
-