wicket.protocol.http
Class MockHttpSession

java.lang.Object
  extended by wicket.protocol.http.MockHttpSession
All Implemented Interfaces:
java.io.Serializable, javax.servlet.http.HttpSession

public class MockHttpSession
extends java.lang.Object
implements javax.servlet.http.HttpSession, java.io.Serializable

Mock implementation of the WebSession interface for use by the test harnesses.

Author:
Chris Turner
See Also:
Serialized Form

Constructor Summary
MockHttpSession(javax.servlet.ServletContext context)
          Create the session.
 
Method Summary
 java.lang.Object getAttribute(java.lang.String name)
          Get the attribute with the given name.
 java.util.Enumeration getAttributeNames()
          Get the names of the attributes in the session.
 long getCreationTime()
          Get the creation time of the session.
 java.lang.String getId()
          Return the id of this session.
 long getLastAccessedTime()
          Get the time the session was last accessed.
 int getMaxInactiveInterval()
          NOT USED.
 javax.servlet.ServletContext getServletContext()
          Return the servlet context for the session.
 javax.servlet.http.HttpSessionContext getSessionContext()
          Deprecated.  
 java.lang.Object getValue(java.lang.String name)
          Deprecated. use getAttribute(String) instead
 java.lang.String[] getValueNames()
          Deprecated. use getAttributeNames() instead
 void invalidate()
          Invalidate the session.
 boolean isNew()
          Check if the session is new.
 void putValue(java.lang.String name, java.lang.Object o)
          Deprecated. Use setAttribute(String, Object) instead
 void removeAttribute(java.lang.String name)
          Remove an attribute.
 void removeValue(java.lang.String name)
          Deprecated. Use removeAttribute(String) instead
 void setAttribute(java.lang.String name, java.lang.Object o)
          Set an attribute.
 void setMaxInactiveInterval(int i)
          NOT USED.
 void timestamp()
          Set the last accessed time for the session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockHttpSession

public MockHttpSession(javax.servlet.ServletContext context)
Create the session.

Parameters:
context -
Method Detail

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Get the attribute with the given name.

Specified by:
getAttribute in interface javax.servlet.http.HttpSession
Parameters:
name - The attribute name
Returns:
The value or null

getAttributeNames

public java.util.Enumeration getAttributeNames()
Get the names of the attributes in the session.

Specified by:
getAttributeNames in interface javax.servlet.http.HttpSession
Returns:
The attribute names

getCreationTime

public long getCreationTime()
Get the creation time of the session.

Specified by:
getCreationTime in interface javax.servlet.http.HttpSession
Returns:
The creation time

getId

public java.lang.String getId()
Return the id of this session.

Specified by:
getId in interface javax.servlet.http.HttpSession
Returns:
The id

getLastAccessedTime

public long getLastAccessedTime()
Get the time the session was last accessed.

Specified by:
getLastAccessedTime in interface javax.servlet.http.HttpSession
Returns:
The last accessed time

getMaxInactiveInterval

public int getMaxInactiveInterval()
NOT USED. Sessions never expire in the test harness.

Specified by:
getMaxInactiveInterval in interface javax.servlet.http.HttpSession
Returns:
Always returns 0

getServletContext

public javax.servlet.ServletContext getServletContext()
Return the servlet context for the session.

Specified by:
getServletContext in interface javax.servlet.http.HttpSession
Returns:
The servlet context

getSessionContext

public javax.servlet.http.HttpSessionContext getSessionContext()
Deprecated. 

NOT USED.

Specified by:
getSessionContext in interface javax.servlet.http.HttpSession
Returns:
Always null

getValue

public java.lang.Object getValue(java.lang.String name)
Deprecated. use getAttribute(String) instead

Get the value for the given name.

Specified by:
getValue in interface javax.servlet.http.HttpSession
Parameters:
name - The name
Returns:
The value or null

getValueNames

public java.lang.String[] getValueNames()
Deprecated. use getAttributeNames() instead

Get the names of the values in the session.

Specified by:
getValueNames in interface javax.servlet.http.HttpSession
Returns:
The names of the attributes

invalidate

public void invalidate()
Invalidate the session.

Specified by:
invalidate in interface javax.servlet.http.HttpSession

isNew

public boolean isNew()
Check if the session is new.

Specified by:
isNew in interface javax.servlet.http.HttpSession
Returns:
Always false

putValue

public void putValue(java.lang.String name,
                     java.lang.Object o)
Deprecated. Use setAttribute(String, Object) instead

Set a value.

Specified by:
putValue in interface javax.servlet.http.HttpSession
Parameters:
name - The name of the value
o - The value

removeAttribute

public void removeAttribute(java.lang.String name)
Remove an attribute.

Specified by:
removeAttribute in interface javax.servlet.http.HttpSession
Parameters:
name - The name of the attribute

removeValue

public void removeValue(java.lang.String name)
Deprecated. Use removeAttribute(String) instead

Remove a value.

Specified by:
removeValue in interface javax.servlet.http.HttpSession
Parameters:
name - The name of the value

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object o)
Set an attribute.

Specified by:
setAttribute in interface javax.servlet.http.HttpSession
Parameters:
name - The name of the attribute to set
o - The value to set

setMaxInactiveInterval

public void setMaxInactiveInterval(int i)
NOT USED. Sessions never expire in the test harness.

Specified by:
setMaxInactiveInterval in interface javax.servlet.http.HttpSession
Parameters:
i - The value

timestamp

public void timestamp()
Set the last accessed time for the session.



Copyright © 2004-2007 Wicket developers. All Rights Reserved.