Class Event
java.lang.Object
kong.unirest.core.java.Event
A server sent event.
Generally modeled on the HTML5 EventSource standard
https://html.spec.whatwg.org/multipage/
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> TDeserialize the data of the event using the Unirest Config's ObjectMapper<T> TasObject(GenericType<T> genericType) Deserialize the data of the event using the Unirest Config's ObjectMapper This method takes a GenericType which retains Generics information for types lke List<Foo>data()The data field for the message.booleanevent()A string identifying the type of event described.inthashCode()id()The event ID to set the EventSource object's last event ID value.toString()
-
Constructor Details
-
Event
Constructor used by unirest which includes the Unirest config which uis used for event serialization- Parameters:
id- The event IDevent- the event label. "message" is the default from the serverdata- the data in the event. This is concatenated from all lines before a dispatch event (a blank line)config- the unirest config used for deserialization
-
Event
-
-
Method Details
-
data
The data field for the message. When the EventSource receives multiple consecutive lines that begin with data:, it concatenates them, inserting a newline character between each one. Trailing newlines are removed.- Returns:
- the data
-
id
The event ID to set the EventSource object's last event ID value.- Returns:
- the id
-
event
A string identifying the type of event described. If this is specified, an event will be dispatched on the browser to the listener for the specified event name;- Returns:
- the event name
-
asObject
Deserialize the data of the event using the Unirest Config's ObjectMapper- Type Parameters:
T- the class type- Parameters:
responseClass- the type of class you want back- Returns:
- an instance of the class
-
asObject
Deserialize the data of the event using the Unirest Config's ObjectMapper This method takes a GenericType which retains Generics information for types lke List<Foo>- Type Parameters:
T- the class type- Parameters:
genericType- the type of class you want back using a generictype object- Returns:
- an instance of the class
-
equals
-
hashCode
-
toString
-