org.apache.struts2.rest
Class ContentTypeHandlerManager

java.lang.Object
  extended by org.apache.struts2.rest.ContentTypeHandlerManager

public class ContentTypeHandlerManager
extends java.lang.Object

Manages ContentTypeHandler instances and uses them to process results


Field Summary
static java.lang.String STRUTS_REST_HANDLER_OVERRIDE_PREFIX
           
 
Constructor Summary
ContentTypeHandlerManager()
           
 
Method Summary
protected  java.lang.String findExtension(java.lang.String url)
          Finds the extension in the url
 ContentTypeHandler getHandlerForRequest(javax.servlet.http.HttpServletRequest req)
          Gets the handler for the request by looking at the extension
 java.lang.String handleResult(com.opensymphony.xwork2.config.entities.ActionConfig actionConfig, java.lang.Object methodResult, java.lang.Object target)
          Handles the result using handlers to generate content type-specific content
 void setContainer(com.opensymphony.xwork2.inject.Container container)
           
 void setDefaultExtension(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRUTS_REST_HANDLER_OVERRIDE_PREFIX

public static final java.lang.String STRUTS_REST_HANDLER_OVERRIDE_PREFIX
See Also:
Constant Field Values
Constructor Detail

ContentTypeHandlerManager

public ContentTypeHandlerManager()
Method Detail

setDefaultExtension

public void setDefaultExtension(java.lang.String name)

setContainer

public void setContainer(com.opensymphony.xwork2.inject.Container container)

getHandlerForRequest

public ContentTypeHandler getHandlerForRequest(javax.servlet.http.HttpServletRequest req)
Gets the handler for the request by looking at the extension

Parameters:
req - The request
Returns:
The appropriate handler

handleResult

public java.lang.String handleResult(com.opensymphony.xwork2.config.entities.ActionConfig actionConfig,
                                     java.lang.Object methodResult,
                                     java.lang.Object target)
                              throws java.io.IOException
Handles the result using handlers to generate content type-specific content

Parameters:
actionConfig - The action config for the current request
methodResult - The object returned from the action method
target - The object to return, usually the action object
Returns:
The new result code to process
Throws:
java.io.IOException - If unable to write to the response

findExtension

protected java.lang.String findExtension(java.lang.String url)
Finds the extension in the url

Parameters:
url - The url
Returns:
The extension


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