Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

WebSockets: IKey not Serializable ?

$
0
0
Hi all,

I've got a simple use-case: I would like to run a long-processing task
(through as EJB) and update the UI according to the progress. So, I would
like to see how I can achieve this using native websockets
(wicket-native-websocket-javax).

From various samples I saw (for instance [1]), the pageId is kept and later
we use this pageId to retrieve the connection. It seems that things changed
a little and pageId as been replaced by an IKey instance, which is not
Serializable. So code like run into an exception:

this.add(new WebSocketBehavior() {
private static final long serialVersionUID = 1L;

@Override
protected void onConnect(ConnectedMessage message)

super.onConnect(message);

LOG.info("Client connected");

applicationName = message.getApplication().getName();
sessionId = message.getSessionId();
key = message.getKey();

});

This leads to:
private org.apache.wicket.protocol.ws.api.registry.IKey
MyPage.key [class=org.apache.wicket.protocol.ws.api.registry.PageIdKey]
<----- field that is causing the problem

Is it intended that IKey is not Serializable? Am I supposed to use new
PageIdKey(butwhatpageid) ?

In the wicket guide, the snippet [2] does use the key... but it isn't
declared so I don't see where it comes from... Maybe a little update would
be useful for beginners like me! :)

Many thanks in advance best regards,
Sebastien.

[1] http://wicketinaction.com/2012/07/wicket-6-native-websockets/
[2] http://wicket.apache.org/guide/guide/nativewebsockets.html

Viewing all articles
Browse latest Browse all 5648

Trending Articles