org.ocap.hn.upnp.common
Interface UPnPIncomingMessageHandler


public interface UPnPIncomingMessageHandler

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


Method Summary
 UPnPMessage handleIncomingMessage(InetSocketAddress address, byte[] incomingMessage, UPnPIncomingMessageHandler defaultHandler)
          Handles an incoming message.
 

Method Detail

handleIncomingMessage

UPnPMessage handleIncomingMessage(InetSocketAddress address,
                                  byte[] incomingMessage,
                                  UPnPIncomingMessageHandler defaultHandler)
Handles an incoming message. The primary responsibility is to parse the incoming byte array and produce an XML document representing the incoming content. An application-provided UPnPIncomingMessageHandler may invoke the default, stack-provided message handler via the specified defaultHandler. The handler may also cause the incoming message to be discarded by returning null; subsequent processing SHALL continue as if the message had never been received.

Note that if the UPnPMessage returned by this method contains an HTTP CONTENT-LENGTH header, its value should describe the length of the raw XML data before it is parsed into the XML document reported by UPnPMessage.getXML(). See UPnPMessage.getHeaders().

Parameters:
address - InetSocketAddress representing the network interface and port on which the message was received.
incomingMessage - The incoming UPnP message data, including any HTTP headers.
defaultHandler - The default stack-provided incoming message handler. If this UPnPIncomingMessageHandler is the default incoming message handler, this parameter SHALL be ignored.
Returns:
The UPnP message to be passed up the stack. The handler can cause the incoming message to be discarded by returning null.


Copyright © 2011. All Rights Reserved.