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
ServerHttpRequestimplementation that accesses one part of a multipart request. If usingMultipartResolverconfiguration the part is accessed through aMultipartFile. Or if using Servlet 3.0 multipart processing the part is accessed throughServletRequest.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 Description RequestPartServletServerHttpRequest(HttpServletRequest request, String requestPartName)Create a newRequestPartServletServerHttpRequestinstance.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamgetBody()Return the body of the message as an input stream.HttpHeadersgetHeaders()Return the headers of this message.Methods inherited from class org.springframework.http.server.ServletServerHttpRequest
getAsyncRequestControl, getLocalAddress, getMethod, getMethodValue, getPrincipal, getRemoteAddress, getServletRequest, getURI
Constructor Detail
RequestPartServletServerHttpRequest
public RequestPartServletServerHttpRequest(HttpServletRequest request, String requestPartName) throws MissingServletRequestPartException
Create a newRequestPartServletServerHttpRequestinstance.- Parameters:
request- the current servlet requestrequestPartName- the name of the part to adapt to theServerHttpRequestcontract- Throws:
MissingServletRequestPartException- if the request part cannot be foundMultipartException- if MultipartHttpServletRequest cannot be initialized
Method Detail
getHeaders
public HttpHeaders getHeaders()
Description copied from interface:HttpMessageReturn the headers of this message.- Specified by:
getHeadersin interfaceHttpMessage- Overrides:
getHeadersin classServletServerHttpRequest- Returns:
- a corresponding HttpHeaders object (never
null)
getBody
public InputStream getBody() throws IOException
Description copied from interface:HttpInputMessageReturn the body of the message as an input stream.- Specified by:
getBodyin interfaceHttpInputMessage- Overrides:
getBodyin classServletServerHttpRequest- Returns:
- the input stream body (never
null) - Throws:
IOException- in case of I/O errors