C# Class org.GraphDefined.Vanaheimr.Hermod.HTTP.HTTPResponseBuilder

A read-write HTTP response header.
Inheritance: AHTTPPDUBuilder
Exibir arquivo Open project: Vanaheimr/Hermod Class Usage Examples

Public Methods

Method Description
AsImmutable ( ) : HTTPResponse

Converts this HTTPResponseBuilder into an immutable HTTPResponse.

HTTPResponseBuilder ( HTTPRequest HTTPRequest, HTTPStatusCode HTTPStatusCode = null ) : System

Create a new HTTP response.

OK ( HTTPRequest HTTPRequest, Action Configurator = null ) : HTTPResponseBuilder

Create a new 200-OK HTTP response and apply the given delegate.

OK ( HTTPRequest HTTPRequest, HTTPResponseBuilder>.Func Configurator ) : HTTPResponseBuilder

Create a new 200-OK HTTP response and apply the given delegate.

Set ( HTTPHeaderField HeaderField, Object Value ) : HTTPResponseBuilder

Set a HTTP header field. A field value of NULL will remove the field from the header.

SetCacheControl ( String CacheControl ) : HTTPResponseBuilder

Set the HTTP CacheControl.

SetConnection ( String Connection ) : HTTPResponseBuilder

Set the HTTP connection.

SetContent ( Byte ByteArray ) : HTTPResponseBuilder

The HTTP content/body.

SetContent ( Stream ContentStream ) : HTTPResponseBuilder

The HTTP content/body as a stream.

SetContent ( String String ) : HTTPResponseBuilder

The HTTP content/body.

SetContentEncoding ( Encoding ContentEncoding ) : HTTPResponseBuilder

Set the HTTP Content-Encoding.

SetContentLanguage ( List ContentLanguages ) : HTTPResponseBuilder

Set the HTTP Content-Languages.

SetContentLength ( System.UInt64 ContentLength ) : HTTPResponseBuilder

Set the HTTP Content-Length.

SetContentLocation ( String ContentLocation ) : HTTPResponseBuilder

Set the HTTP ContentLocation.

SetContentMD5 ( String ContentMD5 ) : HTTPResponseBuilder

Set the HTTP ContentMD5.

SetContentRange ( String ContentRange ) : HTTPResponseBuilder

Set the HTTP ContentRange.

SetContentType ( HTTPContentType ContentType ) : HTTPResponseBuilder

Set the HTTP Content-Type.

SetDate ( System.DateTime Date ) : HTTPResponseBuilder

Set the HTTP Date.

SetHTTPStatusCode ( HTTPStatusCode HTTPStatusCode ) : HTTPResponseBuilder

Set the HTTP status code.

SetProtocolName ( String ProtocolName ) : HTTPResponseBuilder

Set the protocol name.

SetProtocolVersion ( HTTPVersion ProtocolVersion ) : HTTPResponseBuilder

Set the protocol version.

SetVia ( String Via ) : HTTPResponseBuilder

Set the HTTP Via.

Protected Methods

Method Description
PrepareImmutability ( ) : void

Prepares the immutability of an HTTP PDU, e.g. calculates and set the Content-Length header.

Method Details

AsImmutable() public method

Converts this HTTPResponseBuilder into an immutable HTTPResponse.
public AsImmutable ( ) : HTTPResponse
return HTTPResponse

HTTPResponseBuilder() public method

Create a new HTTP response.
public HTTPResponseBuilder ( HTTPRequest HTTPRequest, HTTPStatusCode HTTPStatusCode = null ) : System
HTTPRequest HTTPRequest The HTTP request for this response.
HTTPStatusCode HTTPStatusCode A HTTP status code
return System

OK() public static method

Create a new 200-OK HTTP response and apply the given delegate.
public static OK ( HTTPRequest HTTPRequest, Action Configurator = null ) : HTTPResponseBuilder
HTTPRequest HTTPRequest
Configurator Action A delegate to configure the HTTP response.
return HTTPResponseBuilder

OK() public static method

Create a new 200-OK HTTP response and apply the given delegate.
public static OK ( HTTPRequest HTTPRequest, HTTPResponseBuilder>.Func Configurator ) : HTTPResponseBuilder
HTTPRequest HTTPRequest
Configurator HTTPResponseBuilder>.Func A delegate to configure the HTTP response.
return HTTPResponseBuilder

