Package org.nutz.lang.socket

Examples of org.nutz.lang.socket.SocketAction


      return;
    }
    try {
      LinkedHashMap<String, Object> map = Json.fromJson(LinkedHashMap.class,
                                              Streams.utf8r(socket.getInputStream()));
      SocketAction action = saTable.get(map.get("cmd").toString());
      if (null != action) {
        SocketContext context = new SocketContext(this);
        if(action instanceof JsonAction)
          ((JsonAction)action).run(map,context);
        else
          action.run(context);
      } else {
        Writer writer = Streams.utf8w(socket.getOutputStream());
        Map<String, Object> x = new HashMap<String, Object>();
        x.put("ok", false);
        x.put("msg", "Unknown CMD");
View Full Code Here


            if (map == null) {
                if (log.isWarnEnabled())
                    log.warn("Null data ???!!");
                return;
            }
            SocketAction action = saTable.get(map.get("cmd").toString());
            if (null != action) {
                if (log.isDebugEnabled())
                    log.debugf("handle request by "+ action);
                SocketContext context = new SocketContext(this);
                context.set("json_data", map);
                action.run(context);
                if (log.isDebugEnabled())
                    log.debugf("finish request by "+ action);
            } else {
                if (log.isWarnEnabled())
                    log.warn("Unknown CMD="+map.get("cmd"));
View Full Code Here

TOP

Related Classes of org.nutz.lang.socket.SocketAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.