类 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 MockHttpServletRequestcreateServletRequest(ServletContext servletContext)Create a newMockMultipartHttpServletRequestbased on the suppliedServletContextand theMockMultipartFilesadded to this builder.MockMultipartHttpServletRequestBuilderfile(String name, byte[] content)Create a new MockMultipartFile with the given content.MockMultipartHttpServletRequestBuilderfile(MockMultipartFile file)Add the given MockMultipartFile.Objectmerge(Object parent)Merges the properties of the "parent" RequestBuilder accepting values only if not already set in "this" instance.MockMultipartHttpServletRequestBuilderpart(Part... parts)AddPartcomponents 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)
AddPartcomponents to the request.- 参数:
parts- one or more parts to add- 从以下版本开始:
- 5.0
merge
public Object merge(@Nullable Object parent)
从类复制的说明:MockHttpServletRequestBuilderMerges the properties of the "parent" RequestBuilder accepting values only if not already set in "this" instance.- 指定者:
merge在接口中Mergeable- 覆盖:
merge在类中MockHttpServletRequestBuilder- 参数:
parent- the parentRequestBuilderto inherit properties from- 返回:
- the result of the merge
createServletRequest
protected final MockHttpServletRequest createServletRequest(ServletContext servletContext)
Create a newMockMultipartHttpServletRequestbased on the suppliedServletContextand theMockMultipartFilesadded to this builder.