Class HttpLayoutRequestHandler

Version: 21.x

Supports making requests to the Sitecore layout service.

Inheritance
System.Object
HttpLayoutRequestHandler
Namespace: Sitecore.LayoutService.Client.RequestHandlers
Assembly: Sitecore.LayoutService.Client.dll
Syntax
RequestResponse
public class HttpLayoutRequestHandler : Object, ILayoutRequestHandler

Constructors

HttpLayoutRequestHandler(HttpClient, ISitecoreLayoutSerializer, IOptionsSnapshot<HttpLayoutRequestHandlerOptions>, ILogger<HttpLayoutRequestHandler>)

Initializes a new instance of the HttpLayoutRequestHandler class.

Declaration
RequestResponse
public HttpLayoutRequestHandler(HttpClient client, ISitecoreLayoutSerializer serializer, IOptionsSnapshot<HttpLayoutRequestHandlerOptions> options, ILogger<HttpLayoutRequestHandler> logger)
Parameters
TypeNameDescription
System.Net.Http.HttpClientclient

The System.Net.Http.HttpClient to handle requests.

ISitecoreLayoutSerializerserializer

The serializer to handle response data.

Microsoft.Extensions.Options.IOptionsSnapshot<HttpLayoutRequestHandlerOptions>options

An Microsoft.Extensions.Options.IOptionsSnapshot<> to access specific options for this instance.

Microsoft.Extensions.Logging.ILogger<HttpLayoutRequestHandler>logger

The Microsoft.Extensions.Logging.ILogger to use for logging.

Methods

BuildMessage(SitecoreLayoutRequest, HttpLayoutRequestHandlerOptions)

Build a new System.Net.Http.HttpRequestMessage using the layout request and handler options provided.

Declaration
RequestResponse
protected virtual HttpRequestMessage BuildMessage(SitecoreLayoutRequest request, HttpLayoutRequestHandlerOptions options)
Parameters
Returns
TypeDescription
System.Net.Http.HttpRequestMessage

A configured System.Net.Http.HttpRequestMessage.

GetResponseAsync(HttpRequestMessage)

Get the System.Net.Http.HttpResponseMessage returned by the provided URI.

Declaration
RequestResponse
protected virtual Task<HttpResponseMessage> GetResponseAsync(HttpRequestMessage message)
Parameters
TypeNameDescription
System.Net.Http.HttpRequestMessagemessage

The System.Net.Http.HttpRequestMessage to be sent to the provided URI.

Returns
TypeDescription
System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>

A System.Net.Http.HttpResponseMessage.

Request(SitecoreLayoutRequest, String)

Handles a request to the Sitecore layout service using the specified handler.

Declaration
RequestResponse
public Task<SitecoreLayoutResponse> Request(SitecoreLayoutRequest request, string handlerName)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The request details.

System.StringhandlerName

The name of the request handler to use to handle the request.

Returns
TypeDescription
System.Threading.Tasks.Task<SitecoreLayoutResponse>

The response of the request.

Implements

Do you have some feedback for us?

If you have suggestions for improving this article,