public class ChannelUtils extends Object
Constructor and Description |
---|
ChannelUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
pushCacheValue(String key,
Cache<Object,Object> cache,
io.netty.channel.ChannelHandlerContext ctx)
Push a cache entry value out onto the websocket channel (to the browser).
|
static void |
pushErrorMessage(String errorMessage,
io.netty.channel.ChannelHandlerContext ctx) |
static JsonObject |
toJSON(String key,
Object value,
String cacheName)
Cache key, value and cache-name to JSON string.
|
public static void pushCacheValue(String key, Cache<Object,Object> cache, io.netty.channel.ChannelHandlerContext ctx)
key
- The cache entry key whose value is to be pushed to the browser.cache
- The cache containing the key.ctx
- The channel context associated with the browser websocket channel..public static void pushErrorMessage(String errorMessage, io.netty.channel.ChannelHandlerContext ctx)
public static JsonObject toJSON(String key, Object value, String cacheName)
Note that value objects (like String, Numbers, Characters) are not being converted.
key
- The cache key.value
- The cache value.cacheName
- The cache name.IllegalStateException
- In case of complex object which can not be converted to JSON.Copyright © 2023 JBoss, a division of Red Hat. All rights reserved.