org.springframework.web.multipart.support

## Class RequestPartServletServerHttpRequest

- java.lang.Object
- - org.springframework.http.server.ServletServerHttpRequest
  - - org.springframework.web.multipart.support.RequestPartServletServerHttpRequest

- All Implemented Interfaces:
    HttpInputMessage, HttpMessage, HttpRequest, ServerHttpRequest

      public class RequestPartServletServerHttpRequest
      extends ServletServerHttpRequest

  `ServerHttpRequest` implementation that accesses one part of a multipart request. If using `MultipartResolver` configuration the part is accessed through a `MultipartFile`. Or if using Servlet 3.0 multipart processing the part is accessed through `ServletRequest.getPart`.
  Since:
    3.1
  Author:
    Rossen Stoyanchev, Juergen Hoeller

- - ### Field Summary

    - ### Fields inherited from class org.springframework.http.server.ServletServerHttpRequest

      `FORM_CHARSET, FORM_CONTENT_TYPE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RequestPartServletServerHttpRequest(HttpServletRequest request, String partName)` Create a new instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `InputStream` | `getBody()` Return the body of the message as an input stream.
    `HttpHeaders` | `getHeaders()` Return the headers of this message.

    - ### Methods inherited from class org.springframework.http.server.ServletServerHttpRequest

      `getAsyncRequestControl, getLocalAddress, getMethod, getPrincipal, getRemoteAddress, getServletRequest, getURI`

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

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

- - ### Constructor Detail

    - #### RequestPartServletServerHttpRequest

          public RequestPartServletServerHttpRequest(HttpServletRequest request,
                                                     String partName)
                                              throws MissingServletRequestPartException

      Create a new instance.
      Parameters:
        `request` - the current request
        `partName` - the name of the part to adapt to the `ServerHttpRequest` contract
      Throws:
        `MissingServletRequestPartException` - if the request part cannot be found
        `IllegalArgumentException` - if MultipartHttpServletRequest cannot be initialized

  - ### Method Detail

    - #### getHeaders

          public HttpHeaders getHeaders()

      Description copied from interface: `HttpMessage`
      Return the headers of this message.
      Specified by:
        `getHeaders` in interface `HttpMessage`
      Overrides:
        `getHeaders` in class `ServletServerHttpRequest`
      Returns:
        a corresponding HttpHeaders object

    - #### getBody

          public InputStream getBody()
                              throws IOException

      Description copied from interface: `HttpInputMessage`
      Return the body of the message as an input stream.
      Specified by:
        `getBody` in interface `HttpInputMessage`
      Overrides:
        `getBody` in class `ServletServerHttpRequest`
      Returns:
        the input stream body
      Throws:
        `IOException` - in case of I/O Errors