public class SubscriptionResponseextends HTTPResponse
Represents a UPnP event subscription response.

This class extends HTTPResponse to handle GENA (General Event Notification Architecture) subscription responses for UPnP event notifications. It manages the response to SUBSCRIBE and UNSUBSCRIBE requests, including success and error handling.

Key features:

  • Subscription response status management
  • SID (Subscription ID) header handling
  • Timeout response management
  • Error response generation
  • UPnP server identification

This class is used by UPnP devices to respond to subscription requests from control points, providing subscription confirmation, timeout information, and error status when necessary.

  • Constructor Details

    • SubscriptionResponse

      public SubscriptionResponse()
      Creates an empty response naming this library as the server.
    • SubscriptionResponse

      public SubscriptionResponse(HTTPResponse httpRes)
      Wraps the response received from the subscriber.
      Parameters:
      httpRes - the response received from the subscriber, holding the headers
  • Method Details

    • setResponse

      public void setResponse(int code)
      Sets the status code and clears the body length.
      Parameters:
      code - the HTTP status code to record, sent with an empty body
    • setErrorResponse

      public void setErrorResponse(int code)
      Sets the error status code and clears the body length.
      Parameters:
      code - the HTTP error status code to record, sent with an empty body
    • setSID

      public void setSID(String id)
      Writes the subscription identifier to the SID header.
      Parameters:
      id - the bare subscription identifier to publish in the SID header
    • getSID

      public String getSID()
      Returns the subscription identifier from the SID header.
      Returns:
      the subscription identifier from the SID header, or the empty string when absent
    • setTimeout

      public void setTimeout(long value)
      Writes the subscription lifetime to the TIMEOUT header.
      Parameters:
      value - the subscription lifetime in seconds, or INFINITE_VALUE for unlimited
    • getTimeout

      public long getTimeout()
      Returns the subscription lifetime from the TIMEOUT header.
      Returns:
      the subscription lifetime in seconds from the TIMEOUT header, or INFINITE_VALUE when the header is absent or unparseable