org.apache.struts2.rest.handler
Interface ContentTypeHandler

All Known Implementing Classes:
FormUrlEncodedHandler, HtmlHandler, JsonLibHandler, MultipartFormDataHandler, XStreamHandler

public interface ContentTypeHandler

Handles transferring content to and from objects for a specific content type


Method Summary
 java.lang.String fromObject(java.lang.Object obj, java.lang.String resultCode, java.io.Writer stream)
          Writes content to the stream
 java.lang.String getContentType()
          Gets the content type for this handler
 java.lang.String getExtension()
          Gets the extension this handler supports
 void toObject(java.io.Reader in, java.lang.Object target)
          Populates an object using data from the input stream
 

Method Detail

toObject

void toObject(java.io.Reader in,
              java.lang.Object target)
              throws java.io.IOException
Populates an object using data from the input stream

Parameters:
in - The input stream, usually the body of the request
target - The target, usually the action class
Throws:
java.io.IOException

fromObject

java.lang.String fromObject(java.lang.Object obj,
                            java.lang.String resultCode,
                            java.io.Writer stream)
                            throws java.io.IOException
Writes content to the stream

Parameters:
obj - The object to write to the stream, usually the Action class
resultCode - The original result code
stream - The output stream, usually the response
Returns:
The new result code
Throws:
java.io.IOException - If unable to write to the output stream

getContentType

java.lang.String getContentType()
Gets the content type for this handler

Returns:
The mime type

getExtension

java.lang.String getExtension()
Gets the extension this handler supports

Returns:
The extension


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.