ninja.session
Class SessionCookieImpl

java.lang.Object
  extended by ninja.session.SessionCookieImpl
All Implemented Interfaces:
SessionCookie

public class SessionCookieImpl
extends Object
implements SessionCookie

Session Cookie... Mostly an adaption of Play1's excellent cookie system that in turn is based on the new client side rails cookies.


Constructor Summary
SessionCookieImpl(Crypto crypto, NinjaProperties ninjaProperties)
           
 
Method Summary
 void clear()
           
 String get(String key)
          Returns the value of the key or null.
 String getAuthenticityToken()
           
 Map<String,String> getData()
           
 String getId()
           
 void init(Context context)
          Has to be called initially. => maybe in the future as assisted inject.
 boolean isEmpty()
          Returns true if the session is empty, e.g. does not contain anything else than the timestamp key.
 void put(String key, String value)
          Puts key into session.
 String remove(String key)
          Removes the value of the key and returns the value or null.
 void save(Context context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionCookieImpl

@Inject
public SessionCookieImpl(Crypto crypto,
                                NinjaProperties ninjaProperties)
Method Detail

init

public void init(Context context)
Has to be called initially. => maybe in the future as assisted inject.

Specified by:
init in interface SessionCookie
Parameters:
context -

getId

public String getId()
Specified by:
getId in interface SessionCookie
Returns:
id of a session.

getData

public Map<String,String> getData()
Specified by:
getData in interface SessionCookie
Returns:
complete content of session.

getAuthenticityToken

public String getAuthenticityToken()
Specified by:
getAuthenticityToken in interface SessionCookie
Returns:
an authenticity token or generates a new one.

save

public void save(Context context)
Specified by:
save in interface SessionCookie

put

public void put(String key,
                String value)
Puts key into session. PLEASE NOTICE: If value == null the key will be removed!

Specified by:
put in interface SessionCookie
Parameters:
key -
value -

get

public String get(String key)
Returns the value of the key or null.

Specified by:
get in interface SessionCookie
Parameters:
key -
Returns:

remove

public String remove(String key)
Description copied from interface: SessionCookie
Removes the value of the key and returns the value or null.

Specified by:
remove in interface SessionCookie
Returns:

clear

public void clear()
Specified by:
clear in interface SessionCookie

isEmpty

public boolean isEmpty()
Returns true if the session is empty, e.g. does not contain anything else than the timestamp key.

Specified by:
isEmpty in interface SessionCookie


Copyright © 2012. All Rights Reserved.