1.1 --- a/ko-ws-tyrus/src/main/java/org/netbeans/html/wstyrus/TyrusContext.java Mon Dec 16 17:39:56 2013 +0100
1.2 +++ b/ko-ws-tyrus/src/main/java/org/netbeans/html/wstyrus/TyrusContext.java Thu Jan 09 20:39:23 2014 +0100
1.3 @@ -43,6 +43,7 @@
1.4 package org.netbeans.html.wstyrus;
1.5
1.6 import java.io.IOException;
1.7 +import java.io.InputStream;
1.8 import java.net.URI;
1.9 import java.net.URISyntaxException;
1.10 import java.util.Iterator;
1.11 @@ -58,6 +59,8 @@
1.12 import net.java.html.json.OnReceive;
1.13 import org.apidesign.html.context.spi.Contexts;
1.14 import org.apidesign.html.json.spi.JSONCall;
1.15 +import org.apidesign.html.json.spi.Technology;
1.16 +import org.apidesign.html.json.spi.Transfer;
1.17 import org.apidesign.html.json.spi.WSTransfer;
1.18 import org.netbeans.html.wstyrus.TyrusContext.Comm;
1.19 import org.json.JSONArray;
1.20 @@ -82,12 +85,14 @@
1.21 * @author Jaroslav Tulach <jtulach@netbeans.org>
1.22 */
1.23 @ServiceProvider(service = Contexts.Provider.class)
1.24 -public final class TyrusContext implements Contexts.Provider, WSTransfer<Comm> {
1.25 +public final class TyrusContext
1.26 +implements Contexts.Provider, WSTransfer<Comm>, Transfer {
1.27 @Override
1.28 public void fillContext(Contexts.Builder context, Class<?> requestor) {
1.29 // default WebSocket transfer implementation is registered
1.30 // in ko-fx module with 100, provide this one as a fallback only
1.31 context.register(WSTransfer.class, this, 1000);
1.32 + context.register(Transfer.class, this, 1000);
1.33 }
1.34
1.35 @Override
1.36 @@ -115,6 +120,21 @@
1.37 socket.callback.notifyError(ex);
1.38 }
1.39 }
1.40 +
1.41 + @Override
1.42 + public void extract(Object obj, String[] props, Object[] values) {
1.43 + LoadJSON.extractJSON(obj, props, values);
1.44 + }
1.45 +
1.46 + @Override
1.47 + public Object toJSON(InputStream is) throws IOException {
1.48 + return LoadJSON.parse(is);
1.49 + }
1.50 +
1.51 + @Override
1.52 + public void loadJSON(JSONCall call) {
1.53 + LoadJSON.loadJSON(call);
1.54 + }
1.55
1.56 /** Implementation class in an implementation. Represents a {@link ClientEndpoint} of the
1.57 * WebSocket channel. You are unlikely to get on hold of it.