forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Order of Operations
Demis Bellot edited this page Jun 25, 2013
·
9 revisions
This list shows the order in which any user-defined custom hooks are executed:
-
EndpointHostConfig.RawHttpHandlers
are executed before anything else, i.e. returning any ASP.NETIHttpHandler
by-passes ServiceStack completely and processes your customIHttpHandler
instead. - If the Request doesn't match any existing Routes it will search
IAppHost.CatchAllHandlers
for a match - The
IAppHost.PreRequestFilters
gets executed before the Request DTO is deserialized - Default Request DTO Binding or Custom Request Binding (if registered)
- Request Filter Attributes with Priority < 0 gets executed
- Then any Global Request Filters get executed
- Followed by Request Filter Attributes with Priority >= 0
- Action Request Filters (New API only)
- Then your Service is executed with the configured IServiceRunner and its OnBeforeExecute, OnAfterExecute and HandleException custom hooks are fired
- Action Response Filters (New API only)
- Followed by Response Filter Attributes with Priority < 0
- Then Global Response Filters
- Followed by Response Filter Attributes with Priority >= 0
- Finally at the end of the Request
IAppHost.OnEndRequest
is fired
Any time you close the Response in any of your filters, i.e. httpRes.EndServiceStackRequest()
the processing of the response is short-circuited and no further processing is done on that request.
The Implementation architecture diagram shows a visual cue of the internal order of operations that happens in ServiceStack:
After the IHttpHandler is returned, it gets executed with the current ASP.NET or HttpListener request wrapped in a common IHttpRequest instance.
The implementation of RestHandler shows what happens during a typical ServiceStack request:
- Why ServiceStack?
- What is a message based web service?
- Advantages of message based web services
- Why remote services should use separate DTOs
- Getting Started
- Reference
- Clients
- Formats
- View Engines 4. Razor & Markdown Razor
- Hosts
- Advanced
- Configuration options
- Access HTTP specific features in services
- Logging
- Serialization/deserialization
- Request/response filters
- Filter attributes
- Concurrency Model
- Built-in caching options
- Built-in profiling
- Messaging and Redis
- Form Hijacking Prevention
- Auto-Mapping
- HTTP Utils
- Virtual File System
- Config API
- Physical Project Structure
- Modularizing Services
- Plugins
- Tests
- Other Languages
- Use Cases
- Performance
- How To
- Future