forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Order of Operations
Demis Bellot edited this page Feb 21, 2014
·
14 revisions
This list shows the order in which any user-defined custom hooks are executed:
-
HostContext.RawHttpHandlersare executed before anything else, i.e. returning any ASP.NETIHttpHandlerby-passes ServiceStack completely and processes your customIHttpHandlerinstead. - If the Request doesn't match any existing Routes it will search
IAppHost.CatchAllHandlersfor a match - The
IAppHost.PreRequestFiltersgets 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
- Then your Service is executed with the configured IServiceRunner and its OnBeforeExecute, OnAfterExecute and HandleException custom hooks are fired
- Action Response Filters
- 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.OnEndRequestis fired
Any time you close the Response in any of your filters, i.e. httpRes.EndRequest() the processing of the response is short-circuited and no further processing is done on that request.
- Any Global Request Filters get executed
- Followed by Request Filter Attributes with Priority >= 0
- Action Request Filters
- Then your Service is executed with the configured IServiceRunner and its OnBeforeExecute, OnAfterExecute and HandleException custom hooks are fired
- Action Response Filters
- Then Global Response Filters
- Finally at the end of the Request
IAppHost.OnEndRequestis fired
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
- Security
- 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
- Form Hijacking Prevention
- Auto-Mapping
- HTTP Utils
- Virtual File System
- Config API
- Physical Project Structure
- Modularizing Services
- MVC Integration
- Plugins 3. Request logger 4. Swagger API
- Tests
- Other Languages
- Use Cases
- Performance
- How To
- Future

