!htp #18028 fix signature of Java-side handleWebsocketMessages directive

This commit is contained in:
Johannes Rudolph 2015-07-23 16:48:42 +02:00
parent 9a3d8104fd
commit 3e7621c836
3 changed files with 3 additions and 10 deletions

View file

@ -31,9 +31,9 @@ public class WebsocketRoutingExample extends HttpApp {
* A handler that treats incoming messages as a name,
* and responds with a greeting to that name
*/
public static Flow<Message, Message, Object> greeter() {
public static Flow<Message, Message, ?> greeter() {
return
upcastMaterializerToObject(Flow.<Message>create())
Flow.<Message>create()
.collect(new JavaPartialFunction<Message, Message>() {
@Override
public Message apply(Message msg, boolean isCheck) throws Exception {
@ -51,10 +51,4 @@ public class WebsocketRoutingExample extends HttpApp {
else // ... this would suffice to handle all text messages in a streaming fashion
return TextMessage.create(Source.single("Hello ").concat(msg.getStreamedText()));
}
// needed because of #18028, see https://github.com/akka/akka/issues/18028
@SuppressWarnings("unchecked")
public static <T, U> Flow<T, U, Object> upcastMaterializerToObject(Flow< T, U, ?> flow) {
return (Flow<T, U, Object>) flow;
}
}