Top Description Fields Constructors Methods
org.springframework.web.multipart.support

public Class RequestPartServletServerHttpRequest

extends ServletServerHttpRequest
Class Inheritance
Imports
java.io.ByteArrayInputStream, .IOException, .InputStream, java.nio.charset.Charset, jakarta.servlet.http.HttpServletRequest, .Part, org.springframework.http.HttpHeaders, .MediaType, org.springframework.http.server.ServerHttpRequest, .ServletServerHttpRequest, org.springframework.lang.Nullable, org.springframework.web.multipart.MultipartException, .MultipartFile, .MultipartHttpServletRequest, .MultipartResolver

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 multipart processing the part is accessed through ServletRequest.getPart.
Authors
Rossen Stoyanchev, Juergen Hoeller
Since
3.1

Field Summary

Modifier and TypeField and Description
private final HttpHeaders
private final MultipartHttpServletRequest
private final String
Inherited from org.springframework.http.server.ServletServerHttpRequest:
FORM_CHARSET

Constructor Summary

AccessConstructor and Description
public
RequestPartServletServerHttpRequest(HttpServletRequest
the current servlet request
request
,
String
the name of the part to adapt to the ServerHttpRequest contract
requestPartName
)

Create a new RequestPartServletServerHttpRequest instance.

Method Summary

Modifier and TypeMethod and Description
private Charset
public InputStream
public HttpHeaders
private Part
Inherited from org.springframework.http.server.ServletServerHttpRequest:
getAsyncRequestControlgetLocalAddressgetMethodgetPrincipalgetRemoteAddressgetServletRequestgetURIinitURI

Field Detail

multipartHeadersback to summary
private final HttpHeaders multipartHeaders
multipartRequestback to summary
private final MultipartHttpServletRequest multipartRequest
requestPartNameback to summary
private final String requestPartName

Constructor Detail

RequestPartServletServerHttpRequestback to summary
public RequestPartServletServerHttpRequest(HttpServletRequest request, String requestPartName) throws MissingServletRequestPartException

Create a new RequestPartServletServerHttpRequest instance.

Parameters
request:HttpServletRequest

the current servlet request

requestPartName:String

the name of the part to adapt to the ServerHttpRequest contract

Exceptions
MissingServletRequestPartException:
if the request part cannot be found
MultipartException:
if MultipartHttpServletRequest cannot be initialized

Method Detail

determineCharsetback to summary
private Charset determineCharset()
getBodyback to summary
public InputStream getBody() throws IOException

Overrides org.springframework.http.server.ServletServerHttpRequest.getBody.

Implements org.springframework.http.HttpInputMessage.getBody.

Doc from org.springframework.http.HttpInputMessage.getBody.

Return the body of the message as an input stream.

Returns:InputStream

the input stream body (never null)

Annotations
@Override
Exceptions
IOException:
in case of I/O errors
getHeadersback to summary
public HttpHeaders getHeaders()

Overrides org.springframework.http.server.ServletServerHttpRequest.getHeaders.

Implements org.springframework.http.HttpMessage.getHeaders.

Doc from org.springframework.http.HttpMessage.getHeaders.

Return the headers of this message.

Returns:HttpHeaders

a corresponding HttpHeaders object (never null)

Annotations
@Override
retrieveServletPartback to summary
private Part retrieveServletPart()
Annotations
@Nullable