Platform Concepts - Glimpse/Glimpse GitHub Wiki
Glimpse has the required abstractions which means that is not tied to any one platform. This means that as a framework that doesn't run on under System.Web, to get Glimpse running, all you need to do is implement several different providers to get Glimpse running on your platform.
For Glimpse to operate on a different platform we assume that every web platform has the following programmable concepts:
- Resource Endpoints
- In the end, only a single endpoint is required. Glimpse providers the internal plumbing to be able to serve many assets via this open endpoint. For interest sake, examples of the different assets that might be served can be found here.
- Under
System.Webon the ASP.NET stack, this would be aSystem.Web.IHttpHandler.
- Request Listeners
- As Glimpse is collecting information about a given request, we need to know about when a request starts and finishes, and if your framework supports session, when session access starts and finishes.
- Under
System.Webon the ASP.NET stack, this would be aSystem.Web.IHttpModule.
Example implementations for these concepts under System.Web and how they interact with the Glimpse runtime can be found here:
- Resource Endpoint - Glimpse.AspNet.HttpHandler
- Request Listeners - Glimpse.AspNet.HttpModule
Additionally, we need to able able to access various request context details/providers/assets:
- Http Request Store
- A request store is a place for Glimpse to store data that lives and dies with an Http request. In ASP.NET,
HttpContext.Itemsis a request store.
- A request store is a place for Glimpse to store data that lives and dies with an Http request. In ASP.NET,
- Http Server Store
- A server store is a place for Glimpse to store data a persists across Http requests. In ASP.NET,
HttpContext.Applicationis a server store.
- A server store is a place for Glimpse to store data a persists across Http requests. In ASP.NET,
- Runtime Context
- Instance of the underlying context that the web development framework uses. In ASP.NET,
HttpContextis the runtime context.
- Instance of the underlying context that the web development framework uses. In ASP.NET,
- Request Metadata
- An instance of
IRequestMetadatawhich provides relevant metadata about an Http request. In ASP.NET, aHttpRequestcontains must data required for creating aIRequestMetadata.
- An instance of
- Set HttpResponse Header
- Set Http Response Status Code
- Set Cookie
- Inject Http Response Body
- Injects the Http response body. Inserts the given html snippet into the html document just before the end
</body>tag.
- Injects the Http response body. Inserts the given html snippet into the html document just before the end
- Write Http Response
- Writes the Http response. Used by the resource infrastructure (mentioned above) to output binary content (i.e. embedded content, images, etc).
- Write Http Response
- Writes the Http response. Used by the resource infrastructure to output string content (i.e. generated strings, JSON objects, etc).
The formal definition for the Framework Provider can be found here:
Example implementations for these concepts under System.Web and how they interact with the Glimpse runtime can be found here:
Lastly, within a given request, we need to access the properties that describe the metadata associated with a request:
- Request Uri
- Request Http Method
- Response Status Code
- Response Content Type
- Ip Address
- Request Is Ajax
- Client Id
- Get Cookie
- Get Http Header
The formal definition for the Request Metadata can be found here:
Example implementations for these concepts under System.Web and how they interact with the Glimpse runtime can be found here: