PHP Class AppserverIo\Appserver\ServletEngine\StandardSessionManager

Inheritance: implements AppserverIo\Appserver\ServletEngine\SessionManagerInterface
Datei anzeigen Open project: appserver-io/appserver Class Usage Examples

Protected Properties

Property Type Description
$application AppserverIo\Psr\Application\ApplicationInterface The application instance.
$garbageCollector AppserverIo\Appserver\ServletEngine\GarbageCollectorInterface The garbage collector instance.
$managerConfiguration AppserverIo\Psr\Application\ManagerConfigurationInterface The manager configuration instance.
$sessionHandlers AppserverIo\Collections\HashMap The HashMap containing the session handlers.
$sessionMarshaller AppserverIo\Appserver\ServletEngine\SessionMarshallerInterface The session marshaller instance.
$sessionSettings AppserverIo\Appserver\ServletEngine\SessionSettingsInterface The settings for the session handling.
$sessions AppserverIo\Collections\HashMap The HashMap containing the sessions.

Public Methods

Method Description
__construct ( ) Initialize the session manager.
__destruct ( ) Save the sessions back to the persistence layer.
attach ( AppserverIo\Psr\Servlet\ServletSessionInterface $session ) : void Attaches the passed session to the manager and returns the instance.
create ( mixed $id, string $name, integer | DateTime $lifetime = null, integer | null $maximumAge = null, string | null $domain = null, string $path = null, boolean $secure = null, boolean $httpOnly = null ) : AppserverIo\Psr\Servlet\ServletSessionInterface Creates a new session with the passed session ID and session name if given.
find ( string $id ) : AppserverIo\Psr\Servlet\Http\ServletSessionInterface | null Tries to find a session for the given request. The session-ID will be searched in the cookie header of the request, and in the request query string. If both values are present, the value in the query string takes precedence. If no session id is found, a new one is created and assigned to the request.
flush ( ) : void Flushes the session storage and persists all sessions.
getApplication ( ) : AppserverIo\Psr\Application\ApplicationInterface | AppserverIo\Psr\Naming\NamingDirectoryInterface Returns the application instance.
getAttribute ( string $key ) : mixed | null Returns the attribute with the passed key from the container.
getGarbageCollector ( ) : AppserverIo\Appserver\ServletEngine\GarbageCollectorInterface Returns the garbage collector instance.
getIdentifier ( ) : string Initializes the manager instance.
getLogger ( string $loggerName ) : Psr\Log\LoggerInterface Return's the logger with the requested name. First we look in the application and then in the system itself.
getManagerConfiguration ( ) : AppserverIo\Psr\Application\ManagerConfigurationInterface Return's the manager configuration.
getPersistenceManager ( ) : AppserverIo\Appserver\ServletEngine\FilesystemPersistenceManager Returns the persistence manager instance.
getServletManager ( ) : AppserverIo\Psr\Servlet\ServletContextInterface Returns the servlet manager instance.
getSessionFactory ( ) : AppserverIo\Appserver\ServletEngine\SessionFactory Returns the session factory.
getSessionHandlers ( ) : AppserverIo\Collections\ArrayList Returns all registered session handlers.
getSessionMarshaller ( ) : AppserverIo\Appserver\ServletEngine\SessionMarshallerInterface Returns the session marshaller.
getSessionPool ( ) : AppserverIo\Storage\StorageInterface Returns the session pool instance.
getSessionSettings ( ) : AppserverIo\Appserver\ServletEngine\SessionSettingsInterface Returns the session settings.
getSessions ( ) : AppserverIo\Collections\HashMap Returns all sessions actually attached to the session manager.
initialize ( AppserverIo\Psr\Application\ApplicationInterface $application ) : void Initializes the session manager.
injectApplication ( AppserverIo\Psr\Application\ApplicationInterface $application ) : void Inject the application instance.
injectGarbageCollector ( AppserverIo\Appserver\ServletEngine\GarbageCollectorInterface $garbageCollector ) : void Injects the garbage collector.
injectManagerConfiguration ( AppserverIo\Psr\Application\ManagerConfigurationInterface $managerConfiguration ) : void Inject the configuration for this manager.
injectSessionHandlers ( AppserverIo\Collections\CollectionInterface $sessionHandlers ) : void Inject the session handlers.
injectSessionMarshaller ( AppserverIo\Appserver\ServletEngine\SessionMarshallerInterface $sessionMarshaller ) : void Injects the session marshaller.
injectSessionSettings ( AppserverIo\Appserver\ServletEngine\SessionSettingsInterface $sessionSettings ) : void Injects the session settings.
stop ( ) : void Shutdown the session manager instance.

