org.apache.struts2.rest
Interface ContentTypeHandlerManager

All Known Implementing Classes:
DefaultContentTypeHandlerManager

public interface ContentTypeHandlerManager

Manages content type handlers


Field Summary
static java.lang.String STRUTS_REST_HANDLER_OVERRIDE_PREFIX
           
 
Method Summary
 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 request content type and extension
 ContentTypeHandler getHandlerForResponse(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Gets the handler for the response by looking at the extension of the request
 java.lang.String handleResult(ActionConfig actionConfig, java.lang.Object methodResult, java.lang.Object target)
          Handles the result using handlers to generate content type-specific content
 

Field Detail

STRUTS_REST_HANDLER_OVERRIDE_PREFIX

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

getHandlerForRequest

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

Parameters:
req - The request
Returns:
The appropriate handler

getHandlerForResponse

ContentTypeHandler getHandlerForResponse(javax.servlet.http.HttpServletRequest req,
                                         javax.servlet.http.HttpServletResponse res)
Gets the handler for the response by looking at the extension of the request

Parameters:
req - The request
Returns:
The appropriate handler

handleResult

java.lang.String handleResult(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

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

Parameters:
url - The url
Returns:
The extension


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