org.ocap.hn.upnp.common
Interface UPnPOutgoingMessageHandler


public interface UPnPOutgoingMessageHandler

This interface represents an outgoing message handler that can monitor and modify any outgoing messages from the UPnP stack. All messages originating from the UPnP stack go through the handler (if the handler is registered). This includes advertisements, action responses and device, service and icon retrieval responses on a server, UPnP action invocations, subscription requests, device searches and device, service and icon retrieval requests on a client.


Method Summary
 byte[] handleOutgoingMessage(InetSocketAddress address, UPnPMessage message, UPnPOutgoingMessageHandler defaultHandler)
          Handles an outgoing message.
 

Method Detail

handleOutgoingMessage

byte[] handleOutgoingMessage(InetSocketAddress address,
                             UPnPMessage message,
                             UPnPOutgoingMessageHandler defaultHandler)
Handles an outgoing message. The primary responsibility is to process the provided UPnPMessage object and produce a composite byte array for the outbound message that complies with the UPnP Device Architecture specification. An application-provided UPnPOutgoingMessageHandler may invoke the default, stack-provided message handler via the specified defaultHandler. The handler may also cause the outgoing message to be discarded by returning null; the message SHALL NOT be sent, and subsequent processing SHALL continue as if any expected response to the message had never been received.

Note that if the UPnPMessage provided to this method contains an HTTP CONTENT-LENGTH header, its value is undefined. The handler must supply the correct value after "stringifying" the XML document provided by UPnPMessage.getXML() into XML data to be carried in returned byte array. See UPnPMessage.getHeaders().

Parameters:
address - The InetSocketAddress to which the message is to be sent.
message - The UPnP message that is to be sent.
defaultHandler - The default stack-provided outgoing message handler. If this UPnPOutgoingMessageHandler is the default outgoing message handler, this parameter SHALL be ignored.
Returns:
Composite output byte array containing HTTP start line, headers, and body of the message. No further processing or parsing is performed by the stack on the output byte array prior to transmission. The handler can cause the outgoing message to be discarded by returning null.


Copyright © 2011. All Rights Reserved.