Interface Event<T>
-
- Type Parameters:
T
- the item type contained in the event
@Deprecated public interface Event<T>
Deprecated.since 1.10 - useServerSentEvent
An individual event in a server sent event stream.The
item
is the item in the data stream being emitted as a server sent event. It can be used to derive values for theid(ratpack.func.Function<? super T, java.lang.String>)
,event(ratpack.func.Function<? super T, java.lang.String>)
and/ordata(ratpack.func.Function<? super T, java.lang.String>)
fields.By default, the
id
,event
anddata
fields are set tonull
.- See Also:
ServerSentEvents
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description Event<T>
comment(java.lang.String comment)
Deprecated.Specify a comment to include as part of this event.Event<T>
data(java.lang.String data)
Deprecated.Specify the event data for the server sent event.Event<T>
data(ratpack.func.Function<? super T,java.lang.String> function)
Deprecated.Sets the “data” value of the event to the return value of the given function.Event<T>
event(java.lang.String event)
Deprecated.Specify the event type for the server sent event.Event<T>
event(ratpack.func.Function<? super T,java.lang.String> function)
Deprecated.Sets the “event” value of the event to the return value of the given function.java.lang.String
getComment()
Deprecated.The comment for this event.java.lang.String
getData()
Deprecated.The “data” value of the event.java.lang.String
getEvent()
Deprecated.The “event” value of the event.java.lang.String
getId()
Deprecated.The “id” value of the event.T
getItem()
Deprecated.The stream item that this event.Event<T>
id(java.lang.String id)
Deprecated.Specify the event id for the server sent event.Event<T>
id(ratpack.func.Function<? super T,java.lang.String> function)
Deprecated.Sets the “id” value of the event to the return value of the given function.
-
-
-
Method Detail
-
getItem
T getItem()
Deprecated.The stream item that this event.- Returns:
- a supporting object
-
getId
java.lang.String getId()
Deprecated.The “id” value of the event.null
by default.- Returns:
- the “id” value of the event
-
getEvent
java.lang.String getEvent()
Deprecated.The “event” value of the event.null
by default.- Returns:
- the “event” value of the event
-
getData
java.lang.String getData()
Deprecated.The “data” value of the event.null
by default.- Returns:
- the “data” value of the event
-
getComment
java.lang.String getComment()
Deprecated.The comment for this event.null
by default.- Returns:
- he comment for this event
- Since:
- 1.5
-
id
Event<T> id(ratpack.func.Function<? super T,java.lang.String> function) throws java.lang.Exception
Deprecated.Sets the “id” value of the event to the return value of the given function.The function receives the
item
and is executed immediately.The returned value must not contain a
'\n'
character as this is not valid in an event value.- Parameters:
function
- a generator for the “id” value of the event- Returns:
- this
- Throws:
java.lang.Exception
- any thrown byfunction
-
id
Event<T> id(java.lang.String id)
Deprecated.Specify the event id for the server sent event.The value must not contain a
'\n'
character as this is not valid in an event value.- Parameters:
id
- the event id- Returns:
- this
-
event
Event<T> event(ratpack.func.Function<? super T,java.lang.String> function) throws java.lang.Exception
Deprecated.Sets the “event” value of the event to the return value of the given function.The function receives the
item
and is executed immediately.The returned value must not contain a
'\n'
character as this is not valid in an event value.- Parameters:
function
- a generator for the “event” value of the event- Returns:
- this
- Throws:
java.lang.Exception
- any thrown byfunction
-
event
Event<T> event(java.lang.String event)
Deprecated.Specify the event type for the server sent event.The value must not contain a
'\n'
character as this is not valid in an event value.- Parameters:
event
- the event type- Returns:
- this
-
data
Event<T> data(ratpack.func.Function<? super T,java.lang.String> function) throws java.lang.Exception
Deprecated.Sets the “data” value of the event to the return value of the given function.The function receives the
item
and is executed immediately.- Parameters:
function
- a generator for the “data” value of the event- Returns:
- this
- Throws:
java.lang.Exception
- any thrown byfunction
-
data
Event<T> data(java.lang.String data)
Deprecated.Specify the event data for the server sent event.- Parameters:
data
- the event data- Returns:
- this
-
-