java.lang.Object
org.cybergarage.http.HTTPPacket
org.cybergarage.http.HTTPResponse
org.cybergarage.soap.SOAPResponse
org.cybergarage.upnp.control.ControlResponse
org.cybergarage.upnp.control.QueryResponse
Represents a UPnP query response. Extends ControlResponse to provide functionality for handling state variable query responses.
Field Summary
Fields inherited from class ControlResponse
FAULT_CODE, FAULT_STRINGConstructor Summary
ConstructorsConstructorDescription/////////////////////////////////////////////QueryResponse(SOAPResponse soapRes) Constructs a QueryResponse from a SOAP response.Method Summary
Modifier and TypeMethodDescriptionprivate NodecreateResponseNode(String var) Builds the response node carrying one variable's value.private NodeGets the return value node from the query response.Gets the return value from the query response.voidsetResponse(StateVariable stateVar) Sets the response using the specified state variable.Methods inherited from class ControlResponse
getUPnPError, getUPnPErrorCode, getUPnPErrorDescription, setFaultResponse, setFaultResponseModifier and TypeMethodDescriptionGets the complete UPnP error status from the response.intGets the UPnP error code from the response.Gets the UPnP error description from the response.voidsetFaultResponse(int errCode) Sets a fault response with the specified error code.voidsetFaultResponse(int errCode, String errDescr) Sets a fault response with the specified error code and description.Methods inherited from class SOAPResponse
getBodyNode, getEnvelopeNode, getFaultActor, getFaultActorNode, getFaultCode, getFaultCodeNode, getFaultDetailNode, getFaultNode, getFaultString, getFaultStringNode, getMethodResponseNode, print, setContent, setEnvelopeNodeModifier and TypeMethodDescriptionGet the SOAP body node.Get the SOAP envelope node.Get the SOAP fault actor string.Get the SOAP fault actor node.Get the SOAP fault code string.Get the SOAP fault code node.Get the SOAP fault detail node.Get the SOAP fault node.Get the SOAP fault string.Get the SOAP fault string node.getMethodResponseNode(String name) Get the method response node for the given name.voidprint()Writes the response to the debug log, as text or as its root element.voidsetContent(Node node) Set the content from an XML node.voidsetEnvelopeNode(Node node) Set the SOAP envelope node.Methods inherited from class HTTPResponse
getHeader, getStatusCode, getStatusLineString, isSuccessful, setStatusCode, toStringModifier and TypeMethodDescriptionReturn the full header string for this HTTP response.intGets the HTTP status code of this response.Gets the status line string of this HTTP response.booleanChecks if this response has a successful status code.voidsetStatusCode(int code) Sets the HTTP status code of this response.toString()/////////////////////////////////////////////Methods inherited from class HTTPPacket
addHeader, addHeader, clearHeaders, getCacheControl, getCharSet, getConnection, getContent, getContentInputStream, getContentLanguage, getContentLength, getContentRange, getContentRangeFirstPosition, getContentRangeInstanceLength, getContentRangeLastPosition, getContentString, getContentType, getDate, getFirstLine, getFirstLineToken, getHeader, getHeader, getHeaderString, getHeaderValue, getHost, getIntegerHeaderValue, getLongHeaderValue, getNHeaders, getServer, getStringHeaderValue, getStringHeaderValue, getTransferEncoding, getVersion, hasConnection, hasContent, hasContentInputStream, hasContentRange, hasFirstLine, hasHeader, hasTransferEncoding, init, isChunked, isCloseConnection, isKeepAliveConnection, read, set, set, set, set, setCacheControl, setCacheControl, setCacheControl, setConnection, setContent, setContent, setContent, setContent, setContentInputStream, setContentLanguage, setContentLength, setContentRange, setContentType, setDate, setHeader, setHeader, setHeader, setHeader, setHost, setIntegerHeader, setLongHeader, setServer, setStringHeader, setStringHeader, setTransferEncoding, setVersionModifier and TypeMethodDescriptionvoidAdds a header with the specified name and value.voidaddHeader(HTTPHeader header) Adds a header to this HTTP packet.voidClears all headers from this HTTP packet.Get the Cache-Control header value.Gets the character set from the Content-Type header.Gets the Connection header value.byte[]Gets the content of this HTTP packet.Gets the content input stream.Gets the Content-Language header value.longGets the content length from the Content-Length header.long[]Gets the content range values as an array.longGet the first position from the content range.longGet the instance length from the content range.longGet the last position from the content range.Gets the content of this HTTP packet as a string.Gets the Content-Type header value.getDate()Get the Date header value.protected StringGets the first line of the HTTP packet.protected StringgetFirstLineToken(int num) Gets a specific token from the first line using HTTP request line delimiters.getHeader(int n) Gets the header at the specified index.Gets the header with the specified name, ignoring case.Gets all headers as a formatted string.getHeaderValue(String name) Gets the value of a header by name.getHost()Get the Host header value.intgetIntegerHeaderValue(String name) Gets an integer header value by name.longgetLongHeaderValue(String name) Gets a long header value by name.intGets the number of headers in this HTTP packet.Get the Server header value.getStringHeaderValue(String name) Gets a string header value, stripping double quotes if present.getStringHeaderValue(String name, String startWidth, String endWidth) Gets a string header value, stripping the specified delimiters if present.Get the Transfer-Encoding header value.Gets the HTTP version of this packet.booleanChecks if the Connection header is set.booleanChecks if this HTTP packet has content.booleanChecks if a content input stream has been set.booleanChecks if the Content-Range or Range header is set.booleanChecks if the first line of the HTTP packet has been set.booleanChecks if a header with the specified name exists.booleanCheck if the Transfer-Encoding header is set.voidinit()Initializes the HTTP packet to empty state.booleanCheck if the content is chunked.booleanChecks if the Connection header is set to close.booleanChecks if the Connection header is set to keep-alive.booleanread(HTTPSocket httpSock) Reads and parses HTTP packet from a socket.protected booleanset(InputStream in) Parses HTTP packet data from an input stream including content.protected booleanset(InputStream in, boolean onlyHeaders) Parses HTTP packet data from an input stream.protected voidset(HTTPPacket httpPacket) Copies all data from another HTTP packet to this packet.protected booleanset(HTTPSocket httpSock) Parses HTTP packet data from an HTTP socket.voidsetCacheControl(int value) Set the Cache-Control header with a max-age value.voidsetCacheControl(String directive) Set the Cache-Control header.voidsetCacheControl(String directive, int value) Set the Cache-Control header with a directive and value.voidsetConnection(String value) Sets the Connection header.voidsetContent(byte[] data) Sets the content of this HTTP packet.voidsetContent(byte[] data, boolean updateWithContentLength) Sets the content of this HTTP packet.voidsetContent(String data) Sets the content of this HTTP packet from a string.voidsetContent(String data, boolean updateWithContentLength) Sets the content of this HTTP packet from a string.voidSets the content input stream.voidsetContentLanguage(String code) Sets the Content-Language header.voidsetContentLength(long len) Sets the Content-Length header.voidsetContentRange(long firstPos, long lastPos, long length) Sets the Content-Range header.voidsetContentType(String type) Sets the Content-Type header.voidSet the Date header.voidSets the value of a header from an integer.voidSets the value of a header from a long.voidSets the value of a header.voidsetHeader(HTTPHeader header) Sets the value of a header from an HTTP header object.voidSet the Host header.voidsetIntegerHeader(String name, int value) Sets an integer header value.voidsetLongHeader(String name, long value) Sets a long header value.voidSet the Server header.voidsetStringHeader(String name, String value) Sets a string header value, wrapping it with double quotes if not already wrapped.voidsetStringHeader(String name, String value, String startWidth, String endWidth) Sets a string header value, wrapping it with the specified delimiters if not already wrapped.voidsetTransferEncoding(String value) Set the Transfer-Encoding header.voidsetVersion(String ver) Sets the HTTP version for this packet.
Constructor Details
QueryResponse
public QueryResponse()/////////////////////////////////////////////QueryResponse
Constructs a QueryResponse from a SOAP response.- Parameters:
soapRes- the SOAP response to wrap
Method Details
getReturnNode
Gets the return value node from the query response.- Returns:
- the return value node, or null if not found
getReturnValue
Gets the return value from the query response.- Returns:
- the return value as a string, or empty string if not found
setResponse
Sets the response using the specified state variable.- Parameters:
stateVar- the state variable containing the value to return
createResponseNode