org.ocap.hn.upnp.common
Class UPnPMessage

java.lang.Object
  extended by org.ocap.hn.upnp.common.UPnPMessage

public class UPnPMessage
extends Object

The class represents a UPnP message comprising an HTTP start line, zero or more headers and an optional XML document.


Constructor Summary
UPnPMessage(String startLine, String[] headers, org.w3c.dom.Document xml)
          Public constructor for the message.
 
Method Summary
 String[] getHeaders()
          Reports the headers from the message, including all HTTP headers but excluding trailing CR/LF characters.
 String getStartLine()
          Reports the HTTP start line, excluding trailing CR/LF characters.
 org.w3c.dom.Document getXML()
          Gets the XML from the message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UPnPMessage

public UPnPMessage(String startLine,
                   String[] headers,
                   org.w3c.dom.Document xml)
Public constructor for the message.

Parameters:
startLine - The HTTP start line, excluding trailing CR/LF characters. May be an empty string.
headers - The HTTP or other headers that this instance is to contain, excluding trailing CF/LF characters and the blank line that follows HTTP headers. The contents of the headers parameter are copied into the resulting UPnPMessage object. May be a zero-length array.
xml - The XML document that this instance is to contain. May be null.
Throws:
NullPointerException - if startLine, headers, or any of the array elements within headers is null.
Method Detail

getStartLine

public String getStartLine()
Reports the HTTP start line, excluding trailing CR/LF characters.

Returns:
The HTTP start line. If the UPnPMessage includes no start line, returns the empty string.

getHeaders

public String[] getHeaders()
Reports the headers from the message, including all HTTP headers but excluding trailing CR/LF characters. The blank line following the last HTTP header is not included in the array.

Note that if the message includes an HTTP CONTENT-LENGTH header, its value describes the length of the raw XML data carried in the UPnP message body, not the size of the XML document provided by getXML().

Returns:
An array containing a copy of the header lines contained in the UPnPMessage obejct. If the UPnPMessage has no headers, returns a zero-length array.
See Also:
UPnPIncomingMessageHandler, UPnPOutgoingMessageHandler

getXML

public org.w3c.dom.Document getXML()
Gets the XML from the message.

Returns:
The XML document of the message. May be null if the message contained no XML document.


Copyright © 2011. All Rights Reserved.