Class HttpLayoutRequestHandlerBuilderExtensions
Extension methods to support configuration of layout service request handler services.
Inheritance
System.Object
HttpLayoutRequestHandlerBuilderExtensions
Namespace: Sitecore.LayoutService.Client.Extensions
Assembly: Sitecore.LayoutService.Client.dll
Syntax
Methods
AddHttpHandler(ISitecoreLayoutClientBuilder, String, Action<IServiceProvider, HttpClient>)
Registers a HTTP request handler for the Sitecore layout service client.
Declaration
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 |
AddHttpHandler(ISitecoreLayoutClientBuilder, String, Action)
Registers a HTTP request handler for the Sitecore layout service client.
Declaration
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 |
AddHttpHandler(ISitecoreLayoutClientBuilder, String, Func<IServiceProvider, HttpClient>)
Registers a HTTP request handler for the Sitecore layout service client.
Declaration
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 |
AddHttpHandler(ISitecoreLayoutClientBuilder, String, Func<IServiceProvider, HttpClient>, String[])
Registers a HTTP request handler for the Sitecore layout service client.
Declaration
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 |
AddHttpHandler(ISitecoreLayoutClientBuilder, String, String)
Registers a HTTP request handler for the Sitecore layout service client.
Declaration
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 |
AddHttpHandler(ISitecoreLayoutClientBuilder, String, Uri)
Registers a HTTP request handler for the Sitecore layout service client.
Declaration
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 |
ConfigureRequest(ILayoutRequestHandlerBuilder, String[])
Adds default configuration for the HTTP request message.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| ILayoutRequestHandlerBuilder < HttpLayoutRequestHandler > | httpHandlerBuilder | The ILayoutRequestHandlerBuilder |
| System.String [] | nonValidatedHeaders | The list of headers which should not be validated. |
Returns
| Type | Description |
|---|---|
| ILayoutRequestHandlerBuilder < HttpLayoutRequestHandler > | The ILayoutRequestHandlerBuilder |
MapFromRequest(ILayoutRequestHandlerBuilder, Action<SitecoreLayoutRequest, HttpRequestMessage>)
Registers a System.Net.Http.HttpRequestMessage configuration action as named HttpLayoutRequestHandlerOptions for the given handler.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| ILayoutRequestHandlerBuilder < HttpLayoutRequestHandler > | builder | The ILayoutRequestHandlerBuilder |
| 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 |