Contexts
Contexts are data structures used by the server and plug-ins to store information. Each context contains a list of name-value pairs or properties. The server uses contexts to pass client, server, presentation, cache, content, transport, and command data to the plug-ins. For example, the archive context contains a WMS_ARCHIVE_FILE_SIZE property that identifies the size, in bytes, of a file archived by the server.
You can use the IWMSContext interface to add remove, and retrieve values from a context. Typically, if you are creating a plug-in, you retrieve context properties more than you set them, but if your plug-in creates a local context for temporary storage, you will be setting and retrieving values. The following example illustrates how to retrieve the WMS_COMMAND_CONTEXT_EVENT property from the command context. The property contains a long that identifies an event raised by the server.
C++ Example
HRESULT hr;
IWMSContext *pCtx;
IWMSContext *pCommandCtx;
long l;
hr = pCommandCtx->GetCommandRequest( &pCtx );
if SUCCEEDED(hr)
{
hr = pCtx->GetLongValue(WMS_COMMAND_CONTEXT_EVENT,
WMS_COMMAND_CONTEXT_EVENT_ID,
&l,
0 );
}
if SUCCEEDED(hr)
{
switch( l )
{
case WMS_EVENT_PUBLISHING_POINT_ADD:
// Add your code here.
break;
case WMS_EVENT_PUBLISHING_POINT_REMOVE:
// Add your code here.
break;
}
The public context properties described in the following sections are defined in the Wmscontextnames.h file. You retrieve values from a public context by using a predefined enumeration member and an associated key. The server resolves the enumeration value to a reference to the name of the property, and it uses the key to speed the search for the property value. In the preceding example, the enumeration member is WMS_COMMAND_CONTEXT_EVENT, and the key is WMS_COMMAND_CONTEXT_EVENT_ID. Typically, a key is made up of the enumeration member followed by _ID.
Context |
Description |
---|---|
Contains information about an archived file. |
|
Contains information about a cache. |
|
Contains information used by the server to describe a single command issued by the end user. The command context itself contains two contexts, a request context and a response context. |
|
Contains information about the content. |
|
Contains information about the stream. |
|
Contains information about the server. |
|
Contains information about the network protocol. |
|
Contains information about the client. |