Class AbstractContentTypeHandler

java.lang.Object
org.apache.struts2.rest.handler.AbstractContentTypeHandler
All Implemented Interfaces:
ContentTypeHandler
Direct Known Subclasses:
FormUrlEncodedHandler, HtmlHandler, JacksonJsonHandler, JacksonXmlHandler, JuneauXmlHandler, MultipartFormDataHandler, XStreamHandler

public abstract class AbstractContentTypeHandler extends Object implements ContentTypeHandler
  • Constructor Details

    • AbstractContentTypeHandler

      public AbstractContentTypeHandler()
  • Method Details

    • toObject

      public void toObject(Reader in, Object target) throws IOException
      Description copied from interface: ContentTypeHandler
      Populates an object using data from the input stream
      Specified by:
      toObject in interface ContentTypeHandler
      Parameters:
      in - The input stream, usually the body of the request
      target - The target, usually the action class
      Throws:
      IOException - If unable to write to the output stream
    • fromObject

      public String fromObject(Object obj, String resultCode, Writer stream) throws IOException
      Description copied from interface: ContentTypeHandler
      Writes content to the stream
      Specified by:
      fromObject in interface ContentTypeHandler
      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:
      IOException - If unable to write to the output stream