Class RestDocumentationRequestBuilders
java.lang.Object
org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders
A drop-in replacement for 
MockMvcRequestBuilders that captures a request's URL
template and makes it available for documentation. Required when
) documenting path parameters and recommended for general usage.- Author:
 - Andy Wilkinson
 - See Also:
 
- 
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.test.web.servlet.request.MockHttpServletRequestBuilderCreate aMockHttpServletRequestBuilderfor a DELETE request.static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilderCreate aMockHttpServletRequestBuilderfor a DELETE request.static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilderCreate aMockHttpServletRequestBuilderfor a GET request.static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilderCreate aMockHttpServletRequestBuilderfor a GET request.static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilderCreate aMockHttpServletRequestBuilderfor a HEAD request.static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilderCreate aMockHttpServletRequestBuilderfor a HEAD request.static org.springframework.test.web.servlet.request.MockMultipartHttpServletRequestBuilderCreate aMockMultipartHttpServletRequestBuilderfor a multipart request.static org.springframework.test.web.servlet.request.MockMultipartHttpServletRequestBuilderCreate aMockMultipartHttpServletRequestBuilderfor a multipart request.static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilderCreate aMockHttpServletRequestBuilderfor an OPTIONS request.static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilderCreate aMockHttpServletRequestBuilderfor an OPTIONS request.static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilderCreate aMockHttpServletRequestBuilderfor a PATCH request.static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilderCreate aMockHttpServletRequestBuilderfor a PATCH request.static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilderCreate aMockHttpServletRequestBuilderfor a POST request.static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilderCreate aMockHttpServletRequestBuilderfor a POST request.static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilderCreate aMockHttpServletRequestBuilderfor a PUT request.static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilderCreate aMockHttpServletRequestBuilderfor a PUT request.static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilderCreate aMockHttpServletRequestBuilderfor a request with the given HTTP method.static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilderCreate aMockHttpServletRequestBuilderfor a request with the given HTTP method. 
- 
Method Details
- 
get
public static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder get(String urlTemplate, Object... urlVariables) Create aMockHttpServletRequestBuilderfor a GET request. The url template will be captured and made available for documentation.- Parameters:
 urlTemplate- a URL template; the resulting URL will be encodedurlVariables- zero or more URL variables- Returns:
 - the builder for the GET request
 
 - 
get
public static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder get(URI uri) Create aMockHttpServletRequestBuilderfor a GET request.- Parameters:
 uri- the URL- Returns:
 - the builder for the GET request
 
 - 
post
public static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder post(String urlTemplate, Object... urlVariables) Create aMockHttpServletRequestBuilderfor a POST request. The url template will be captured and made available for documentation.- Parameters:
 urlTemplate- a URL template; the resulting URL will be encodedurlVariables- zero or more URL variables- Returns:
 - the builder for the POST request
 
 - 
post
public static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder post(URI uri) Create aMockHttpServletRequestBuilderfor a POST request.- Parameters:
 uri- the URL- Returns:
 - the builder for the POST request
 
 - 
put
public static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder put(String urlTemplate, Object... urlVariables) Create aMockHttpServletRequestBuilderfor a PUT request. The url template will be captured and made available for documentation.- Parameters:
 urlTemplate- a URL template; the resulting URL will be encodedurlVariables- zero or more URL variables- Returns:
 - the builder for the PUT request
 
 - 
put
public static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder put(URI uri) Create aMockHttpServletRequestBuilderfor a PUT request.- Parameters:
 uri- the URL- Returns:
 - the builder for the PUT request
 
 - 
patch
public static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder patch(String urlTemplate, Object... urlVariables) Create aMockHttpServletRequestBuilderfor a PATCH request. The url template will be captured and made available for documentation.- Parameters:
 urlTemplate- a URL template; the resulting URL will be encodedurlVariables- zero or more URL variables- Returns:
 - the builder for the PATCH request
 
 - 
patch
public static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder patch(URI uri) Create aMockHttpServletRequestBuilderfor a PATCH request.- Parameters:
 uri- the URL- Returns:
 - the builder for the PATCH request
 
 - 
delete
public static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder delete(String urlTemplate, Object... urlVariables) Create aMockHttpServletRequestBuilderfor a DELETE request. The url template will be captured and made available for documentation.- Parameters:
 urlTemplate- a URL template; the resulting URL will be encodedurlVariables- zero or more URL variables- Returns:
 - the builder for the DELETE request
 
 - 
delete
public static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder delete(URI uri) Create aMockHttpServletRequestBuilderfor a DELETE request.- Parameters:
 uri- the URL- Returns:
 - the builder for the DELETE request
 
 - 
options
public static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder options(String urlTemplate, Object... urlVariables) Create aMockHttpServletRequestBuilderfor an OPTIONS request. The url template will be captured and made available for documentation.- Parameters:
 urlTemplate- a URL template; the resulting URL will be encodedurlVariables- zero or more URL variables- Returns:
 - the builder for the OPTIONS request
 
 - 
options
public static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder options(URI uri) Create aMockHttpServletRequestBuilderfor an OPTIONS request.- Parameters:
 uri- the URL- Returns:
 - the builder for the OPTIONS request
 
 - 
head
public static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder head(String urlTemplate, Object... urlVariables) Create aMockHttpServletRequestBuilderfor a HEAD request. The url template will be captured and made available for documentation.- Parameters:
 urlTemplate- a URL template; the resulting URL will be encodedurlVariables- zero or more URL variables- Returns:
 - the builder for the HEAD request
 
 - 
head
public static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder head(URI uri) Create aMockHttpServletRequestBuilderfor a HEAD request.- Parameters:
 uri- the URL- Returns:
 - the builder for the HEAD request
 
 - 
request
public static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder request(org.springframework.http.HttpMethod httpMethod, String urlTemplate, Object... urlVariables) Create aMockHttpServletRequestBuilderfor a request with the given HTTP method. The url template will be captured and made available for documentation.- Parameters:
 httpMethod- the HTTP methodurlTemplate- a URL template; the resulting URL will be encodedurlVariables- zero or more URL variables- Returns:
 - the builder for the request
 
 - 
request
public static org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder request(org.springframework.http.HttpMethod httpMethod, URI uri) Create aMockHttpServletRequestBuilderfor a request with the given HTTP method.- Parameters:
 httpMethod- the HTTP method (GET, POST, etc)uri- the URL- Returns:
 - the builder for the request
 
 - 
multipart
public static org.springframework.test.web.servlet.request.MockMultipartHttpServletRequestBuilder multipart(String urlTemplate, Object... urlVariables) Create aMockMultipartHttpServletRequestBuilderfor a multipart request. The URL template will be captured and made available for documentation.- Parameters:
 urlTemplate- a URL template; the resulting URL will be encodedurlVariables- zero or more URL variables- Returns:
 - the builder for the multipart request
 - Since:
 - 2.0.6
 
 - 
multipart
public static org.springframework.test.web.servlet.request.MockMultipartHttpServletRequestBuilder multipart(URI uri) Create aMockMultipartHttpServletRequestBuilderfor a multipart request.- Parameters:
 uri- the URL- Returns:
 - the builder for the multipart request
 - Since:
 - 2.0.6
 
 
 -