Class HttpLayoutRequestHandler

Version: 21.x

Supports making requests to the Sitecore layout service.

Inheritance

System.Object

HttpLayoutRequestHandler

Implements

ILayoutRequestHandler

Namespace: Sitecore.LayoutService.Client.RequestHandlers

Assembly: Sitecore.LayoutService.Client.dll
Syntax
public class HttpLayoutRequestHandler : Object, ILayoutRequestHandler

Constructors

HttpLayoutRequestHandler(HttpClient, ISitecoreLayoutSerializer, IOptionsSnapshot, ILogger)

Initializes a new instance of the HttpLayoutRequestHandler class.

Declaration
public HttpLayoutRequestHandler(HttpClient client, ISitecoreLayoutSerializer serializer, IOptionsSnapshot<HttpLayoutRequestHandlerOptions> options, ILogger<HttpLayoutRequestHandler> logger)
Parameters
TypeNameDescription
System.Net.Http.HttpClientclientThe System.Net.Http.HttpClient to handle requests.
ISitecoreLayoutSerializerserializerThe serializer to handle response data.
Microsoft.Extensions.Options.IOptionsSnapshot

<

HttpLayoutRequestHandlerOptions

>
optionsAn Microsoft.Extensions.Options.IOptionsSnapshot<> to access specific options for this instance.
Microsoft.Extensions.Logging.ILogger

<

HttpLayoutRequestHandler

>
loggerThe 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
protected virtual HttpRequestMessage BuildMessage(SitecoreLayoutRequest request, HttpLayoutRequestHandlerOptions options)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe SitecoreLayoutRequest.
HttpLayoutRequestHandlerOptionsoptionsThe HttpLayoutRequestHandlerOptions.
Returns
TypeDescription
System.Net.Http.HttpRequestMessageA configured System.Net.Http.HttpRequestMessage.

GetResponseAsync(HttpRequestMessage)

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

Declaration
protected virtual Task<HttpResponseMessage> GetResponseAsync(HttpRequestMessage message)
Parameters
TypeNameDescription
System.Net.Http.HttpRequestMessagemessageThe 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
public Task<SitecoreLayoutResponse> Request(SitecoreLayoutRequest request, string handlerName)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe request details.
System.StringhandlerNameThe name of the request handler to use to handle the request.
Returns
TypeDescription
System.Threading.Tasks.Task

<

SitecoreLayoutResponse

>
The response of the request.

Implements

ILayoutRequestHandler

If you have suggestions for improving this article, let us know!