Package ball.upnp.ssdp
Class SSDPRequest
- java.lang.Object
-
- org.apache.hc.core5.http.message.HeaderGroup
-
- org.apache.hc.core5.http.message.BasicHttpRequest
-
- ball.upnp.ssdp.SSDPRequest
-
- All Implemented Interfaces:
SSDPMessage
,Serializable
,HttpMessage
,HttpRequest
,MessageHeaders
public class SSDPRequest extends BasicHttpRequest implements SSDPMessage
SSDPHttpRequest
implementation.Bean Property Summary
Name Mode Type isHidden isBound isConstrained MX R int
false false false absoluteRequestUri W boolean
false false false authority RW URIAuthority
false false false expiration R long
false false false header W Header
false false false headers RW Header[]
false false false method R String
false false false path RW String
false false false requestLine R String
false false false requestUri R String
false false false scheme RW String
false false false socketAddress R SocketAddress
false false false uri RW URI
false false false version RW ProtocolVersion
false false false - Author:
- Allen D. Ball
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SSDPRequest.Method
SSDPRequest
enumeratedSSDPRequest.Method
s.
-
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
SSDPRequest(SSDPRequest.Method method)
Sole non-private constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SSDPRequest
from(DatagramPacket packet)
Method to parse aSSDPRequest
from aDatagramPacket
.long
getExpiration()
Method to get the expiration time forthis
SSDPMessage
.int
getMX()
Method to get theMX
header value as anint
.String
getRequestLine()
SocketAddress
getSocketAddress()
Method to get theSocketAddress
from theDatagramPacket
ifthis
SSDPRequest
was parsed from a packet.SSDPRequest
header(String name, Number value)
Number
fluent header setter.SSDPRequest
header(String name, String value)
String
fluent header setter.SSDPRequest
header(String name, InetSocketAddress value)
InetSocketAddress
fluent header setter.SSDPRequest
header(String name, SocketAddress value)
SocketAddress
fluent header setter.SSDPRequest
header(String name, URI value)
URI
fluent header setter.<T> SSDPRequest
header(String name, Function<T,String> function, T value)
Fluent header setter.String
toString()
-
Methods inherited from class org.apache.hc.core5.http.message.BasicHttpRequest
addHeader, getAuthority, getMethod, getPath, getRequestUri, getScheme, getUri, getVersion, setAbsoluteRequestUri, setAuthority, setHeader, setPath, setScheme, setUri, 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
-
SSDPRequest
protected SSDPRequest(SSDPRequest.Method method)
Sole non-private constructor.- Parameters:
method
- TheSSDPRequest
SSDPRequest.Method
.
-
-
Method Detail
-
from
public static SSDPRequest from(DatagramPacket packet) throws ParseException
Method to parse aSSDPRequest
from aDatagramPacket
.- Parameters:
packet
- TheDatagramPacket
.- Returns:
- A new
SSDPRequest
. - Throws:
ParseException
- If theDatagramPacket
cannot be parsed.
-
getSocketAddress
public SocketAddress getSocketAddress()
Method to get theSocketAddress
from theDatagramPacket
ifthis
SSDPRequest
was parsed from a packet.- Returns:
- The
SocketAddress
.
-
getRequestLine
public String getRequestLine()
-
getMX
public int getMX()
Method to get theMX
header value as anint
. Returns120
if the header is not specified or the if the value is not in the range of1 <= mx <= 120
.- Returns:
- The
MX
value.
-
header
public SSDPRequest header(String name, String value)
String
fluent header setter.- Parameters:
name
- The header name.value
- The header value.- Returns:
this
-
header
public SSDPRequest header(String name, SocketAddress value)
SocketAddress
fluent header setter.- Parameters:
name
- The header name.value
- The header value.- Returns:
this
-
header
public SSDPRequest header(String name, InetSocketAddress value)
InetSocketAddress
fluent header setter.- Parameters:
name
- The header name.value
- The header value.- Returns:
this
-
header
public SSDPRequest header(String name, Number value)
Number
fluent header setter.- Parameters:
name
- The header name.value
- The header value.- Returns:
this
-
header
public SSDPRequest header(String name, URI value)
URI
fluent header setter.- Parameters:
name
- The header name.value
- The header value.- Returns:
this
-
header
public <T> SSDPRequest 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 classBasicHttpRequest
-
-