org.apache.struts2.rest.handler

## 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 Summary

    Constructors
    Constructor and Description
    `AbstractContentTypeHandler()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `fromObject(Object obj, String resultCode, Writer stream)` Writes content to the stream
    `void` | `toObject(Reader in, Object target)` Populates an object using data from the input stream

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.struts2.rest.handler.ContentTypeHandler

      `fromObject, getContentType, getExtension, toObject`

- - ### Constructor Detail

    - #### AbstractContentTypeHandler

          public AbstractContentTypeHandler()

  - ### Method Detail

    - #### 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

Copyright © 2000–2026 Apache Software Foundation. All rights reserved.