Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public class MockRequestBuilder

  1. Object
  2. MockRequestBuilder

Known subtypesMockMultipartRequestBuilder

One request for MockMvc, built by MockMvcRequestBuilders.

Methods

public MockRequestBuilder header(String name, Object... values)Adds a header; several values are sent as one comma-separated field.
public MockRequestBuilder param(String name, String... values)Adds a request parameter: a query parameter, which @RequestParam reads.
public MockRequestBuilder queryParam(String name, String... values)Adds a query parameter: the same as param, except on a multipart builder, whose param() adds a form field instead and whose queryParam() still puts the value in the URL.
public MockRequestBuilder content(String body)The body, as UTF-8 text.
public MockRequestBuilder content(byte[] body)The body, as bytes.
public MockRequestBuilder contentType(String type)The Content-Type header.
public MockRequestBuilder accept(String... types)The Accept header.
public MockRequestBuilder cookie(String name, String value)A cookie, sent in the Cookie header.
public MockRequestBuilder with(RequestPostProcessor postProcessor)Applies postProcessor to the request when it is sent: who it is from, a CSRF token, credentials.
public MockRequestBuilder characterEncoding(String encoding)Accepted for familiarity; bodies are always UTF-8 here.

Inherited methods

Method details

header

public MockRequestBuilder header(String name, Object... values)
Adds a header; several values are sent as one comma-separated field.

param

public MockRequestBuilder param(String name, String... values)
Adds a request parameter: a query parameter, which @RequestParam reads.

queryParam

public MockRequestBuilder queryParam(String name, String... values)
Adds a query parameter: the same as param, except on a multipart builder, whose param() adds a form field instead and whose queryParam() still puts the value in the URL.

content

public MockRequestBuilder content(String body)
The body, as UTF-8 text.

content

public MockRequestBuilder content(byte[] body)
The body, as bytes.

contentType

public MockRequestBuilder contentType(String type)
The Content-Type header.

accept

public MockRequestBuilder accept(String... types)
The Accept header.

cookie

public MockRequestBuilder cookie(String name, String value)
A cookie, sent in the Cookie header.

with

public MockRequestBuilder with(RequestPostProcessor postProcessor)
Applies postProcessor to the request when it is sent: who it is from, a CSRF token, credentials. See SecurityMockMvcRequestPostProcessors.

characterEncoding

public MockRequestBuilder characterEncoding(String encoding)
Accepted for familiarity; bodies are always UTF-8 here.