Package ball.upnp.ssdp
Class SSDPResponse
- java.lang.Object
-
- org.apache.hc.core5.http.message.HeaderGroup
-
- org.apache.hc.core5.http.message.BasicHttpResponse
-
- ball.upnp.ssdp.SSDPResponse
-
- All Implemented Interfaces:
SSDPMessage
,Serializable
,HttpMessage
,HttpResponse
,MessageHeaders
public class SSDPResponse extends BasicHttpResponse implements SSDPMessage
SSDPHttpResponse
implementation.Bean Property Summary
Name Mode Type isHidden isBound isConstrained code RW int
false false false expiration R long
false false false header W Header
false false false headers RW Header[]
false false false locale RW Locale
false false false reasonPhrase RW String
false false false socketAddress R SocketAddress
false false false statusLine R String
false false false version RW ProtocolVersion
false false false - Author:
- Allen D. Ball
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface ball.upnp.ssdp.SSDPMessage
AL, BOOTID_UPNP_ORG, CACHE_CONTROL, CONFIGID_UPNP_ORG, DATE, EOL, EOM, EXT, HOST, LOCATION, MAN, MAX_AGE, MX, NEXTBOOTID_UPNP_ORG, NT, NTS, SEARCHPORT_UPNP_ORG, SECURELOCATION_UPNP_ORG, SERVER, SSDP_ALIVE, SSDP_ALL, SSDP_BYEBYE, SSDP_UPDATE, ST, USER_AGENT, USN
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SSDPResponse(int code, String reason)
Sole constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SSDPResponse
from(DatagramPacket packet)
Method to parse aSSDPResponse
from aDatagramPacket
.long
getExpiration()
Method to get the expiration time forthis
SSDPMessage
.SocketAddress
getSocketAddress()
Method to get theSocketAddress
from theDatagramPacket
ifthis
SSDPResponse
was parsed from a packet.String
getStatusLine()
SSDPResponse
header(String name, Number value)
Number
fluent header setter.SSDPResponse
header(String name, String value)
String
fluent header setter.SSDPResponse
header(String name, InetSocketAddress value)
InetSocketAddress
fluent header setter.SSDPResponse
header(String name, SocketAddress value)
SocketAddress
fluent header setter.SSDPResponse
header(String name, URI value)
URI
fluent header setter.<T> SSDPResponse
header(String name, Function<T,String> function, T value)
Fluent header setter.String
toString()
-
Methods inherited from class org.apache.hc.core5.http.message.BasicHttpResponse
addHeader, getCode, getLocale, getReason, getReasonPhrase, getVersion, setCode, setHeader, setLocale, setReasonPhrase, setVersion
-
Methods inherited from class org.apache.hc.core5.http.message.HeaderGroup
addHeader, clear, containsHeader, countHeaders, getCondensedHeader, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator, removeHeader, removeHeaders, removeHeaders, setHeader, setHeaders
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.hc.core5.http.HttpMessage
addHeader, addHeader, getVersion, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setVersion
-
Methods inherited from interface org.apache.hc.core5.http.MessageHeaders
containsHeader, countHeaders, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator
-
Methods inherited from interface ball.upnp.ssdp.SSDPMessage
getHeaderParameterValue, getHeaderParameterValue, getHeaderValue, getHeaderValue, getLocation, getNT, getST, getUSN
-
-
-
-
Constructor Detail
-
SSDPResponse
protected SSDPResponse(int code, String reason)
Sole constructor.- Parameters:
code
- TheSSDPRequest
code
.reason
- TheSSDPRequest
reason.
-
-
Method Detail
-
from
public static SSDPResponse from(DatagramPacket packet) throws ParseException
Method to parse aSSDPResponse
from aDatagramPacket
.- Parameters:
packet
- TheDatagramPacket
.- Returns:
- A new
SSDPResponse
. - Throws:
ParseException
- If theDatagramPacket
cannot be parsed.
-
getSocketAddress
public SocketAddress getSocketAddress()
Method to get theSocketAddress
from theDatagramPacket
ifthis
SSDPResponse
was parsed from a packet.- Returns:
- The
SocketAddress
.
-
getStatusLine
public String getStatusLine()
-
header
public SSDPResponse header(String name, String value)
String
fluent header setter.- Parameters:
name
- The header name.value
- The header value.- Returns:
this
-
header
public SSDPResponse header(String name, SocketAddress value)
SocketAddress
fluent header setter.- Parameters:
name
- The header name.value
- The header value.- Returns:
this
-
header
public SSDPResponse header(String name, InetSocketAddress value)
InetSocketAddress
fluent header setter.- Parameters:
name
- The header name.value
- The header value.- Returns:
this
-
header
public SSDPResponse header(String name, Number value)
Number
fluent header setter.- Parameters:
name
- The header name.value
- The header value.- Returns:
this
-
header
public SSDPResponse header(String name, URI value)
URI
fluent header setter.- Parameters:
name
- The header name.value
- The header value.- Returns:
this
-
header
public <T> SSDPResponse header(String name, Function<T,String> function, T value)
Fluent header setter.- Type Parameters:
T
- The target type.- Parameters:
name
- The header name.value
- The header value.- Returns:
this
-
getExpiration
public long getExpiration()
Description copied from interface:SSDPMessage
Method to get the expiration time forthis
SSDPMessage
.- Specified by:
getExpiration
in interfaceSSDPMessage
- Returns:
- The expiration time (milliseconds since the UNIX epoch).
-
toString
public String toString()
- Overrides:
toString
in classBasicHttpResponse
-
-