net.sf.ooweb.http
Class ResponseState

java.lang.Object
  extended by net.sf.ooweb.http.ResponseState

public class ResponseState
extends java.lang.Object

ResponseState can be returned by any controller method in order to have the framework set cookies, update or invalidate a session and take advantage of the inbuilt templating support (depending on the version of Ooweb in use)

Since:
0.7
Author:
Darren Davison

Constructor Summary
ResponseState()
           
 
Method Summary
 void addCookie(Cookie cookie)
           
 void addCookie(java.lang.String name, java.lang.String value)
          convenience cookie creation method that uses default values for the expires, path, secure and domain values
 void deleteCookie(java.lang.String cookieName)
           
 java.util.List<java.lang.Object> getBody()
           
 java.util.List<Cookie> getCookies()
           
 java.lang.String getMimeType()
           
 java.lang.String getNextLocation()
           
 int getNumCookies()
           
 void invalidateSession()
          deletes the session cookie from the next response - effectively invalidating the session
 boolean isRedirect()
           
 void sendRedirect(java.lang.String nextLocation)
          creates a response that instructs the client to request a new page from the site
 void setBody(java.lang.Object body)
          adds to the list of body sections that will eventually be streamed as a whole
 void setMimeType(java.lang.String mimeType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResponseState

public ResponseState()
Method Detail

addCookie

public void addCookie(Cookie cookie)
Parameters:
cookie - the cookie to add to the outgoing response

addCookie

public void addCookie(java.lang.String name,
                      java.lang.String value)
convenience cookie creation method that uses default values for the expires, path, secure and domain values

Parameters:
name - the name of the cookie to add
value - the value of the cookie to place in the response

deleteCookie

public void deleteCookie(java.lang.String cookieName)
Parameters:
cookieName - the name of the cookie to remove from the client

invalidateSession

public void invalidateSession()
deletes the session cookie from the next response - effectively invalidating the session


setBody

public void setBody(java.lang.Object body)
adds to the list of body sections that will eventually be streamed as a whole

Parameters:
body - the output of the response

setMimeType

public void setMimeType(java.lang.String mimeType)
Parameters:
mimeType - override the default mime type of the response

sendRedirect

public void sendRedirect(java.lang.String nextLocation)
creates a response that instructs the client to request a new page from the site

Parameters:
nextLocation - the URL to request. Should be fully qualified

getBody

public java.util.List<java.lang.Object> getBody()
Returns:
the response about to be sent

getMimeType

public java.lang.String getMimeType()
Returns:
the response mime type

getNumCookies

public int getNumCookies()
Returns:
how many cookies are going to be set in the response

getCookies

public java.util.List<Cookie> getCookies()
Returns:
all cookies in the response

getNextLocation

public java.lang.String getNextLocation()
Returns:
the redirect url if specified

isRedirect

public boolean isRedirect()
Returns:
true if a redirect will occur, false otherwise


Copyright (C) 2005-2007 OOWeb Authors.