Good evening,

I have 2 questions related to JSON usage please:

1) I have added jetty-util-ajax Maven-package to
https://github.com/afarber/jetty-newbie/blob/master/EmbWebsocketListener/pom.xml


        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-util-ajax</artifactId>
            <version>9.3.9.v20160517</version>
        </dependency>

But for some reason still can not use

         import org.eclipse.jetty.util.ajax.JSON;

in Java-files. Is that class for public use or should I better use Gson?

2) In my custom WebsocketListener implementation at
https://github.com/afarber/jetty-newbie/blob/master/EmbWebsocketListener/src/main/java/org/eclipse/jetty/demo/listener/MyListener.java

I plan to close connection on all binary messages with

    @Override
    public void onWebSocketBinary(byte[] arg0, int arg1, int arg2) {
        mSession.close(1003, null);
    }

and all text messages should be parsable JSON
(or I'd like to close connection too).

Is it possible to register such a "policy" at
my custom WebSocketHandler implementation
https://github.com/afarber/jetty-newbie/blob/master/EmbWebsocketListener/src/main/java/org/eclipse/jetty/demo/listener/MyHandler.java
(I think I've seen such an "annotation" tag
in a servlet-example, but can't find it anymore...)
or should I enforce this manually in onWebSocketText?

Thank you
Alex
_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to