Class ModuleGroup
Groups modules under a common base URL path.
The BaseModuleGroup
is relative to the
ModuleGroup
's Base
new ModuleGroup("/download")
.WithStaticFilesAt("/docs", "/var/my/documents");
files contained in the /var/my/documents
folder will be
available to clients under the /download/docs/
URL.
Implements
Inherited Members
Namespace: EmbedIO
Syntax
public class ModuleGroup : WebModuleBase, IWebModuleImpl, IWebModule, IDisposable, IWebModuleContainer, IMimeTypeCustomizer, IMimeTypeProvider
Constructors
ModuleGroup(String, Boolean)
Initializes a new instance of the Module
Declaration
public ModuleGroup(string baseRoute, bool isFinalHandler)
Parameters
Type | Name | Description |
---|---|---|
String | baseRoute | The base route served by this module. |
Boolean | isFinalHandler | The value to set the Is |
See Also
Properties
IsFinalHandler
Gets a value indicating whether processing of a request should stop after a module has handled it.
Declaration
public override sealed bool IsFinalHandler { get; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
Remarks
If this property is true, a HTTP context's
Set
See Also
Modules
Gets the modules.
Declaration
public IComponentCollection<IWebModule> Modules { get; }
Property Value
Type | Description |
---|---|
IComponent |
The modules. |
SharedItems
Gets a dictionary of data shared among the modules in a container.
This API mainly supports the EmbedIO infrastructure; it is not intended to be used directly from your code, unless to address specific needs in module development.
Declaration
public ConcurrentDictionary<object, object> SharedItems { get; }
Property Value
Methods
AddCustomMimeType(String, String)
Adds a custom association between a file extension and a MIME type.
Declaration
public void AddCustomMimeType(string extension, string mimeType)
Parameters
Type | Name | Description |
---|---|---|
String | extension | The file extension to associate to |
String | mimeType | The MIME type to associate to |
Dispose()
Declaration
public void Dispose()
Dispose(Boolean)
Releases unmanaged and - optionally - managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Finalize()
Finalizes an instance of the Module
Declaration
protected void Finalize()
GetMimeType(String)
Gets the MIME type associated to a file extension.
Declaration
public string GetMimeType(string extension)
Parameters
Type | Name | Description |
---|---|---|
String | extension | The file extension for which a corresponding MIME type is wanted. |
Returns
Type | Description |
---|---|
String | The MIME type corresponding to |
OnBeforeLockConfiguration()
Declaration
protected override void OnBeforeLockConfiguration()
OnRequestAsync(IHttpContext)
Called to handle a request from a client.
Declaration
protected override Task OnRequestAsync(IHttpContext context)
Parameters
Type | Name | Description |
---|---|---|
IHttp |
context | The context of the request being handled. |
Returns
Type | Description |
---|---|
Task | A |
Overrides
OnStart(CancellationToken)
Called when a module is started, immediately before locking the module's configuration.
Declaration
protected override void OnStart(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Cancellation |
cancellationToken | A |
Overrides
PreferCompression(String, Boolean)
Indicates whether to prefer compression when negotiating content encoding for a response with the specified content type, or whose content type is in the specified media range.
Declaration
public void PreferCompression(string mimeType, bool preferCompression)
Parameters
Type | Name | Description |
---|---|---|
String | mimeType | The MIME type or media range. |
Boolean | preferCompression | true to prefer compression; otherwise, false. |
TryDetermineCompression(String, out Boolean)
Attempts to determine whether compression should be preferred when negotiating content encoding for a response with the specified content type.
Declaration
public bool TryDetermineCompression(string mimeType, out bool preferCompression)
Parameters
Type | Name | Description |
---|---|---|
String | mimeType | The MIME type to check. |
Boolean | preferCompression | When this method returns true, a value indicating whether compression should be preferred. This parameter is passed uninitialized. |
Returns
Type | Description |
---|---|
Boolean | true if a value is found for |