Method Details

__construct() public method

Initialize the session manager.
public __construct ( )

__destruct() public method

Save the sessions back to the persistence layer.
public __destruct ( )

attach() public method

If a session with the session identifier already exists, it will be overwritten.
public attach ( AppserverIo\Psr\Servlet\ServletSessionInterface $session ) : void
$session AppserverIo\Psr\Servlet\ServletSessionInterface The session to attach
return void

create() public method

Creates a new session with the passed session ID and session name if given.
public create ( mixed $id, string $name, integer | DateTime $lifetime = null, integer | null $maximumAge = null, string | null $domain = null, string $path = null, boolean $secure = null, boolean $httpOnly = null ) : AppserverIo\Psr\Servlet\ServletSessionInterface
$id mixed The session ID
$name string The session name
$lifetime integer | DateTime Date and time after the session expires
$maximumAge integer | null Number of seconds until the session expires
$domain string | null The host to which the user agent will send this cookie
$path string The path describing the scope of this cookie
$secure boolean If this cookie should only be sent through a "secure" channel by the user agent
$httpOnly boolean If this cookie should only be used through the HTTP protocol
return AppserverIo\Psr\Servlet\ServletSessionInterface The requested session

find() public method

Tries to find a session for the given request. The session-ID will be searched in the cookie header of the request, and in the request query string. If both values are present, the value in the query string takes precedence. If no session id is found, a new one is created and assigned to the request.
public find ( string $id ) : AppserverIo\Psr\Servlet\Http\ServletSessionInterface | null
$id string The unique session ID to that has to be returned
return AppserverIo\Psr\Servlet\Http\ServletSessionInterface | null The requested session

flush() public method

Flushes the session storage and persists all sessions.
public flush ( ) : void
return void

getApplication() public method

Returns the application instance.
public getApplication ( ) : AppserverIo\Psr\Application\ApplicationInterface | AppserverIo\Psr\Naming\NamingDirectoryInterface
return AppserverIo\Psr\Application\ApplicationInterface | AppserverIo\Psr\Naming\NamingDirectoryInterface The application instance

getAttribute() public method

Returns the attribute with the passed key from the container.
public getAttribute ( string $key ) : mixed | null
$key string The key the requested value is registered with
return mixed | null The requested value if available

getGarbageCollector() public method

Returns the garbage collector instance.
public getGarbageCollector ( ) : AppserverIo\Appserver\ServletEngine\GarbageCollectorInterface
return AppserverIo\Appserver\ServletEngine\GarbageCollectorInterface The garbage collector instance

getIdentifier() public method

Initializes the manager instance.
See also: AppserverIo\Psr\Application\ManagerInterface::initialize()
public getIdentifier ( ) : string
return string

getLogger() public method

Return's the logger with the requested name. First we look in the application and then in the system itself.
public getLogger ( string $loggerName ) : Psr\Log\LoggerInterface
$loggerName string The name of the logger to return
return Psr\Log\LoggerInterface The logger with the requested name

getManagerConfiguration() public method

Return's the manager configuration.
public getManagerConfiguration ( ) : AppserverIo\Psr\Application\ManagerConfigurationInterface
return AppserverIo\Psr\Application\ManagerConfigurationInterface The manager configuration

getPersistenceManager() public method

Returns the persistence manager instance.
public getPersistenceManager ( ) : AppserverIo\Appserver\ServletEngine\FilesystemPersistenceManager
return AppserverIo\Appserver\ServletEngine\FilesystemPersistenceManager The persistence manager instance

getServletManager() public method

Returns the servlet manager instance.
public getServletManager ( ) : AppserverIo\Psr\Servlet\ServletContextInterface
return AppserverIo\Psr\Servlet\ServletContextInterface The servlet manager instance

getSessionFactory() public method

Returns the session factory.
public getSessionFactory ( ) : AppserverIo\Appserver\ServletEngine\SessionFactory
return AppserverIo\Appserver\ServletEngine\SessionFactory The session factory instance

getSessionHandlers() public method

Returns all registered session handlers.
public getSessionHandlers ( ) : AppserverIo\Collections\ArrayList
return AppserverIo\Collections\ArrayList The session handlers

getSessionMarshaller() public method

