org.mentawai.core
Class ResponseOutput

java.lang.Object
  extended by org.mentawai.core.ResponseOutput
All Implemented Interfaces:
Map<String,Object>, Output

public class ResponseOutput
extends Object
implements Output, Map<String,Object>

A simple Output implementation backed up by a java.util.HashMap. This class also implements the java.util.Map interface so it can be used with JSP Expression Language. This class wraps the HttpServletResponse but does not use it. You may access it through the getResponse() method. Most of map operations are not supported.

Author:
Sergio Oliveira

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
ResponseOutput(javax.servlet.http.HttpServletResponse res)
           
 
Method Summary
 String add(Object value)
          Add an object with a auto generated key.
 void clear()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Set<Map.Entry<String,Object>> entrySet()
           
 Object get(Object key)
           
 javax.servlet.http.HttpServletResponse getResponse()
           
 Object getValue(String name)
          Gets an output value by name.
 boolean has(String name)
          Check if the output has this key.
 boolean isEmpty()
          Returns true is this output has no values.
 Iterator<String> keys()
          Gets an iterator with the names of each output value.
 Set<String> keySet()
           
 Object put(String key, Object value)
           
 void putAll(Map<? extends String,? extends Object> t)
           
 Object remove(Object key)
           
 void removeValue(String name)
          Removes an output value by name.
 void setObject(Object bean)
          Sets the properties of the given bean in the action output, in other words, extract all attributes from the given object and place them in the action output.
 void setObject(Object bean, String prefix)
          Sets the properties of the given bean in the action output, in other words, extract all attributes from the given object and place them in the action output.
 void setValue(String name, Object value)
          Sets an output value by name.
 int size()
           
 String toString()
           
 Collection<Object> values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

ResponseOutput

public ResponseOutput(javax.servlet.http.HttpServletResponse res)
Method Detail

getResponse

public javax.servlet.http.HttpServletResponse getResponse()

setValue

public void setValue(String name,
                     Object value)
Description copied from interface: Output
Sets an output value by name.

Specified by:
setValue in interface Output
Parameters:
name - The name of the value
value - The value

has

public boolean has(String name)
Description copied from interface: Output
Check if the output has this key.

Specified by:
has in interface Output
Returns:
boolean

add

public String add(Object value)
Description copied from interface: Output
Add an object with a auto generated key. This can be used when you don't care about the key, for example for streams.

Specified by:
add in interface Output
Returns:
The key used to add this object to the output.

getValue

public Object getValue(String name)
Description copied from interface: Output
Gets an output value by name.

Specified by:
getValue in interface Output
Parameters:
name - The name of the value
Returns:
The value or null if it does not exist

removeValue

public void removeValue(String name)
Description copied from interface: Output
Removes an output value by name.

Specified by:
removeValue in interface Output
Parameters:
name - The name of the value

isEmpty

public boolean isEmpty()
Description copied from interface: Output
Returns true is this output has no values.

Specified by:
isEmpty in interface Map<String,Object>
Specified by:
isEmpty in interface Output
Returns:
true if this output has no values

setObject

public void setObject(Object bean)
Description copied from interface: Output
Sets the properties of the given bean in the action output, in other words, extract all attributes from the given object and place them in the action output.

Specified by:
setObject in interface Output
Parameters:
bean - The bean (object) from where to get the properties.

setObject

public void setObject(Object bean,
                      String prefix)
Description copied from interface: Output
Sets the properties of the given bean in the action output, in other words, extract all attributes from the given object and place them in the action output. Use the given prefix when placing in the output.

Specified by:
setObject in interface Output
Parameters:
bean - The bean (object) from where to get the properties.
prefix - The prefix to use when placing the properties in the output.

toString

public String toString()
Overrides:
toString in class Object

keys

public Iterator<String> keys()
Description copied from interface: Output
Gets an iterator with the names of each output value.

Specified by:
keys in interface Output
Returns:
An iterator with all the names

clear

public void clear()
Specified by:
clear in interface Map<String,Object>

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<String,Object>

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map<String,Object>

entrySet

public Set<Map.Entry<String,Object>> entrySet()
Specified by:
entrySet in interface Map<String,Object>

get

public Object get(Object key)
Specified by:
get in interface Map<String,Object>

keySet

public Set<String> keySet()
Specified by:
keySet in interface Map<String,Object>

put

public Object put(String key,
                  Object value)
Specified by:
put in interface Map<String,Object>

putAll

public void putAll(Map<? extends String,? extends Object> t)
Specified by:
putAll in interface Map<String,Object>

remove

public Object remove(Object key)
Specified by:
remove in interface Map<String,Object>

size

public int size()
Specified by:
size in interface Map<String,Object>

values

public Collection<Object> values()
Specified by:
values in interface Map<String,Object>


Copyright © 2013. All Rights Reserved.