[This is preliminary documentation and is subject to change.]
The WorkContext type exposes the following members.Constructors
Name | Description | |
---|---|---|
![]() | WorkContext | Initializes a new instance of the WorkContext class |
Methods
Name | Description | |
---|---|---|
![]() | ___InternalInjectPortal |
DEVELOPERS do not use!
A hack method needed in some VERY RARE cases, like serving an error page form the filter which is out of portal scope.
|
![]() | ___SetWorkMatch |
Internal method. Developers do not call
|
![]() | Destructor |
Warning: if overridden, must call base otherwise semaphore will not get released
(Overrides DisposableObject Destructor .) |
![]() | Dispose |
Deterministically disposes object. DO NOT OVERRIDE this method, override Destructor() instead
(Inherited from DisposableObject.) |
![]() | EnsureObjectNotDisposed |
Checks to see whether object dispose started or has already been disposed and throws an exception if Dispose() was called
(Inherited from DisposableObject.) |
![]() | ![]() | Determines whether the specified object is equal to the current object. (Inherited from ![]() |
![]() | Finalize | (Inherited from DisposableObject.) |
![]() | ![]() | Serves as the default hash function. (Inherited from ![]() |
![]() | ![]() | Gets the (Inherited from ![]() ![]() |
![]() | GetWholeRequestAsJSONDataMap |
Converts request body and MatchedVars into a single JSONDataMap. Users should call WholeRequestAsJSONDataMap.get() as it caches the result
|
![]() | HasAnyVarsMatchingFieldNames |
Returns true if the whole request (body or matched vars) contains any names matching any field names of the specified row
|
![]() | Log |
Facilitates context-aware logging
|
![]() | ![]() | Creates a shallow copy of the current (Inherited from ![]() ![]() |
![]() | NeedsSession |
Ensures that session is injected if session filter is present in processing chain.
If session is already available (Session!=null) then does nothing, otherwise
fills Session poroperty with either NEW session (if onlyExisting=false(default)) if user supplied no session token,
OR gets session from session store as defined by the first SessionFilter in the chain
|
![]() | ParseRequestBodyAsJSONDataMap |
This method is called only once as it touches the input streams
|
![]() | ReleaseWorkSemaphore |
Releases work semaphore that throttles the processing of WorkContext instances.
The WorkContext is released automatically in destructor, however there are cases when the semaphore release
may be needed sooner, i.e. in a HTTP streaming application where work context instances are kept open indefinitely
it may not be desirable to consider long-living work context instances as a throtteling factor.
Returns true if semaphore was released, false if it was not released during this call as it was already released before
|
![]() | SetAuthenticated |
Invoked by applications to signify the presence of authentication
|
![]() | ToString | (Overrides ![]() |
Extension Methods
Fields
Name | Description | |
---|---|---|
![]() | m_EffectiveCallerIPEndPoint | |
![]() | m_Handled | |
![]() | m_Handler | |
![]() | m_Portal | |
![]() | m_PortalFilter | |
![]() | m_PortalMatch | |
![]() | m_PortalMatchedVars | |
![]() | m_PortalTheme | |
![]() | m_Session | |
![]() | m_SessionFilter |
Properties
Name | Description | |
---|---|---|
![]() | Aborted |
Indicates whether the work context is logically finished and its nested processing (i.e. through Filters/Handlers) should stop.
For example, when some filter detects a special condition (judging by the request) and generates the response
and needs to abort the work request so it does no get filtered/processed anymore, it can set this property to true.
This mechanism performs much better than throwing exceptions
|
![]() | About |
Generates short context description
|
![]() | Disposed |
Indicates whether this object was already disposed - the Dispose() has finished
(Inherited from DisposableObject.) |
![]() | DisposeStarted |
Indicates whether this object Dispose() has been called and dispose started but not finished yet
(Inherited from DisposableObject.) |
![]() | EffectiveCallerIPEndPoint |
Returns the effective caller endpoint- that is, if the real caller filter is set it will inject the real IP
as seen before any proxy devices. By default this property returns the Request.RemoteEndPoint
|
![]() | GeoEntity |
Gets sets geo location information as detected by GeoLookupHandler.
If Session context is injected then get/set passes through into session object
|
![]() | Handled |
Returns true when the work has been executed by the WorkHandler instance
|
![]() | Handler |
Returns the work handler instance that was matched to perform work on this context or null if the match has not been made yet
|
![]() | ID |
Uniquely identifies the request
|
![]() | IsAuthenticated |
Returns true to indicate that this context is/was authenticated.
Used to not redirect users to login page on authorization exception
|
![]() | IsDELETE |
Indicates that request method id DELETE
|
![]() | IsGET |
Indicates that request method id GET
|
![]() | IsPATCH |
Indicates that request method id PATCH
|
![]() | IsPOST |
Indicates that request method id POST
|
![]() | IsPUT |
Indicates that request method id PUT
|
![]() | Items |
Provides a thread-safe dictionary of items. The underlying collection is lazily allocated
|
![]() | LastError |
Captures last error
|
![]() | Match |
Returns the work match instances that was made for this requested work or null if nothing was matched yet
|
![]() | Matched |
Returns dynamic object that contains variables that have been extracted by WorkMatch when dispatcher assigned request to WorkHandler.
If variables have not been assigned yet returns empty object
|
![]() | MatchedVars |
Returns variables that have been extracted by WorkMatch when dispatcher assigned request to WorkHandler.
If variables have not been assigned yet returns empty object
|
![]() | NoDefaultAutoClose |
Indicates whether the default dispatcher should close the WorkContext upon completion of async processing.
This property may ONLY be set to TRUE IF Response.Buffered = false (chunked transfer) and Response has already been written to.
When this property is set to true the WorkDispatcher will not auto dispose this WorkContext instance.
This may be needed for a server that streams chat messages and some other thread manages the lifetime of this WorkContext.
Keep in mind that alternative implementations of WorkDispatcher (derived classes that implement alternative threading/lifecycle)
may disregard this flag altogether
|
![]() | Portal |
Returns portal object for this request or null if no portal was injected
|
![]() | PortalFilter |
Returns the first portal filter which was injected in the processing line.
It is the filter that manages the portals for this context
|
![]() | PortalMatch |
Returns matched that was made by portal filter or null
|
![]() | PortalMatchedVars |
Returns variables that have been extracted by WorkMatch when PortalFilter assigned portal.
Returns null if no portal was matched
|
![]() | PortalTheme |
Gets/sets portal theme. This may be null as this is just a holder variable
|
![]() | Request |
Returns HttpListenerRequest object for this context
|
![]() | RequestBodyAsJSONDataMap |
Fetches request body: multipart content, url encoded content, or JSON body into one JSONDataMap bag,
or null if there is no body.
The property does caching
|
![]() | RequestedJSON |
Returns true if client indicated in response that "application/json" is accepted
|
![]() | Response |
Returns Response object for this context
|
![]() | Server |
Returns the server this context is under
|
![]() | Session |
Returns session that this context is linked with or null
|
![]() | SessionFilter |
Returns the first session filter which was injected in the processing line.
It is the filter that manages the session state for this context
|
![]() | SupportsSession |
Returns true when the context was configured to support SessionFilter so Session can be injected
|
![]() | WholeRequestAsJSONDataMap |
Fetches matched vars, multipart content, url encoded content, or JSON body into one JSONDataMap bag.
The property does caching
|
![]() | WorkSemaphoreReleased |
Returns true to indicate that work semaphore has been already released.
It is not necessary to use this property or ReleaseWorkSemaphore() method as the framework does it
automatically in 99% cases. ReleaseWorkSemaphore() may need to be called from special places like HTTP streaming
servers that need to keep WorkContext instances open for a long time
|
See Also