LuciadCPillar 2026.0.09
Loading...
Searching...
No Matches
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
 Move constructor.
 Builder (const Builder &other)
 Copy constructor.
 ~Builder ()
Builderbody (DataEntity body)
 Sets the HTTP response content.
HttpResponse build () const
 Returns an luciad::HttpResponse based on the properties set on this builder.
Builderheader (HttpHeader header)
 Sets the given http header to the set of headers for this response.
Builderheader (std::string name, std::string value)
 Sets the given name value pair to the set of headers for this response.
BuilderstatusCode (int32_t statusCode)
 Sets the status code of the HTTP response.

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)

Copy constructor.

Parameters
otherthe builder to copy.

◆ Builder() [2/2]

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

Move constructor.

Parameters
otherthe builder to move from.

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.