Package net.jadler
Class Request.Builder
- java.lang.Object
-
- net.jadler.Request.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Request.Builderbody(byte[] body)Sets the request body.Requestbuild()Request.Builderencoding(Charset encoding)Sets the request encoding.Request.Builderheader(String name, String value)Adds a request header to the constructed request instance.Request.Builderheaders(KeyValues headers)Sets the request headers (all previously defined headers will be lost).Request.Buildermethod(String method)Sets the request method.Request.BuilderrequestURI(URI requestURI)Sets the request URI.
-
-
-
Method Detail
-
method
public Request.Builder method(String method)
Sets the request method. Must be called beforebuild().- Parameters:
method- request method- Returns:
- this builder
-
requestURI
public Request.Builder requestURI(URI requestURI)
Sets the request URI. Must be called beforebuild().- Parameters:
requestURI- request URI- Returns:
- this builder
-
body
public Request.Builder body(byte[] body)
Sets the request body. If not called, an empty body will be used.- Parameters:
body- request body (cannot benull)- Returns:
- this builder
-
headers
public Request.Builder headers(KeyValues headers)
Sets the request headers (all previously defined headers will be lost).- Parameters:
headers- request headers (cannot benull)- Returns:
- this builder
-
header
public Request.Builder header(String name, String value)
Adds a request header to the constructed request instance.- Parameters:
name- header name (cannot be empty)value- header value (cannot benull)- Returns:
- this builder
-
encoding
public Request.Builder encoding(Charset encoding)
Sets the request encoding. If not setnullvalue will be used signalizing no encoding was set in the incoming request (using theContent-Typeheader)- Parameters:
encoding- request encoding (can benull)- Returns:
- this builder
-
-