Class Session (namespace Nette\Web)


Provides access to session namespaces as well as session settings and management methods.

Object
   |
   --Session
Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Located: in /Web/Session.php (line 36)
Constructor Summary
public
Method Summary
void
clean ()
Cleans and minimizes meta structures.
void
close ()
Ends the current session and store session data.
void
configure ($config, [bool $throwException = TRUE])
Configurates session environment.
void
destroy ()
Destroys all data registered to a session.
bool
exists ()
Does session exists for the current request?
string
Generates key as protection against Session Hijacking & Fixation.
array
Returns the session cookie parameters.
protected IHttpRequest
protected IHttpResponse
string
getId ()
Returns the current session ID. Don't make dependencies, can be changed for each request.
ArrayIterator
Iteration over all namespaces.
SessionNamespace
getNamespace (string $namespace, [string $class = 'SessionNamespace'])
Returns specified session namespace.
bool
hasNamespace (string $namespace)
Checks if a session namespace exist and is not empty.
bool
Has been session started?
void
Regenerates the session ID.
void
setCookieParams (string $path, [string $domain = NULL], [bool $secure = NULL])
Sets the session cookie parameters.
void
setExpiration (int $seconds)
Sets the amount of time allowed between requests before the session will be terminated.
void
setId (string $id)
Sets the session ID to a specified one.
void
setSavePath ($path)
Sets path of the directory used to save session data.
void
start ()
Starts and initializes session data.
Methods Inherited From Object
Object::extensionMethod(), Object::getClass(), Object::getReflection(), Object::__call(), Object::__callStatic(), Object::__get(), Object::__isset(), Object::__set(), Object::__unset()
Constant Summary
int DEFAULT_LIFETIME 10800

line 39

Default lifetime is 3 hours
Variable Summary
callback $verificationKeyGenerator

line 42

Validation key generator

Constructor Details

line 78

__construct

public __construct ()

Method Details

line 369

clean

public void clean ()

Cleans and minimizes meta structures.

Output
void  

line 185

close

public void close ()

Ends the current session and store session data.

Output
void  

line 414

configure

public void configure ($config, [bool $throwException = TRUE])

Configurates session environment.

Input
$config
bool $throwException throw exception?
Output
void  
Throws
throws InvalidStateException
throws NotSupportedException

line 199

destroy

public void destroy ()

Destroys all data registered to a session.

Output
void  

line 220

exists

public bool exists ()

Does session exists for the current request?

Output
bool  

line 286

generateVerificationKey

public string generateVerificationKey ()

Generates key as protection against Session Hijacking & Fixation.

Output
string  

line 509

getCookieParams

public array getCookieParams ()

Returns the session cookie parameters.

Output
array containing items: lifetime, path, domain, secure, httponly

line 536

getHttpRequest

protected IHttpRequest getHttpRequest ()

Output
IHttpRequest  

line 546

getHttpResponse

protected IHttpResponse getHttpResponse ()

Output
IHttpResponse  

line 275

getId

public string getId ()

Returns the current session ID. Don't make dependencies, can be changed for each request.

Output
string  

line 349

getIterator

public ArrayIterator getIterator ()

Iteration over all namespaces.

Output
ArrayIterator  

line 310

getNamespace

public SessionNamespace getNamespace (string $namespace, [string $class = 'SessionNamespace'])

Returns specified session namespace.

Input
string $namespace
string $class
Output
SessionNamespace  
Throws
throws InvalidArgumentException

line 334

hasNamespace

public bool hasNamespace (string $namespace)

Checks if a session namespace exist and is not empty.

Input
string $namespace
Output
bool  

line 174

isStarted

public bool isStarted ()

Has been session started?

Output
bool  

line 232

regenerateId

public void regenerateId ()

Regenerates the session ID.

Output
void  
Throws
throws InvalidStateException

line 494

setCookieParams

public void setCookieParams (string $path, [string $domain = NULL], [bool $secure = NULL])

Sets the session cookie parameters.

Input
string $path path
string $domain domain
bool $secure secure
Output
void  

line 466

setExpiration

public void setExpiration (int $seconds)

Sets the amount of time allowed between requests before the session will be terminated.

Input
int $seconds number of seconds, value 0 means "until the browser is closed"
Output
void  

line 256

setId

public void setId (string $id)

Sets the session ID to a specified one.

Input
string $id
Output
void  
Throws
throws InvalidStateException
Tags
Deprecated

line 520

setSavePath

public void setSavePath ($path)

Sets path of the directory used to save session data.

Input
$path
Output
void  

line 90

start

public void start ()

Starts and initializes session data.

Output
void  
Throws
throws InvalidStateException