cybergarage-upnp
org.cybergarage.upnp.control.ControlResponse Class Reference
Inheritance diagram for org.cybergarage.upnp.control.ControlResponse:
org.cybergarage.soap.SOAPResponse org.cybergarage.http.HTTPResponse org.cybergarage.http.HTTPPacket org.cybergarage.upnp.control.ActionResponse org.cybergarage.upnp.control.QueryResponse

Public Member Functions

 ControlResponse ()
 
 ControlResponse (SOAPResponse soapRes)
 
void setFaultResponse (int errCode, String errDescr)
 
void setFaultResponse (int errCode)
 
int getUPnPErrorCode ()
 
String getUPnPErrorDescription ()
 
UPnPStatus getUPnPError ()
 
- Public Member Functions inherited from org.cybergarage.soap.SOAPResponse
 SOAPResponse ()
 
 SOAPResponse (HTTPResponse httpRes)
 
 SOAPResponse (SOAPResponse soapRes)
 
void setEnvelopeNode (Node node)
 
Node getEnvelopeNode ()
 
Node getBodyNode ()
 
Node getMethodResponseNode (String name)
 
Node getFaultNode ()
 
Node getFaultCodeNode ()
 
Node getFaultStringNode ()
 
Node getFaultActorNode ()
 
Node getFaultDetailNode ()
 
String getFaultCode ()
 
String getFaultString ()
 
String getFaultActor ()
 
void setContent (Node node)
 
void print ()
 
- Public Member Functions inherited from org.cybergarage.http.HTTPResponse
 HTTPResponse ()
 
 HTTPResponse (HTTPResponse httpRes)
 
 HTTPResponse (InputStream in)
 
 HTTPResponse (HTTPSocket httpSock)
 
void setStatusCode (int code)
 
int getStatusCode ()
 
boolean isSuccessful ()
 
String getStatusLineString ()
 
String getHeader ()
 
String toString ()
 
- Public Member Functions inherited from org.cybergarage.http.HTTPPacket
 HTTPPacket ()
 
 HTTPPacket (HTTPPacket httpPacket)
 
 HTTPPacket (InputStream in)
 
void init ()
 
void setVersion (String ver)
 
String getVersion ()
 
boolean read (HTTPSocket httpSock)
 
boolean hasFirstLine ()
 
int getNHeaders ()
 
void addHeader (HTTPHeader header)
 
void addHeader (String name, String value)
 
HTTPHeader getHeader (int n)
 
HTTPHeader getHeader (String name)
 
void clearHeaders ()
 
boolean hasHeader (String name)
 
void setHeader (String name, String value)
 
void setHeader (String name, int value)
 
void setHeader (String name, long value)
 
void setHeader (HTTPHeader header)
 
String getHeaderValue (String name)
 
void setStringHeader (String name, String value, String startWidth, String endWidth)
 
void setStringHeader (String name, String value)
 
String getStringHeaderValue (String name, String startWidth, String endWidth)
 
String getStringHeaderValue (String name)
 
void setIntegerHeader (String name, int value)
 
void setLongHeader (String name, long value)
 
int getIntegerHeaderValue (String name)
 
long getLongHeaderValue (String name)
 
String getHeaderString ()
 
void setContent (byte data[], boolean updateWithContentLength)
 
void setContent (byte data[])
 
void setContent (String data, boolean updateWithContentLength)
 
void setContent (String data)
 
byte[] getContent ()
 
String getContentString ()
 
boolean hasContent ()
 
void setContentInputStream (InputStream in)
 
InputStream getContentInputStream ()
 
boolean hasContentInputStream ()
 
void setContentType (String type)
 
String getContentType ()
 
void setContentLanguage (String code)
 
String getContentLanguage ()
 
String getCharSet ()
 
void setContentLength (long len)
 
long getContentLength ()
 
boolean hasConnection ()
 
void setConnection (String value)
 
String getConnection ()
 
boolean isCloseConnection ()
 
boolean isKeepAliveConnection ()
 
boolean hasContentRange ()
 
void setContentRange (long firstPos, long lastPos, long length)
 
long[] getContentRange ()
 
long getContentRangeFirstPosition ()
 
long getContentRangeLastPosition ()
 
long getContentRangeInstanceLength ()
 
void setCacheControl (String directive)
 
void setCacheControl (String directive, int value)
 
void setCacheControl (int value)
 
String getCacheControl ()
 
void setServer (String name)
 
String getServer ()
 
void setHost (String host, int port)
 
void setHost (String host)
 
String getHost ()
 
void setDate (Calendar cal)
 
String getDate ()
 
boolean hasTransferEncoding ()
 
void setTransferEncoding (String value)
 
