Modifier and Type | Field and Description |
---|---|
protected play.api.mvc.Request<Http.RequestBody> |
req |
Constructor and Description |
---|
RequestBuilder()
Returns a simple request builder.
|
RequestBuilder(Http.RequestBuilder copy)
Returns a request builder as copy of the passed request builder.
|
RequestBuilder(play.api.mvc.request.RequestFactory requestFactory)
Returns a simple request builder.
|
Modifier and Type | Method and Description |
---|---|
<T> Http.RequestBuilder |
attr(TypedKey<T> key,
T value)
Add an attribute to the request.
|
TypedMap |
attrs() |
Http.RequestBuilder |
attrs(TypedMap newAttrs)
Update the request attributes.
|
Http.RequestBody |
body() |
protected Http.RequestBuilder |
body(Http.RequestBody body)
Set the body of the request.
|
protected Http.RequestBuilder |
body(Http.RequestBody body,
String contentType)
Set the body of the request.
|
Http.RequestBuilder |
bodyForm(Map<String,String> data)
Set a Form url encoded body to this request.
|
Http.RequestBuilder |
bodyFormArrayValues(Map<String,String[]> data)
Set a Form url encoded body to this request.
|
Http.RequestBuilder |
bodyJson(com.fasterxml.jackson.databind.JsonNode node)
Set a Json Body to this request.
|
Http.RequestBuilder |
bodyJson(play.api.libs.json.JsValue json)
Set a Json Body to this request.
|
Http.RequestBuilder |
bodyMultipart(List<Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>> data,
Files.TemporaryFileCreator temporaryFileCreator,
akka.stream.Materializer mat)
Deprecated.
Deprecated as of 2.7.0. Renamed to
bodyRaw(List,
Files.TemporaryFileCreator, Materializer) . |
Http.RequestBuilder |
bodyMultipart(Map<String,String[]> formData,
List<Http.MultipartFormData.FilePart> files)
Set a Multipart Form url encoded body to this request.
|
Http.RequestBuilder |
bodyRaw(byte[] data)
Set a Binary Data to this request using a singleton temporary file creator.
|
Http.RequestBuilder |
bodyRaw(byte[] data,
Files.TemporaryFileCreator tempFileCreator)
Set a Binary Data to this request.
|
Http.RequestBuilder |
bodyRaw(akka.util.ByteString data)
Set a Binary Data to this request using a singleton temp file creator The
Content-Type header of the request is set to application/octet-stream . |
Http.RequestBuilder |
bodyRaw(akka.util.ByteString data,
Files.TemporaryFileCreator tempFileCreator)
Set a Binary Data to this request.
|
Http.RequestBuilder |
bodyRaw(List<Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>> data,
Files.TemporaryFileCreator temporaryFileCreator,
akka.stream.Materializer mat)
Set a Multipart Form url encoded body to this request saving it as a raw body.
|
Http.RequestBuilder |
bodyText(String text)
Set a Text to this request.
|
Http.RequestBuilder |
bodyText(String text,
Charset charset)
Set a Text to this request.
|
Http.RequestBuilder |
bodyXml(Document xml)
Set a XML to this request.
|
Http.RequestBuilder |
bodyXml(InputSource xml)
Set a XML to this request.
|
Http.RequestImpl |
build()
Builds the request.
|
Optional<List<X509Certificate>> |
clientCertificateChain() |
Http.RequestBuilder |
clientCertificateChain(List<X509Certificate> clientCertificateChain) |
Http.RequestBuilder |
cookie(Http.Cookie cookie)
Sets one cookie.
|
Http.Cookies |
cookies() |
Map<String,String> |
flash() |
Http.RequestBuilder |
flash(Map<String,String> data)
Sets cookies in a request.
|
Http.RequestBuilder |
flash(String key,
String value)
Sets a cookie in the request.
|
Http.Headers |
getHeaders() |
Http.RequestBuilder |
header(String key,
List<String> values) |
Http.RequestBuilder |
header(String key,
String value) |
Http.RequestBuilder |
headers(Http.Headers headers)
Set the headers to be used by the request builder.
|
String |
host() |
Http.RequestBuilder |
host(String host) |
Long |
id() |
Http.RequestBuilder |
id(Long id) |
Http.RequestBuilder |
langCookie(Lang lang,
MessagesApi messagesApi)
Sets given lang in a cookie.
|
Http.RequestBuilder |
langCookie(Locale locale,
MessagesApi messagesApi)
Sets given lang in a cookie.
|
String |
method() |
Http.RequestBuilder |
method(String method) |
String |
path() |
Http.RequestBuilder |
path(String path)
This method sets the path of the uri.
|
String |
remoteAddress() |
Http.RequestBuilder |
remoteAddress(String remoteAddress) |
boolean |
secure() |
Http.RequestBuilder |
secure(boolean secure) |
Map<String,String> |
session() |
Http.RequestBuilder |
session(Map<String,String> data)
Sets all parameters for the session.
|
Http.RequestBuilder |
session(String key,
String value)
Sets a session.
|
Http.RequestBuilder |
transientLang(Lang lang)
Sets the transient language.
|
Http.RequestBuilder |
transientLang(Locale locale)
Sets the transient language.
|
Http.RequestBuilder |
transientLang(String code)
Deprecated.
Deprecated as of 2.8.0 Use
transientLang(Lang) instead. |
String |
uri() |
Http.RequestBuilder |
uri(String str)
Sets the uri.
|
Http.RequestBuilder |
uri(URI uri) |
String |
version() |
Http.RequestBuilder |
version(String version) |
Http.RequestBuilder |
withoutTransientLang()
Removes the transient language.
|
protected play.api.mvc.Request<Http.RequestBody> req
public RequestBuilder()
public RequestBuilder(Http.RequestBuilder copy)
public RequestBuilder(play.api.mvc.request.RequestFactory requestFactory)
requestFactory
- the incoming request factorypublic Http.RequestBody body()
protected Http.RequestBuilder body(Http.RequestBody body, String contentType)
body
- the bodycontentType
- Content-Type header valueprotected Http.RequestBuilder body(Http.RequestBody body)
body
- The body.public Http.RequestBuilder bodyRaw(akka.util.ByteString data)
Content-Type
header of the request is set to application/octet-stream
.data
- the Binary Datapublic Http.RequestBuilder bodyRaw(akka.util.ByteString data, Files.TemporaryFileCreator tempFileCreator)
Content-Type
header of the request is set to
application/octet-stream
.data
- the Binary DatatempFileCreator
- the temporary file creator for binary data.public Http.RequestBuilder bodyRaw(byte[] data)
Content-Type
header of the request is set to application/octet-stream
.data
- the Binary Datapublic Http.RequestBuilder bodyRaw(byte[] data, Files.TemporaryFileCreator tempFileCreator)
Content-Type
header of the request is set to
application/octet-stream
.data
- the Binary DatatempFileCreator
- the temporary file creator for binary data.public Http.RequestBuilder bodyFormArrayValues(Map<String,String[]> data)
data
- the x-www-form-urlencoded parameterspublic Http.RequestBuilder bodyForm(Map<String,String> data)
data
- the x-www-form-urlencoded parameters@Deprecated public Http.RequestBuilder bodyMultipart(List<Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>> data, Files.TemporaryFileCreator temporaryFileCreator, akka.stream.Materializer mat)
bodyRaw(List,
Files.TemporaryFileCreator, Materializer)
.data
- the multipart-form parameterstemporaryFileCreator
- the temporary file creator.mat
- a Akka Streams Materializerpublic Http.RequestBuilder bodyRaw(List<Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>> data, Files.TemporaryFileCreator temporaryFileCreator, akka.stream.Materializer mat)
data
- the multipart-form parameterstemporaryFileCreator
- the temporary file creator.mat
- a Akka Streams Materializerpublic Http.RequestBuilder bodyMultipart(Map<String,String[]> formData, List<Http.MultipartFormData.FilePart> files)
formData
- the URL form-encoded data partfiles
- the files partpublic Http.RequestBuilder bodyJson(com.fasterxml.jackson.databind.JsonNode node)
Content-Type
header of the request is set to
application/json
.node
- the Json Nodepublic Http.RequestBuilder bodyJson(play.api.libs.json.JsValue json)
Content-Type
header of the request is set to
application/json
.json
- the JsValuepublic Http.RequestBuilder bodyXml(InputSource xml)
Content-Type
header of the request is set to application/xml
.xml
- the XMLpublic Http.RequestBuilder bodyXml(Document xml)
The Content-Type
header of the request is set to application/xml
.
xml
- the XMLpublic Http.RequestBuilder bodyText(String text)
Content-Type
header of the request is set to text/plain
.text
- the text, assumed to be encoded in US_ASCII format, per
https://tools.ietf.org/html/rfc6657#section-4public Http.RequestBuilder bodyText(String text, Charset charset)
Content-Type
header of the request is set to text/plain; charset=$charset
.text
- the text, which is assumed to be already encoded in the format defined by
charset.charset
- the character set that the request is encoded in.public Http.RequestImpl build()
public Long id()
public Http.RequestBuilder id(Long id)
id
- the id to be usedpublic <T> Http.RequestBuilder attr(TypedKey<T> key, T value)
T
- The type of the attribute to add.key
- The key of the attribute to add.value
- The value of the attribute to add.public Http.RequestBuilder attrs(TypedMap newAttrs)
newAttrs
- The attribute entries to add.public TypedMap attrs()
public String method()
public Http.RequestBuilder method(String method)
method
- sets the methodpublic String uri()
public Http.RequestBuilder uri(URI uri)
public Http.RequestBuilder uri(String str)
str
- the uripublic Http.RequestBuilder secure(boolean secure)
secure
- true if the request is securepublic boolean secure()
public String host()
public Http.RequestBuilder host(String host)
host
- sets the host in the headerpublic String path()
public Http.RequestBuilder path(String path)
path
- the path after the port and for the query in a uripublic String version()
public Http.RequestBuilder version(String version)
version
- the versionpublic Http.Headers getHeaders()
public Http.RequestBuilder headers(Http.Headers headers)
headers
- the headers to be replacedpublic Http.RequestBuilder header(String key, List<String> values)
key
- the key for in the headervalues
- the values associated with the keypublic Http.RequestBuilder header(String key, String value)
key
- the key for in the headervalue
- the value (one) associated with the keypublic Http.Cookies cookies()
public Http.RequestBuilder cookie(Http.Cookie cookie)
cookie
- the cookie to be setpublic Http.RequestBuilder flash(String key, String value)
key
- the key for the cookievalue
- the value for the cookiepublic Http.RequestBuilder flash(Map<String,String> data)
data
- a key value mapping of cookiespublic Http.RequestBuilder session(String key, String value)
key
- the key for the sessionvalue
- the value associated with the key for the sessionpublic Http.RequestBuilder session(Map<String,String> data)
data
- a key value mapping of the session datapublic String remoteAddress()
public Http.RequestBuilder remoteAddress(String remoteAddress)
remoteAddress
- sets the remote addresspublic Optional<List<X509Certificate>> clientCertificateChain()
public Http.RequestBuilder clientCertificateChain(List<X509Certificate> clientCertificateChain)
clientCertificateChain
- sets the X509Certificates to usepublic Http.RequestBuilder langCookie(Lang lang, MessagesApi messagesApi)
lang
- The language to use.public Http.RequestBuilder langCookie(Locale locale, MessagesApi messagesApi)
locale
- The language to use.public Http.RequestBuilder transientLang(Lang lang)
lang
- The language to use.@Deprecated public Http.RequestBuilder transientLang(String code)
transientLang(Lang)
instead.code
- The language to use.public Http.RequestBuilder transientLang(Locale locale)
locale
- The language to use.public Http.RequestBuilder withoutTransientLang()