org.apache.struts2.rest.handler

## Interface ContentTypeHandler

- All Known Implementing Classes:
    AbstractContentTypeHandler, FormUrlEncodedHandler, HtmlHandler, JacksonJsonHandler, JacksonXmlHandler, JuneauXmlHandler, MultipartFormDataHandler, XStreamHandler

      public interface ContentTypeHandler

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

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `fromObject(ActionInvocation invocation, Object obj, String resultCode, Writer stream)`
    `String` | `fromObject(Object obj, String resultCode, Writer stream)` Deprecated. use version which requires `ActionInvocation`
    `String` | `getContentType()` Gets the content type for this handler
    `String` | `getExtension()` Gets the extension this handler supports
    `void` | `toObject(ActionInvocation invocation, Reader in, Object target)`
    `void` | `toObject(Reader in, Object target)` Deprecated. use version which requires `ActionInvocation`

- - ### Method Detail

    - #### toObject

          @Deprecated
          void toObject(Reader in,
                                    Object target)
                             throws IOException

      Deprecated. use version which requires `ActionInvocation`
      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:
        `IOException` - If unable to write to the output stream

    - #### toObject

          void toObject(ActionInvocation invocation,
                        Reader in,
                        Object target)
                 throws IOException

      Throws:
        `IOException`

    - #### fromObject

          @Deprecated
          String fromObject(Object obj,
                                        String resultCode,
                                        Writer stream)
                                 throws IOException

      Deprecated. use version which requires `ActionInvocation`
      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:
        `IOException` - If unable to write to the output stream

    - #### fromObject

          String fromObject(ActionInvocation invocation,
                            Object obj,
                            String resultCode,
                            Writer stream)
                     throws IOException

      Throws:
        `IOException`

    - #### getContentType

          String getContentType()

      Gets the content type for this handler
      Returns:
        The mime type

    - #### getExtension

          String getExtension()

      Gets the extension this handler supports
      Returns:
        The extension

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