Unosquare
    Show / Hide Table of Contents

    Interface IHttpContext

    Represents the context of a HTTP(s) request being handled by a web server.

    Inherited Members
    IMimeTypeProvider.GetMimeType(String)
    IMimeTypeProvider.TryDetermineCompression(String, Boolean)
    Namespace: EmbedIO
    Syntax
    public interface IHttpContext : IMimeTypeProvider

    Properties

    Age

    Gets the elapsed time, expressed in milliseconds, since the creation of this context.

    Declaration
    long Age { get; }
    Property Value
    Type Description
    Int64

    CancellationToken

    Gets a CancellationToken used to stop processing of this context.

    Declaration
    CancellationToken CancellationToken { get; }
    Property Value
    Type Description
    CancellationToken

    Id

    Gets a unique identifier for a HTTP context.

    Declaration
    string Id { get; }
    Property Value
    Type Description
    String

    IsHandled

    Gets a value indicating whether this IHttpContext has been completely handled, so that no further processing is required.

    When a HTTP context is created, this property is false; as soon as it is set to true, the context is not passed to any further module's handler for processing.

    Once it becomes true, this property is guaranteed to never become false again.

    Declaration
    bool IsHandled { get; }
    Property Value
    Type Description
    Boolean
    Remarks

    When a module's IsFinalHandler property is true, this property is set to true after the returned by the module's HandleRequestAsync(IHttpContext) method is completed.

    See Also
    SetHandled()
    IsFinalHandler

    Items

    Gets the dictionary of data to pass trough the EmbedIO pipeline.

    Declaration
    IDictionary<object, object> Items { get; }
    Property Value
    Type Description
    IDictionary<Object, Object>

    LocalEndPoint

    Gets the server IP address and port number to which the request is directed.

    Declaration
    IPEndPoint LocalEndPoint { get; }
    Property Value
    Type Description
    IPEndPoint

    RemoteEndPoint

    Gets the client IP address and port number from which the request originated.

    Declaration
    IPEndPoint RemoteEndPoint { get; }
    Property Value
    Type Description
    IPEndPoint

    Request

    Gets the HTTP request.

    Declaration
    IHttpRequest Request { get; }
    Property Value
    Type Description
    IHttpRequest

    RequestedPath

    Gets the requested path, relative to the innermost module's base path.

    Declaration
    string RequestedPath { get; }
    Property Value
    Type Description
    String
    Remarks

    This property derives from the path specified in the requested URL, stripped of the BaseRoute of the handling module.

    This property is in itself a valid URL path, including an initial slash (/) character.

    Response

    Gets the HTTP response object.

    Declaration
    IHttpResponse Response { get; }
    Property Value
    Type Description
    IHttpResponse

    Route

    Gets the route matched by the requested URL path.

    Declaration
    RouteMatch Route { get; }
    Property Value
    Type Description
    RouteMatch

    Session

    Gets the session proxy associated with this context.

    Declaration
    ISessionProxy Session { get; }
    Property Value
    Type Description
    ISessionProxy

    SupportCompressedRequests

    Gets a value indicating whether compressed request bodies are supported.

    Declaration
    bool SupportCompressedRequests { get; }
    Property Value
    Type Description
    Boolean
    See Also
    SupportCompressedRequests

    User

    Gets the user.

    Declaration
    IPrincipal User { get; }
    Property Value
    Type Description
    IPrincipal

    Methods

    OnClose(Action<IHttpContext>)

    Registers a callback to be called when processing is finished on a context.

    Declaration
    void OnClose(Action<IHttpContext> callback)
    Parameters
    Type Name Description
    Action<IHttpContext> callback

    The callback.

    SetHandled()

    Marks this context as handled, so that it will not be processed by any further module.

    Declaration
    void SetHandled()
    Remarks

    Calling this method from the HandleRequestAsync(IHttpContext) or OnRequestAsync(IHttpContext) of a module whose IsFinalHandler property is true is redundant and has no effect.

    See Also
    IsHandled
    IsFinalHandler

    Comments

    Back to top Copyright © 2017-2019 Unosquare