Package dev.gmitch215.bytebox.net.http
Class HttpRequest.Builder
java.lang.Object
dev.gmitch215.bytebox.net.http.HttpRequest.Builder
- Enclosing class:
HttpRequest
Assembles a request.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns the request.DELETE()Returns this builder, sending a DELETE.expectContinue(boolean enable) Whether to expect a 100-continue, which the platform does not send.GET()Returns this builder, sending a GET.Adds a header, keeping any value already set.Adds headers, given as alternating names and values.method(String method, HttpRequest.BodyPublisher body) Sends a method of your own.Sends a POST.PUT(HttpRequest.BodyPublisher body) Sends a PUT.Sets a header, replacing any value already set.How long the request may take.Where to send the request.
-
Method Details
-
uri
Where to send the request.- Parameters:
uri- an absolute HTTP or HTTPS URI- Returns:
- this builder
-
setHeader
Sets a header, replacing any value already set.- Parameters:
name- the header namevalue- the value- Returns:
- this builder
-
header
Adds a header, keeping any value already set.- Parameters:
name- the header namevalue- the value- Returns:
- this builder
-
headers
Adds headers, given as alternating names and values.- Parameters:
nameAndValues- an even number of strings- Returns:
- this builder
-
timeout
How long the request may take.- Parameters:
timeout- the limit- Returns:
- this builder
-
GET
Returns this builder, sending a GET.- Returns:
- this builder, sending a GET
-
POST
Sends a POST.- Parameters:
body- the body- Returns:
- this builder
-
PUT
Sends a PUT.- Parameters:
body- the body- Returns:
- this builder
-
DELETE
Returns this builder, sending a DELETE.- Returns:
- this builder, sending a DELETE
-
method
Sends a method of your own.- Parameters:
method- the methodbody- the body, orHttpRequest.BodyPublishers.noBody()for none- Returns:
- this builder
-
expectContinue
Whether to expect a 100-continue, which the platform does not send.- Parameters:
enable- ignored- Returns:
- this builder
-
build
Returns the request.- Returns:
- the request
-