类 MockMultipartHttpServletRequestBuilder
- java.lang.Object
- org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder
- org.springframework.test.web.servlet.request.MockMultipartHttpServletRequestBuilder
- 所有已实现的接口:
Mergeable
,ConfigurableSmartRequestBuilder<MockHttpServletRequestBuilder>
,RequestBuilder
,SmartRequestBuilder
public class MockMultipartHttpServletRequestBuilder extends MockHttpServletRequestBuilder
Default builder forMockMultipartHttpServletRequest
.- 从以下版本开始:
- 3.2
- 作者:
- Rossen Stoyanchev, Arjen Poutsma
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected MockHttpServletRequest
createServletRequest(ServletContext servletContext)
Create a newMockMultipartHttpServletRequest
based on the suppliedServletContext
and theMockMultipartFiles
added to this builder.MockMultipartHttpServletRequestBuilder
file(String name, byte[] content)
Create a new MockMultipartFile with the given content.MockMultipartHttpServletRequestBuilder
file(MockMultipartFile file)
Add the given MockMultipartFile.Object
merge(Object parent)
Merges the properties of the "parent" RequestBuilder accepting values only if not already set in "this" instance.MockMultipartHttpServletRequestBuilder
part(Part... parts)
AddPart
components to the request.从类继承的方法 org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder
accept, accept, buildRequest, characterEncoding, content, content, contentType, contentType, contextPath, cookie, flashAttr, flashAttrs, header, headers, isMergeEnabled, locale, locale, param, params, pathInfo, postProcessRequest, principal, queryParam, queryParams, requestAttr, secure, servletPath, session, sessionAttr, sessionAttrs, with
方法详细资料
file
public MockMultipartHttpServletRequestBuilder file(String name, byte[] content)
Create a new MockMultipartFile with the given content.- 参数:
name
- the name of the filecontent
- the content of the file
file
public MockMultipartHttpServletRequestBuilder file(MockMultipartFile file)
Add the given MockMultipartFile.- 参数:
file
- the multipart file
part
public MockMultipartHttpServletRequestBuilder part(Part... parts)
AddPart
components to the request.- 参数:
parts
- one or more parts to add- 从以下版本开始:
- 5.0
merge
public Object merge(@Nullable Object parent)
从类复制的说明:MockHttpServletRequestBuilder
Merges the properties of the "parent" RequestBuilder accepting values only if not already set in "this" instance.- 指定者:
merge
在接口中Mergeable
- 覆盖:
merge
在类中MockHttpServletRequestBuilder
- 参数:
parent
- the parentRequestBuilder
to inherit properties from- 返回:
- the result of the merge
createServletRequest
protected final MockHttpServletRequest createServletRequest(ServletContext servletContext)
Create a newMockMultipartHttpServletRequest
based on the suppliedServletContext
and theMockMultipartFiles
added to this builder.