LuciadCPillar 2024.0.08
luciad::HttpResponse::Builder Class Referencefinal

Builder for the luciad::HttpResponse class. More...

#include <luciad/net/http/HttpResponse.h>

Public Member Functions

 Builder (Builder &&other) noexcept
 
 Builder (const Builder &other)
 
 ~Builder ()
 
Builderbody (DataEntity body)
 Sets the HTTP response content. More...
 
HttpResponse build () const
 Returns an luciad::HttpResponse based on the properties set on this builder. More...
 
Builderheader (HttpHeader header)
 Sets the given http header to the set of headers for this response. More...
 
Builderheader (std::string name, std::string value)
 Sets the given name value pair to the set of headers for this response. More...
 
BuilderstatusCode (int32_t statusCode)
 Sets the status code of the HTTP response. More...
 

Detailed Description

Builder for the luciad::HttpResponse class.

Instances of HttpRequest::Builder are created by calling luciad::HttpResponse::newBuilder.

Since
2023.0

Constructor & Destructor Documentation

◆ ~Builder()

luciad::HttpResponse::Builder::~Builder ( )

◆ Builder() [1/2]

luciad::HttpResponse::Builder::Builder ( const Builder other)

◆ Builder() [2/2]

luciad::HttpResponse::Builder::Builder ( Builder &&  other)
noexcept

Member Function Documentation

◆ body()

Builder & luciad::HttpResponse::Builder::body ( DataEntity  body)

Sets the HTTP response content.

This parameter is optional.

Parameters
bodythe response content.
Returns
this builder.

◆ build()

HttpResponse luciad::HttpResponse::Builder::build ( ) const

Returns an luciad::HttpResponse based on the properties set on this builder.

Returns
an luciad::HttpResponse.
Exceptions
luciad::LogicExceptionif the status code for this response has not been set.

◆ header() [1/2]

Builder & luciad::HttpResponse::Builder::header ( HttpHeader  header)

Sets the given http header to the set of headers for this response.

Parameters
headeran luciad::HttpHeader.
Returns
this builder.

◆ header() [2/2]

Builder & luciad::HttpResponse::Builder::header ( std::string  name,
std::string  value 
)

Sets the given name value pair to the set of headers for this response.

Parameters
nameheader name
valueheader value
Returns
this builder.

◆ statusCode()

Builder & luciad::HttpResponse::Builder::statusCode ( int32_t  statusCode)

Sets the status code of the HTTP response.

This parameter is mandatory. If it is not set, HttpResponse::Builder::build will throw an exception.

Parameters
statusCodethe status code for this response.
Returns
this builder.