String getTransferEncoding ()
 
boolean isChunked ()
 

Static Public Attributes

static final String FAULT_CODE = "Client"
 
static final String FAULT_STRING = "UPnPError"
 

Private Member Functions

Node createFaultResponseNode (int errCode, String errDescr)
 
Node createFaultResponseNode (int errCode)
 
Node getUPnPErrorNode ()
 
Node getUPnPErrorCodeNode ()
 
Node getUPnPErrorDescriptionNode ()
 

Private Attributes

UPnPStatus upnpErr = new UPnPStatus()
 

Additional Inherited Members

- Protected Member Functions inherited from org.cybergarage.http.HTTPPacket
boolean set (InputStream in, boolean onlyHeaders)
 
boolean set (InputStream in)
 
boolean set (HTTPSocket httpSock)
 
void set (HTTPPacket httpPacket)
 
String getFirstLine ()
 
String getFirstLineToken (int num)
 

Detailed Description

Base class for UPnP control responses.

This class extends SOAPResponse to provide common functionality for both action responses and state variable query responses. It handles SOAP fault generation for UPnP errors and error code extraction.

See also
ActionResponse
QueryResponse
SOAPResponse

Constructor & Destructor Documentation

◆ ControlResponse() [1/2]

org.cybergarage.upnp.control.ControlResponse.ControlResponse ( )
inline

Constructs an empty control response.

Sets the server header to the UPnP stack identifier.

◆ ControlResponse() [2/2]

org.cybergarage.upnp.control.ControlResponse.ControlResponse ( SOAPResponse soapRes)
inline

Constructs a control response from a SOAP response.

Parameters
soapResthe SOAP response to wrap

Member Function Documentation

◆ createFaultResponseNode() [1/2]

Node org.cybergarage.upnp.control.ControlResponse.createFaultResponseNode ( int errCode)
inlineprivate

◆ createFaultResponseNode() [2/2]

Node org.cybergarage.upnp.control.ControlResponse.createFaultResponseNode ( int errCode,
String errDescr )
inlineprivate

◆ getUPnPError()

UPnPStatus org.cybergarage.upnp.control.ControlResponse.getUPnPError ( )
inline

Returns the UPnP error status from the SOAP fault.

Extracts both the error code and description from the fault detail and returns them in a UPnPStatus object.

Returns
the UPnP error status

◆ getUPnPErrorCode()

int org.cybergarage.upnp.control.ControlResponse.getUPnPErrorCode ( )
inline

Returns the UPnP error code from the SOAP fault detail.

Returns
the error code, or -1 if not present or invalid

◆ getUPnPErrorCodeNode()

Node org.cybergarage.upnp.control.ControlResponse.getUPnPErrorCodeNode ( )
inlineprivate

◆ getUPnPErrorDescription()

String org.cybergarage.upnp.control.ControlResponse.getUPnPErrorDescription ( )
inline

Returns the UPnP error description from the SOAP fault detail.

Returns
the error description, or an empty string if not present

◆ getUPnPErrorDescriptionNode()

Node org.cybergarage.upnp.control.ControlResponse.getUPnPErrorDescriptionNode ( )
inlineprivate

◆ getUPnPErrorNode()

Node org.cybergarage.upnp.control.ControlResponse.getUPnPErrorNode ( )
inlineprivate

◆ setFaultResponse() [1/2]

void org.cybergarage.upnp.control.ControlResponse.setFaultResponse ( int errCode)
inline

Sets this response as a SOAP fault with the specified UPnP error code.

The error description is automatically derived from the error code.

Parameters
errCodethe UPnP error code
See also
setFaultResponse(int, String)

◆ setFaultResponse() [2/2]

void org.cybergarage.upnp.control.ControlResponse.setFaultResponse ( int errCode,
String errDescr )
inline

Sets this response as a SOAP fault with the specified UPnP error code and description.

Creates a properly formatted SOAP fault response conforming to the UPnP specification, including the error code and description in the detail element. Sets the HTTP status to 500 Internal Server Error.

Parameters
errCodethe UPnP error code
errDescrthe human-readable error description
See also
UPnPStatus

Field Documentation

◆ FAULT_CODE

final String org.cybergarage.upnp.control.ControlResponse.FAULT_CODE = "Client"
static

SOAP fault code for client errors.

◆ FAULT_STRING

final String org.cybergarage.upnp.control.ControlResponse.FAULT_STRING = "UPnPError"
static

SOAP fault string for UPnP errors.

◆ upnpErr

UPnPStatus org.cybergarage.upnp.control.ControlResponse.upnpErr = new UPnPStatus()
private

The documentation for this class was generated from the following file: