Direct Known Subclasses:
SSDPNotifyRequest, SSDPSearchRequest

public class SSDPRequestextends HTTPRequest
Base class for SSDP request messages.

This class extends HTTPRequest to provide common functionality for SSDP (Simple Service Discovery Protocol) request messages used in UPnP device discovery and advertisement. It serves as the foundation for specific SSDP request types.

Key features:

  • SSDP request header management
  • HTTP/1.1 version compliance
  • Common SSDP header operations
  • Request parsing and creation
  • Multicast communication support

This class provides the base functionality for SSDP M-SEARCH and NOTIFY requests, handling common header management and HTTP protocol compliance for SSDP operations in UPnP networks.

  • Constructor Details

    • SSDPRequest

      public SSDPRequest()
      Construct an empty request announcing the HTTP/1.1 version SSDP requires.
    • SSDPRequest

      public SSDPRequest(InputStream in)
      Construct a request from headers already read off the wire.
      Parameters:
      in - the stream to parse the request headers from
  • Method Details

    • setNT

      public void setNT(String value)
      Set the NT header, naming the notification type being advertised.
      Parameters:
      value - the notification type, such as "upnp:rootdevice" or "ssdp:all"
    • getNT

      public String getNT()
      Return the NT header.
      Returns:
      the NT header value, or empty string if not set
    • setNTS

      public void setNTS(String value)
      Set the NTS header, naming the notification sub type.
      Parameters:
      value - the notification sub type, either "ssdp:alive" or "ssdp:byebye"
    • getNTS

      public String getNTS()
      Return the NTS header.
      Returns:
      the NTS header value, or empty string if not set
    • setLocation

      public void setLocation(String value)
      Set the Location header, giving the URL of the device description document.
      Parameters:
      value - the URL of the device description document this request points at
    • getLocation

      public String getLocation()
      Return the Location header.
      Returns:
      the Location header value, or empty string if not set
    • setUSN

      public void setUSN(String value)
      Set the USN header, naming the service being notified.
      Parameters:
      value - the unique service name identifying the service being notified
    • getUSN

      public String getUSN()
      Return the USN header.
      Returns:
      the USN header value, or empty string if not set
    • setLeaseTime

      public void setLeaseTime(int len)
      Set the Cache-Control header, carrying this advertisement's max-age lease.
      Parameters:
      len - how many seconds this advertisement stays valid, written as max-age
    • getLeaseTime

      public int getLeaseTime()
      Return the max-age lease carried by the Cache-Control header.
      Returns:
      the max-age lease in seconds, or 0 if the header is absent or unparseable
    • setBootId

      public void setBootId(int bootId)
      Set the BOOTID.UPNP.ORG header, recording the sender's boot generation.
      Parameters:
      bootId - the device boot ID, incremented on each reboot so stale advertisements are rejected
    • getBootId

      public int getBootId()
      Return the BOOTID.UPNP.ORG header.
      Returns:
      the BOOTID.UPNP.ORG value, or 0 if not set