org.cybergarage.upnp.control

## Class ControlResponse

- java.lang.Object
- - org.cybergarage.http.HTTPPacket
  - - org.cybergarage.http.HTTPResponse
    - - org.cybergarage.soap.SOAPResponse
      - - org.cybergarage.upnp.control.ControlResponse

- Direct Known Subclasses:
    ActionResponse, QueryResponse

      public class ControlResponse
      extends SOAPResponse

  Represents a UPnP control response. Extends SOAPResponse to provide UPnP-specific error handling and fault response functionality.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `FAULT_CODE` Default fault code for UPnP errors
    `static String` | `FAULT_STRING` Default fault string for UPnP errors

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ControlResponse()` Default constructor
    `ControlResponse(SOAPResponse soapRes)` Constructs a ControlResponse from a SOAP response.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `UPnPStatus` | `getUPnPError()` Gets the complete UPnP error status from the response.
    `int` | `getUPnPErrorCode()` Gets the UPnP error code from the response.
    `String` | `getUPnPErrorDescription()` Gets the UPnP error description from the response.
    `void` | `setFaultResponse(int errCode)` Sets a fault response with the specified error code.
    `void` | `setFaultResponse(int errCode, String errDescr)` Sets a fault response with the specified error code and description.

    - ### Methods inherited from class org.cybergarage.soap.SOAPResponse

      `getBodyNode, getEnvelopeNode, getFaultActor, getFaultActorNode, getFaultCode, getFaultCodeNode, getFaultDetailNode, getFaultNode, getFaultString, getFaultStringNode, getMethodResponseNode, print, setContent, setEnvelopeNode`

    - ### Methods inherited from class org.cybergarage.http.HTTPResponse

      `getHeader, getStatusCode, getStatusLineString, isSuccessful, setStatusCode, toString`

    - ### Methods inherited from class org.cybergarage.http.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, setVersion`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### FAULT_CODE

          public static final String FAULT_CODE

      Default fault code for UPnP errors
      See Also:
        Constant Field Values

    - #### FAULT_STRING

          public static final String FAULT_STRING

      Default fault string for UPnP errors
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ControlResponse

          public ControlResponse()

      Default constructor

    - #### ControlResponse

          public ControlResponse(SOAPResponse soapRes)

      Constructs a ControlResponse from a SOAP response.
      Parameters:
        `soapRes` - the SOAP response to wrap

  - ### Method Detail

    - #### getUPnPError

          public UPnPStatus getUPnPError()

      Gets the complete UPnP error status from the response.
      Returns:
        a UPnPStatus object containing the error code and description

    - #### getUPnPErrorCode

          public int getUPnPErrorCode()

      Gets the UPnP error code from the response.
      Returns:
        the error code, or -1 if not found or invalid

    - #### getUPnPErrorDescription

          public String getUPnPErrorDescription()

      Gets the UPnP error description from the response.
      Returns:
        the error description, or empty string if not found

    - #### setFaultResponse

          public void setFaultResponse(int errCode)

      Sets a fault response with the specified error code. The error description is automatically generated from the error code.
      Parameters:
        `errCode` - the UPnP error code

    - #### setFaultResponse

          public void setFaultResponse(int errCode,
                                       String errDescr)

      Sets a fault response with the specified error code and description.
      Parameters:
        `errCode` - the UPnP error code
        `errDescr` - the error description