CHttpServer::OnCommand Method  
 
virtual void OnCommand(
  UINT nClientId,  
  LPCTSTR lpszCommand,  
  LPCTSTR lpszResource,  
  LPCTSTR lpszParameters,  
  BOOL& bHandled  
);

A virtual method that is invoked after the client has sent a command to the server.

Parameters

nClientId
An unsigned integer which uniquely identifies the client session.
lpszCommand
A pointer to a string that specifies the command issued by the client. The command name will always be capitalized. For a complete list of commands supported by the server, see Server Commands.
lpszResource
A pointer to a string that specifies the resource that the client has requested. Depending on the command issued, it may be a document, a folder or an executable script.
lpszParameters
A pointer to a string that specifies any query parameters that have been provided by the client. The string will be empty if there were no query parameters included with the request. The query parameters in this string will be URL encoded.
bHandled
An integer value that indicates whether the handler has processed the event. If the handler sets this parameter to a non-zero value, it indicates that the application has processed the command itself. If this parameter has a value of zero, then the server will perform the default action for the command. By default, this parameter has a value of zero.

Return Value

None.

Remarks

The OnCommand event handler is invoked after the client has sent a command to the server, but before the command has been processed. To implement an event handler, the application should create a class derived from the CHttpServer class, and then override this method.

This event handler is invoked for all commands issued by the client, including invalid or disabled commands. If the bHandled parameter is FALSE, the server will perform the default processing for the command. If the bHandled parameter is set to TRUE, the server will take no action. Note that if the event handler processes the command, it must call the SendResponse method to send a success or error response back to the client. If this is not done, the server will consider the command to be invalid and will send a 501 "not implemented" error by default.

It is not necessary to use this event handler to disable a command. The EnableCommand method can be used to enable or disable specific commands, and the IsCommandEnabled method can be used to determine if a command is enabled.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: cshtsv11.lib
Unicode: Implemented as Unicode and ANSI versions

See Also

DisconnectClient, EnableCommand, IsCommandEnabled, OnDisconnect, SendResponse