Package com.luciad.net.http
Class HttpResponse.Builder
java.lang.Object
com.luciad.net.http.HttpResponse.Builder
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
HttpResponse
Builder for the HttpResponse class.
Instances of HttpRequest.Builder are created by calling HttpResponse#newBuilder.
- Since:
- 2023.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbody(DataEntity body) Sets the HTTP response content.build()Returns anHttpResponsebased on the properties set on this builder.voidclose()protected voidfinalize()header(HttpHeader header) Sets the given http header to the set of headers for this response.Sets the given name value pair to the set of headers for this response.statusCode(int statusCode) Sets the status code of the HTTP response.
-
Constructor Details
-
Builder
-
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
build
Returns anHttpResponsebased on the properties set on this builder.- Returns:
- an
HttpResponse. - Throws:
IllegalStateException- if the status code for this response has not been set.
-
statusCode
Sets the status code of the HTTP response.This parameter is mandatory. If it is not set,
HttpResponse.Builder#buildwill throw an exception.- Parameters:
statusCode- the status code for this response.- Returns:
- this builder.
-
body
Sets the HTTP response content.This parameter is optional.
- Parameters:
body- the response content.- Returns:
- this builder.
-
header
Sets the given name value pair to the set of headers for this response.- Parameters:
name- header namevalue- header value- Returns:
- this builder.
-
header
Sets the given http header to the set of headers for this response.- Parameters:
header- anHttpHeader.- Returns:
- this builder.
-