Returns the session marshaller.
public getSessionMarshaller ( ) : AppserverIo\Appserver\ServletEngine\SessionMarshallerInterface
return AppserverIo\Appserver\ServletEngine\SessionMarshallerInterface The session marshaller

getSessionPool() public method

Returns the session pool instance.
public getSessionPool ( ) : AppserverIo\Storage\StorageInterface
return AppserverIo\Storage\StorageInterface The session pool

getSessionSettings() public method

Returns the session settings.
public getSessionSettings ( ) : AppserverIo\Appserver\ServletEngine\SessionSettingsInterface
return AppserverIo\Appserver\ServletEngine\SessionSettingsInterface The session settings

getSessions() public method

Returns all sessions actually attached to the session manager.
public getSessions ( ) : AppserverIo\Collections\HashMap
return AppserverIo\Collections\HashMap The container with sessions

initialize() public method

Initializes the session manager.
See also: AppserverIo\Psr\Application\ManagerInterface::initialize()
public initialize ( AppserverIo\Psr\Application\ApplicationInterface $application ) : void
$application AppserverIo\Psr\Application\ApplicationInterface The application instance
return void

injectApplication() public method

Inject the application instance.
public injectApplication ( AppserverIo\Psr\Application\ApplicationInterface $application ) : void
$application AppserverIo\Psr\Application\ApplicationInterface The application instance
return void

injectGarbageCollector() public method

Injects the garbage collector.
public injectGarbageCollector ( AppserverIo\Appserver\ServletEngine\GarbageCollectorInterface $garbageCollector ) : void
$garbageCollector AppserverIo\Appserver\ServletEngine\GarbageCollectorInterface The garbage collector
return void

injectManagerConfiguration() public method

Inject the configuration for this manager.
public injectManagerConfiguration ( AppserverIo\Psr\Application\ManagerConfigurationInterface $managerConfiguration ) : void
$managerConfiguration AppserverIo\Psr\Application\ManagerConfigurationInterface The managers configuration
return void

injectSessionHandlers() public method

Inject the session handlers.
public injectSessionHandlers ( AppserverIo\Collections\CollectionInterface $sessionHandlers ) : void
$sessionHandlers AppserverIo\Collections\CollectionInterface The session handlers
return void

injectSessionMarshaller() public method

Injects the session marshaller.
public injectSessionMarshaller ( AppserverIo\Appserver\ServletEngine\SessionMarshallerInterface $sessionMarshaller ) : void
$sessionMarshaller AppserverIo\Appserver\ServletEngine\SessionMarshallerInterface The session marshaller instance
return void

injectSessionSettings() public method

Injects the session settings.
public injectSessionSettings ( AppserverIo\Appserver\ServletEngine\SessionSettingsInterface $sessionSettings ) : void
$sessionSettings AppserverIo\Appserver\ServletEngine\SessionSettingsInterface Settings for the session handling
return void

stop() public method

Shutdown the session manager instance.
public stop ( ) : void
return void \AppserverIo\Psr\Application\ManagerInterface::stop()

Property Details

$application protected_oe property

The application instance.
protected ApplicationInterface,AppserverIo\Psr\Application $application
return AppserverIo\Psr\Application\ApplicationInterface

$garbageCollector protected_oe property

The garbage collector instance.
protected GarbageCollectorInterface,AppserverIo\Appserver\ServletEngine $garbageCollector
return AppserverIo\Appserver\ServletEngine\GarbageCollectorInterface

$managerConfiguration protected_oe property

The manager configuration instance.
protected ManagerConfigurationInterface,AppserverIo\Psr\Application $managerConfiguration
return AppserverIo\Psr\Application\ManagerConfigurationInterface

$sessionHandlers protected_oe property

The HashMap containing the session handlers.
protected HashMap,AppserverIo\Collections $sessionHandlers
return AppserverIo\Collections\HashMap

$sessionMarshaller protected_oe property

The session marshaller instance.
protected SessionMarshallerInterface,AppserverIo\Appserver\ServletEngine $sessionMarshaller
return AppserverIo\Appserver\ServletEngine\SessionMarshallerInterface

$sessionSettings protected_oe property

The settings for the session handling.
protected SessionSettingsInterface,AppserverIo\Appserver\ServletEngine $sessionSettings
return AppserverIo\Appserver\ServletEngine\SessionSettingsInterface

$sessions protected_oe property

The HashMap containing the sessions.
protected HashMap,AppserverIo\Collections $sessions
return AppserverIo\Collections\HashMap