PrepareImmutability() protected method

Prepares the immutability of an HTTP PDU, e.g. calculates and set the Content-Length header.
protected PrepareImmutability ( ) : void
return void

Set() public method

Set a HTTP header field. A field value of NULL will remove the field from the header.
public Set ( HTTPHeaderField HeaderField, Object Value ) : HTTPResponseBuilder
HeaderField HTTPHeaderField The header field.
Value Object The value. NULL will remove the field from the header.
return HTTPResponseBuilder

SetCacheControl() public method

Set the HTTP CacheControl.
public SetCacheControl ( String CacheControl ) : HTTPResponseBuilder
CacheControl String CacheControl.
return HTTPResponseBuilder

SetConnection() public method

Set the HTTP connection.
public SetConnection ( String Connection ) : HTTPResponseBuilder
Connection String A connection.
return HTTPResponseBuilder

SetContent() public method

The HTTP content/body.
public SetContent ( Byte ByteArray ) : HTTPResponseBuilder
ByteArray Byte The HTTP content/body.
return HTTPResponseBuilder

SetContent() public method

The HTTP content/body as a stream.
public SetContent ( Stream ContentStream ) : HTTPResponseBuilder
ContentStream Stream
return HTTPResponseBuilder

SetContent() public method

The HTTP content/body.
public SetContent ( String String ) : HTTPResponseBuilder
String String The HTTP content/body.
return HTTPResponseBuilder

SetContentEncoding() public method

Set the HTTP Content-Encoding.
public SetContentEncoding ( Encoding ContentEncoding ) : HTTPResponseBuilder
ContentEncoding System.Text.Encoding The encoding of the HTTP content/body.
return HTTPResponseBuilder

SetContentLanguage() public method

Set the HTTP Content-Languages.
public SetContentLanguage ( List ContentLanguages ) : HTTPResponseBuilder
ContentLanguages List The languages of the HTTP content/body.
return HTTPResponseBuilder

SetContentLength() public method

Set the HTTP Content-Length.
public SetContentLength ( System.UInt64 ContentLength ) : HTTPResponseBuilder
ContentLength System.UInt64 The length of the HTTP content/body.
return HTTPResponseBuilder

SetContentLocation() public method

Set the HTTP ContentLocation.
public SetContentLocation ( String ContentLocation ) : HTTPResponseBuilder
ContentLocation String ContentLocation.
return HTTPResponseBuilder

SetContentMD5() public method

Set the HTTP ContentMD5.
public SetContentMD5 ( String ContentMD5 ) : HTTPResponseBuilder
ContentMD5 String ContentMD5.
return HTTPResponseBuilder

SetContentRange() public method

Set the HTTP ContentRange.
public SetContentRange ( String ContentRange ) : HTTPResponseBuilder
ContentRange String ContentRange.
return HTTPResponseBuilder

SetContentType() public method

Set the HTTP Content-Type.
public SetContentType ( HTTPContentType ContentType ) : HTTPResponseBuilder
ContentType HTTPContentType The type of the HTTP content/body.
return HTTPResponseBuilder

SetDate() public method

Set the HTTP Date.
public SetDate ( System.DateTime Date ) : HTTPResponseBuilder
Date System.DateTime DateTime.
return HTTPResponseBuilder

SetHTTPStatusCode() public method

Set the HTTP status code.
public SetHTTPStatusCode ( HTTPStatusCode HTTPStatusCode ) : HTTPResponseBuilder
HTTPStatusCode HTTPStatusCode A HTTP status code.
return HTTPResponseBuilder

SetProtocolName() public method

Set the protocol name.
public SetProtocolName ( String ProtocolName ) : HTTPResponseBuilder
ProtocolName String The protocol name.
return HTTPResponseBuilder

SetProtocolVersion() public method

Set the protocol version.
public SetProtocolVersion ( HTTPVersion ProtocolVersion ) : HTTPResponseBuilder
ProtocolVersion HTTPVersion The protocol version.
return HTTPResponseBuilder

SetVia() public method

Set the HTTP Via.
public SetVia ( String Via ) : HTTPResponseBuilder
Via String Via.
return HTTPResponseBuilder