JavaScriptHttpDispatcher
Overview
The JavaScriptHttpDispatcher class provides very easy way to add Remoting SDK for JavaScript and Data Abstract support to the Data Abstract server application.
The main difference between the base JavaScriptHttpDispatcher class and the JavaScriptHttpDispatcher class is that latter allows to serve requests to the Data Abstract core files by providing file content stored in the RemObjects.DataAbstract.Server assembly resources. Also this class still serves all requests to the Remoting SDK for JavaScript core files, taken from the RemObjects.SDK.Server assembly resources
In the simplest case all what is needed to add support for the Data Abstract clients to a Data Abstract server application is to place JavaScriptHttpDispatcher component next to the ServerChannel component and to point dispatcher's Server property to the server channel (obviously only Http and SuperHttp-based server channels are supported). See the Calling Data Abstract Servers from JavaScript article for more details.
Location
- Reference: RemObjects.DataAbstract.Server.dll
- Namespace: RemObjects.DataAbstract.Server
- Ancestry: Component | ExtendedHttpDispatcher | HttpFileDispatcher | JavaScriptHttpDispatcher | JavaScriptHttpDispatcher
constructor
Creates a new instance of the JavaScriptHttpDispatcher class.
constructor
JavaScriptHttpDispatcher()
Sub New()
Activate (declared in ExtendedHttpDispatcher)
method Activate
void Activate()
Sub Activate()
CanHandlePath (declared in ExtendedHttpDispatcher)
Checks if the provided relative HTTP request path can be processed by this dispatcher.
method CanHandlePath(path: String): Boolean
Boolean CanHandlePath(String path)
Function CanHandlePath(path As String) As Boolean
Parameters:
- path:
Deactivate (declared in ExtendedHttpDispatcher)
method Deactivate
void Deactivate()
Sub Deactivate()
DefaultFile (declared in HttpFileDispatcher)
Gets or sets a name(resource) of the file that will be sent back by default whenever a request comes in that doesn't specify a filename.
The default value is index.html.
property DefaultFile: String read write;
String DefaultFile { get; set; }
Property DefaultFile() As String
Dispose protected (declared in ExtendedHttpDispatcher)
If the disposing parameter is set to true, this method unregisters this dispatcher instance from the server.
method Dispose(disposing: Boolean)
void Dispose(Boolean disposing)
Sub Dispose(disposing As Boolean)
Parameters:
- disposing: If set to true, the current dispatcher instance will be unregistered from the server.
Folder (declared in HttpFileDispatcher)
Gets or sets a path to the folder where server will try to find the requested file.
The default value is html.
property Folder: String read write;
String Folder { get; set; }
Property Folder() As String
IsFileContainedInResource protected
Returns true if requested file is contained in the assembly resources.
Extends the base method implementation by adding additional check for the DataAbstract.js and DataAbstract4_Intf.js files.
method IsFileContainedInResource(filename: String): Boolean
Boolean IsFileContainedInResource(String filename)
Function IsFileContainedInResource(filename As String) As Boolean
Parameters:
- filename: A file name to search in assembly resources.
MESSAGE_FORBIDDEN protected (declared in HttpFileDispatcher)
const MESSAGE_FORBIDDEN: String = "Forbidden";
const String MESSAGE_FORBIDDEN = "Forbidden"
Dim MESSAGE_FORBIDDEN As String = "Forbidden"
MESSAGE_INTERNAL_ERROR protected (declared in HttpFileDispatcher)
const MESSAGE_INTERNAL_ERROR: String = "Server Error<br/>";
const String MESSAGE_INTERNAL_ERROR = "Server Error<br/>"
Dim MESSAGE_INTERNAL_ERROR As String = "Server Error<br/>"
MESSAGE_NOT_FOUND protected (declared in HttpFileDispatcher)
const MESSAGE_NOT_FOUND: String = "Requested Resource not Found";
const String MESSAGE_NOT_FOUND = "Requested Resource not Found"
Dim MESSAGE_NOT_FOUND As String = "Requested Resource not Found"
MESSAGE_READ_ERROR protected (declared in HttpFileDispatcher)
const MESSAGE_READ_ERROR: String = "Resource could not be read:<br/>";
const String MESSAGE_READ_ERROR = "Resource could not be read:<br/>"
Dim MESSAGE_READ_ERROR As String = "Resource could not be read:<br/>"
NotifyDispose (declared in ExtendedHttpDispatcher)
This method is called when the ExtendedDispatcherList instance where the current instance is registered is disposed.
method NotifyDispose
void NotifyDispose()
Sub NotifyDispose()
OnRequest protected (declared in HttpFileDispatcher)
Triggers the Request event.
method OnRequest(e: RequestEventArgs)
void OnRequest(RequestEventArgs e)
Sub OnRequest(e As RequestEventArgs)
Parameters:
- e: Request arguments that will be provided to the Request event handler.
Path (declared in ExtendedHttpDispatcher)
Gets or sets the relative HTTP path requests that will be processed by the current HttpDispatcher instance.
Path should begin with "/".
property Path: String read write;
String Path { get; set; }
Property Path() As String
Process (IServerChannelInfo, IHttpRequest, IHttpResponse, Stream, Stream) (declared in ExtendedHttpDispatcher)
method Process(context: IServerChannelInfo; request: IHttpRequest; response: IHttpResponse; requestData: Stream; responseData: Stream)
void Process(IServerChannelInfo context, IHttpRequest request, IHttpResponse response, Stream requestData, Stream responseData)
Sub Process(context As IServerChannelInfo, request As IHttpRequest, response As IHttpResponse, requestData As Stream, responseData As Stream)
Parameters:
- context:
- request:
- response:
- requestData:
- responseData:
Process (IServerChannelInfo, IHttpRequest, IHttpResponse, Stream, Stream) (declared in HttpFileDispatcher)
method Process(context: IServerChannelInfo; request: IHttpRequest; responseHeader: IHttpResponse; requestData: Stream; responseData: Stream)
void Process(IServerChannelInfo context, IHttpRequest request, IHttpResponse responseHeader, Stream requestData, Stream responseData)
Sub Process(context As IServerChannelInfo, request As IHttpRequest, responseHeader As IHttpResponse, requestData As Stream, responseData As Stream)
Parameters:
- context:
- request:
- responseHeader:
- requestData:
- responseData:
Request (declared in HttpFileDispatcher)
This event allows custom processing of incoming resource requests. It is raised prior to file-system access and resources collection traverse.
Main purpose of this event is to allow to serve HTTP requests to data that cannot be stored in the filesystem or server app's assemblies (like server workload info page).
event Request: RequestEventHandler;
delegate: method Request(sender: Object; e: RequestEventArgs)
delegate RequestEventHandler Request()
delegate: void Request(Object sender, RequestEventArgs e)
Event Request As RequestEventHandler
delegate: Sub Request(sender As Object, e As RequestEventArgs)
ResolveContentType protected (declared in HttpFileDispatcher)
Determines MIME content type according to the provided file extension.
This method extensively uses the extensions cache unitialized by the InitializeExtensionsCache method.
In case of cache miss this method tries to read content type from the Windows Registry and to add it to the extensions cache.
method ResolveContentType(fileName: String): String
String ResolveContentType(String fileName)
Function ResolveContentType(fileName As String) As String
Parameters:
- fileName: A file name for which the content type should be resolved.
ResourceAssemblies protected
Gets a list of the assemblies that provide resources for the JavaScriptHttpDispatcher class.
When the JavaScriptHttpDispatcher processes a file requests if scans resources of the assemblies in this list befor trying to access the file system (if this is allowed by the current instance's settings)
The value of this property is a list containing assemblies RemObjects.SDK.Server and RemObjects.DataAbstract.Server.
property ResourceAssemblies: array of Assembly read;
Assembly[] ResourceAssemblies { get; }
ReadOnly Property ResourceAssemblies() As Assembly()
ServeDAJavaScript
Defines if dispatcher should serve all HTTP requests to the DataAbstract.js using the file contained in the RemObjects.DataAbstract.Server assembly resources.
The default value of this property is true.
property ServeDAJavaScript: Boolean read write;
Boolean ServeDAJavaScript { get; set; }
Property ServeDAJavaScript() As Boolean
ServeFilesFromFolder (declared in HttpFileDispatcher)
Gets or sets a flag indicating whether the current instance will try to find requested resource in the Folder folder.
Setting this property to false can significantly speed-up the request processing by avoiding direct file-system access.
The defaul value is true.
property ServeFilesFromFolder: Boolean read write;
Boolean ServeFilesFromFolder { get; set; }
Property ServeFilesFromFolder() As Boolean
Server (declared in ExtendedHttpDispatcher)
The IHttpServer instance this dispatcher is registered in.
The ExtendedHttpDispatcher instance is automatically registered in the provided IHttpServer instance's extended dispatchers list when this property is set.
property Server: IHttpServer read write;
IHttpServer Server { get; set; }
Property Server() As IHttpServer
ServeROJavaScript (declared in JavaScriptHttpDispatcher)
Defines if dispatcher should serve all HTTP requests to the RemObjectsSDK.js using the file contained in the RemObjects.SDK.Server assembly resources.
The default value of this property is true.
property ServeROJavaScript: Boolean read write;
Boolean ServeROJavaScript { get; set; }
Property ServeROJavaScript() As Boolean
MESSAGE_FORBIDDEN protected (declared in HttpFileDispatcher)
const MESSAGE_FORBIDDEN: String = "Forbidden";
const String MESSAGE_FORBIDDEN = "Forbidden"
Dim MESSAGE_FORBIDDEN As String = "Forbidden"
MESSAGE_INTERNAL_ERROR protected (declared in HttpFileDispatcher)
const MESSAGE_INTERNAL_ERROR: String = "Server Error<br/>";
const String MESSAGE_INTERNAL_ERROR = "Server Error<br/>"
Dim MESSAGE_INTERNAL_ERROR As String = "Server Error<br/>"
MESSAGE_NOT_FOUND protected (declared in HttpFileDispatcher)
const MESSAGE_NOT_FOUND: String = "Requested Resource not Found";
const String MESSAGE_NOT_FOUND = "Requested Resource not Found"
Dim MESSAGE_NOT_FOUND As String = "Requested Resource not Found"
MESSAGE_READ_ERROR protected (declared in HttpFileDispatcher)
const MESSAGE_READ_ERROR: String = "Resource could not be read:<br/>";
const String MESSAGE_READ_ERROR = "Resource could not be read:<br/>"
Dim MESSAGE_READ_ERROR As String = "Resource could not be read:<br/>"
DefaultFile (declared in HttpFileDispatcher)
Gets or sets a name(resource) of the file that will be sent back by default whenever a request comes in that doesn't specify a filename.
The default value is index.html.
property DefaultFile: String read write;
String DefaultFile { get; set; }
Property DefaultFile() As String
Folder (declared in HttpFileDispatcher)
Gets or sets a path to the folder where server will try to find the requested file.
The default value is html.
property Folder: String read write;
String Folder { get; set; }
Property Folder() As String
Path (declared in ExtendedHttpDispatcher)
Gets or sets the relative HTTP path requests that will be processed by the current HttpDispatcher instance.
Path should begin with "/".
property Path: String read write;
String Path { get; set; }
Property Path() As String
ResourceAssemblies protected
Gets a list of the assemblies that provide resources for the JavaScriptHttpDispatcher class.
When the JavaScriptHttpDispatcher processes a file requests if scans resources of the assemblies in this list befor trying to access the file system (if this is allowed by the current instance's settings)
The value of this property is a list containing assemblies RemObjects.SDK.Server and RemObjects.DataAbstract.Server.
property ResourceAssemblies: array of Assembly read;
Assembly[] ResourceAssemblies { get; }
ReadOnly Property ResourceAssemblies() As Assembly()
ServeDAJavaScript
Defines if dispatcher should serve all HTTP requests to the DataAbstract.js using the file contained in the RemObjects.DataAbstract.Server assembly resources.
The default value of this property is true.
property ServeDAJavaScript: Boolean read write;
Boolean ServeDAJavaScript { get; set; }
Property ServeDAJavaScript() As Boolean
ServeFilesFromFolder (declared in HttpFileDispatcher)
Gets or sets a flag indicating whether the current instance will try to find requested resource in the Folder folder.
Setting this property to false can significantly speed-up the request processing by avoiding direct file-system access.
The defaul value is true.
property ServeFilesFromFolder: Boolean read write;
Boolean ServeFilesFromFolder { get; set; }
Property ServeFilesFromFolder() As Boolean
Server (declared in ExtendedHttpDispatcher)
The IHttpServer instance this dispatcher is registered in.
The ExtendedHttpDispatcher instance is automatically registered in the provided IHttpServer instance's extended dispatchers list when this property is set.
property Server: IHttpServer read write;
IHttpServer Server { get; set; }
Property Server() As IHttpServer
ServeROJavaScript (declared in JavaScriptHttpDispatcher)
Defines if dispatcher should serve all HTTP requests to the RemObjectsSDK.js using the file contained in the RemObjects.SDK.Server assembly resources.
The default value of this property is true.
property ServeROJavaScript: Boolean read write;
Boolean ServeROJavaScript { get; set; }
Property ServeROJavaScript() As Boolean
constructor
Creates a new instance of the JavaScriptHttpDispatcher class.
constructor
JavaScriptHttpDispatcher()
Sub New()
Activate (declared in ExtendedHttpDispatcher)
method Activate
void Activate()
Sub Activate()
CanHandlePath (declared in ExtendedHttpDispatcher)
Checks if the provided relative HTTP request path can be processed by this dispatcher.
method CanHandlePath(path: String): Boolean
Boolean CanHandlePath(String path)
Function CanHandlePath(path As String) As Boolean
Parameters:
- path:
Deactivate (declared in ExtendedHttpDispatcher)
method Deactivate
void Deactivate()
Sub Deactivate()
Dispose protected (declared in ExtendedHttpDispatcher)
If the disposing parameter is set to true, this method unregisters this dispatcher instance from the server.
method Dispose(disposing: Boolean)
void Dispose(Boolean disposing)
Sub Dispose(disposing As Boolean)
Parameters:
- disposing: If set to true, the current dispatcher instance will be unregistered from the server.
IsFileContainedInResource protected
Returns true if requested file is contained in the assembly resources.
Extends the base method implementation by adding additional check for the DataAbstract.js and DataAbstract4_Intf.js files.
method IsFileContainedInResource(filename: String): Boolean
Boolean IsFileContainedInResource(String filename)
Function IsFileContainedInResource(filename As String) As Boolean
Parameters:
- filename: A file name to search in assembly resources.
NotifyDispose (declared in ExtendedHttpDispatcher)
This method is called when the ExtendedDispatcherList instance where the current instance is registered is disposed.
method NotifyDispose
void NotifyDispose()
Sub NotifyDispose()
OnRequest protected (declared in HttpFileDispatcher)
Triggers the Request event.
method OnRequest(e: RequestEventArgs)
void OnRequest(RequestEventArgs e)
Sub OnRequest(e As RequestEventArgs)
Parameters:
- e: Request arguments that will be provided to the Request event handler.
Process (IServerChannelInfo, IHttpRequest, IHttpResponse, Stream, Stream) (declared in ExtendedHttpDispatcher)
method Process(context: IServerChannelInfo; request: IHttpRequest; response: IHttpResponse; requestData: Stream; responseData: Stream)
void Process(IServerChannelInfo context, IHttpRequest request, IHttpResponse response, Stream requestData, Stream responseData)
Sub Process(context As IServerChannelInfo, request As IHttpRequest, response As IHttpResponse, requestData As Stream, responseData As Stream)
Parameters:
- context:
- request:
- response:
- requestData:
- responseData:
Process (IServerChannelInfo, IHttpRequest, IHttpResponse, Stream, Stream) (declared in HttpFileDispatcher)
method Process(context: IServerChannelInfo; request: IHttpRequest; responseHeader: IHttpResponse; requestData: Stream; responseData: Stream)
void Process(IServerChannelInfo context, IHttpRequest request, IHttpResponse responseHeader, Stream requestData, Stream responseData)
Sub Process(context As IServerChannelInfo, request As IHttpRequest, responseHeader As IHttpResponse, requestData As Stream, responseData As Stream)
Parameters:
- context:
- request:
- responseHeader:
- requestData:
- responseData:
ResolveContentType protected (declared in HttpFileDispatcher)
Determines MIME content type according to the provided file extension.
This method extensively uses the extensions cache unitialized by the InitializeExtensionsCache method.
In case of cache miss this method tries to read content type from the Windows Registry and to add it to the extensions cache.
method ResolveContentType(fileName: String): String
String ResolveContentType(String fileName)
Function ResolveContentType(fileName As String) As String
Parameters:
- fileName: A file name for which the content type should be resolved.
Request (declared in HttpFileDispatcher)
This event allows custom processing of incoming resource requests. It is raised prior to file-system access and resources collection traverse.
Main purpose of this event is to allow to serve HTTP requests to data that cannot be stored in the filesystem or server app's assemblies (like server workload info page).
event Request: RequestEventHandler;
delegate: method Request(sender: Object; e: RequestEventArgs)
delegate RequestEventHandler Request()
delegate: void Request(Object sender, RequestEventArgs e)
Event Request As RequestEventHandler
delegate: Sub Request(sender As Object, e As RequestEventArgs)
- Calling Data Abstract Servers from JavaScript
- Calling Remoting SDK Servers from JavaScript
- Data Abstract
- HttpFileDispatcher
- Remoting SDK for JavaScript
-
JavaScriptHttpDispatcher Class:
- Data Abstract
- Remoting SDK