com.scooterframework.web.controller
Class DefaultContentHandler

java.lang.Object
  extended by com.scooterframework.web.controller.DefaultContentHandler
All Implemented Interfaces:
ContentHandler

public class DefaultContentHandler
extends java.lang.Object
implements ContentHandler

DefaultContentHandler is responsible for handling content of a request format when the specific handler for the format is not available.

The content for the following request format is treated as text: json, txt, text, and xml.


Constructor Summary
DefaultContentHandler()
           
 
Method Summary
protected  java.lang.String convertActiveRecordToString(ActiveRecord record, java.lang.String format)
           
protected
<K,V> java.lang.String
convertMapToString(java.util.Map<K,V> map, java.lang.String format)
           
protected  java.lang.String convertObjectToString(java.lang.Object data, java.lang.String format)
           
 void handle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object content, java.lang.String format)
          Handles result content of a HTTP request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultContentHandler

public DefaultContentHandler()
Method Detail

handle

public void handle(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response,
                   java.lang.Object content,
                   java.lang.String format)
            throws java.io.IOException,
                   javax.servlet.ServletException
Handles result content of a HTTP request.

Specified by:
handle in interface ContentHandler
Parameters:
request - The HTTP request object.
response - The HTTP response object.
content - The content to be sent.
format - The request format.
Throws:
java.io.IOException
javax.servlet.ServletException

convertObjectToString

protected java.lang.String convertObjectToString(java.lang.Object data,
                                                 java.lang.String format)

convertMapToString

protected <K,V> java.lang.String convertMapToString(java.util.Map<K,V> map,
                                                    java.lang.String format)

convertActiveRecordToString

protected java.lang.String convertActiveRecordToString(ActiveRecord record,
                                                       java.lang.String format)