Class HttpLayoutRequestHandlerBuilderExtensions
Extension methods to support configuration of layout service request handler services.
Inheritance
Namespace: Sitecore.LayoutService.Client.Extensions
Assembly: Sitecore.LayoutService.Client.dll
Syntax
public static class HttpLayoutRequestHandlerBuilderExtensions : ObjectMethods
AddHttpHandler(ISitecoreLayoutClientBuilder, String, Action<IServiceProvider, HttpClient>)
Registers a HTTP request handler for the Sitecore layout service client.
Declaration
public static ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> AddHttpHandler(this ISitecoreLayoutClientBuilder builder, string handlerName, Action<IServiceProvider, HttpClient> configure)Parameters
| Type | Name | Description |
|---|---|---|
| ISitecoreLayoutClientBuilder | builder |
The ISitecoreLayoutClientBuilder to configure. |
| System.String | handlerName |
The name of the request handler being registered. |
| System.Action<System.IServiceProvider, System.Net.Http.HttpClient> | configure |
An action to configure the System.Net.Http.HttpClient. |
Returns
| Type | Description |
|---|---|
| ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> |
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained. |
AddHttpHandler(ISitecoreLayoutClientBuilder, String, Action<HttpClient>)
Registers a HTTP request handler for the Sitecore layout service client.
Declaration
public static ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> AddHttpHandler(this ISitecoreLayoutClientBuilder builder, string handlerName, Action<HttpClient> configure)Parameters
| Type | Name | Description |
|---|---|---|
| ISitecoreLayoutClientBuilder | builder |
The ISitecoreLayoutClientBuilder to configure. |
| System.String | handlerName |
The name of the request handler being registered. |
| System.Action<System.Net.Http.HttpClient> | configure |
An action to configure the System.Net.Http.HttpClient. |
Returns
| Type | Description |
|---|---|
| ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> |
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained. |
AddHttpHandler(ISitecoreLayoutClientBuilder, String, Func<IServiceProvider, HttpClient>)
Registers a HTTP request handler for the Sitecore layout service client.
Declaration
public static ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> AddHttpHandler(this ISitecoreLayoutClientBuilder builder, string handlerName, Func<IServiceProvider, HttpClient> resolveClient)Parameters
| Type | Name | Description |
|---|---|---|
| ISitecoreLayoutClientBuilder | builder |
The ISitecoreLayoutClientBuilder to configure. |
| System.String | handlerName |
The name of the request handler being registered. |
| System.Func<System.IServiceProvider, System.Net.Http.HttpClient> | resolveClient |
A function to resolve the System.Net.Http.HttpClient to be used. Be aware, that the the underlying System.Net.Http.HttpMessageHandler associated to the HttpClient will be reused across multiple sessions. To prevent data, leaking among sessions, make sure Cookies are not cached. See for reference https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-3.1#cookies . |
Returns
| Type | Description |
|---|---|
| ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> |
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained. |
AddHttpHandler(ISitecoreLayoutClientBuilder, String, Func<IServiceProvider, HttpClient>, String[])
Registers a HTTP request handler for the Sitecore layout service client.
Declaration
public static ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> AddHttpHandler(this ISitecoreLayoutClientBuilder builder, string handlerName, Func<IServiceProvider, HttpClient> resolveClient, string[] nonValidatedHeaders)Parameters
| Type | Name | Description |
|---|---|---|
| ISitecoreLayoutClientBuilder | builder |
The ISitecoreLayoutClientBuilder to configure. |
| System.String | handlerName |
The name of the request handler being registered. |
| System.Func<System.IServiceProvider, System.Net.Http.HttpClient> | resolveClient |
A function to resolve the System.Net.Http.HttpClient to be used. Be aware, that the the underlying System.Net.Http.HttpMessageHandler associated to the HttpClient will be reused across multiple sessions. To prevent data, leaking among sessions, make sure Cookies are not cached. See for reference https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-3.1#cookies . |
| System.String[] | nonValidatedHeaders |
The list of headers which should not be validated. |
Returns
| Type | Description |
|---|---|
| ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> |
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained. |
AddHttpHandler(ISitecoreLayoutClientBuilder, String, String)
Registers a HTTP request handler for the Sitecore layout service client.
Declaration
public static ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> AddHttpHandler(this ISitecoreLayoutClientBuilder builder, string handlerName, string uri)Parameters
| Type | Name | Description |
|---|---|---|
| ISitecoreLayoutClientBuilder | builder |
The ISitecoreLayoutClientBuilder to configure. |
| System.String | handlerName |
The name of the request handler being registered. |
| System.String | uri |
The System.Uri used for the System.Net.Http.HttpClient.BaseAddress. |
Returns
| Type | Description |
|---|---|
| ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> |
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained. |
AddHttpHandler(ISitecoreLayoutClientBuilder, String, Uri)
Registers a HTTP request handler for the Sitecore layout service client.
Declaration
public static ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> AddHttpHandler(this ISitecoreLayoutClientBuilder builder, string handlerName, Uri uri)Parameters
| Type | Name | Description |
|---|---|---|
| ISitecoreLayoutClientBuilder | builder |
The ISitecoreLayoutClientBuilder to configure. |
| System.String | handlerName |
The name of the request handler being registered. |
| System.Uri | uri |
The System.Uri used for the System.Net.Http.HttpClient.BaseAddress. |
Returns
| Type | Description |
|---|---|
| ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> |
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained. |
ConfigureRequest(ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler>, String[])
Adds default configuration for the HTTP request message.
Declaration
public static ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> ConfigureRequest(this ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> httpHandlerBuilder, string[] nonValidatedHeaders)Parameters
| Type | Name | Description |
|---|---|---|
| ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> | httpHandlerBuilder |
The ILayoutRequestHandlerBuilder<THandler> to configure. |
| System.String[] | nonValidatedHeaders |
The list of headers which should not be validated. |
Returns
| Type | Description |
|---|---|
| ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> |
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained. |
MapFromRequest(ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler>, Action<SitecoreLayoutRequest, HttpRequestMessage>)
Registers a System.Net.Http.HttpRequestMessage configuration action as named HttpLayoutRequestHandlerOptions for the given handler.
Declaration
public static ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> MapFromRequest(this ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> builder, Action<SitecoreLayoutRequest, HttpRequestMessage> configureHttpRequestMessage)Parameters
| Type | Name | Description |
|---|---|---|
| ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> | builder |
The ILayoutRequestHandlerBuilder<THandler> to configure. |
| System.Action<SitecoreLayoutRequest, System.Net.Http.HttpRequestMessage> | configureHttpRequestMessage |
The System.Net.Http.HttpRequestMessage configuration based on SitecoreLayoutRequest. |
Returns
| Type | Description |
|---|---|
| ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> |
The configured ILayoutRequestHandlerBuilder<THandler>. |