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 34)
Public Method Summary
Session
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.
string
getId ()
Returns the current session ID. Don't make dependencies, can be changed for each request.
ArrayIterator
Iteration over all namespaces.
string
getName ()
Gets the session name.
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 ($id)
Sets the session ID to a specified one.
void
setName (string $name)
Sets the session name to a specified one.
void
setSavePath ($path)
Sets path of the directory used to save session data.
void
start ()
Starts and initializes session data.
Protected Method Summary
protected IHttpRequest
protected IHttpResponse
Methods Inherited From Object
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset()
Constant Summary
int DEFAULT_FILE_LIFETIME 10800

line 37

Default file lifetime is 3 hours
Variable Summary
callback $verificationKeyGenerator

line 40

Validation key generator

Method Details

line 73

__construct

public Session __construct ()

Output
Session  

line 396

clean

public void clean ()

Cleans and minimizes meta structures.

Output
void  

line 199

close

public void close ()

Ends the current session and store session data.

Output
void  

line 441

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 213

destroy

public void destroy ()

Destroys all data registered to a session.

Output
void  

line 234

exists

public bool exists ()

Does session exists for the current request?

Output
bool  

line 317

generateVerificationKey

public string generateVerificationKey ()

Generates key as protection against Session Hijacking & Fixation.

Output
string  

line 536

getCookieParams

public array getCookieParams ()

Returns the session cookie parameters.

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

line 576

getHttpRequest

protected IHttpRequest getHttpRequest ()

Output
IHttpRequest  

line 586

getHttpResponse

protected IHttpResponse getHttpResponse ()

Output
IHttpResponse  

line 277

getId

public string getId ()

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

Output
string  

line 376

getIterator

public ArrayIterator getIterator ()

Iteration over all namespaces.

Output
ArrayIterator  

line 306

getName

public string getName ()

Gets the session name.

Output
string  

line 341

getNamespace

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

Returns specified session namespace.

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

line 361

hasNamespace

public bool hasNamespace (string $namespace)

Checks if a session namespace exist and is not empty.

Input
string $namespace
Output
bool  

line 188

isStarted

public bool isStarted ()

Has been session started?

Output
bool  

line 246

regenerateId

public void regenerateId ()

Regenerates the session ID.

Output
void  
Throws
throws InvalidStateException

line 521

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 493

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 266

setId

public void setId ($id)

Sets the session ID to a specified one.

Input
$id
Output
void  
Tags
Deprecated

line 289

setName

public void setName (string $name)

Sets the session name to a specified one.

Input
string $name
Output
void  

line 547

setSavePath

public void setSavePath ($path)

Sets path of the directory used to save session data.

Input
$path
Output
void  

line 85

start

public void start ()

Starts and initializes session data.

Output
void  
Throws
throws InvalidStateException