Package io.socket.http

Examples of io.socket.http.HttpResponse.sendError()


        HttpRequest req = context.getRequest();
        HttpResponse resp = context.getResponse();

        Iterator<String> parts = Splitter.on('/').omitEmptyStrings().split(Strings.nullToEmpty(req.getPathInfo())).iterator();
        if (!parts.hasNext()) {
            resp.sendError(400, String.format("Protocol version required (supports v%d)", PROTOCOL_VERSION));
            return;
        }

        int protocolVersion;
        try {
View Full Code Here


        int protocolVersion;
        try {
            protocolVersion = Integer.parseInt(parts.next());
        } catch (NumberFormatException e) {
            resp.sendError(400, e.getLocalizedMessage());
            return;
        }

        if (protocolVersion != PROTOCOL_VERSION) {
            resp.sendError(501, String.format("Protocol version not implemented (supports v%d)", PROTOCOL_VERSION));
View Full Code Here

            resp.sendError(400, e.getLocalizedMessage());
            return;
        }

        if (protocolVersion != PROTOCOL_VERSION) {
            resp.sendError(501, String.format("Protocol version not implemented (supports v%d)", PROTOCOL_VERSION));
            return;
        }

        if (!parts.hasNext()) {
            handleHandshake(context);
View Full Code Here

        }

        String transportIdAsString = parts.next();
        TransportId transportId = TransportId.fromString(transportIdAsString);
        if (transportId == null || !SUPPORTED.contains(transportId)) {
            resp.sendError(400, "Unsupported transport " + transportIdAsString);
        }

        if (!parts.hasNext()) {
            resp.sendError(400, "Socket id required");
            return;
View Full Code Here

        if (transportId == null || !SUPPORTED.contains(transportId)) {
            resp.sendError(400, "Unsupported transport " + transportIdAsString);
        }

        if (!parts.hasNext()) {
            resp.sendError(400, "Socket id required");
            return;
        }

        UUID sid;
        try {
View Full Code Here

        UUID sid;
        try {
            sid = UUID.fromString(parts.next());

        } catch (IllegalArgumentException e) {
            resp.sendError(400, "Invalid socket id");
            return;
        }

        SocketImplementor socket = get(sid);
View Full Code Here

        }

        SocketImplementor socket = get(sid);

        if (socket == null) {
            resp.sendError(400, String.format("Socket %s does not exist", sid.toString()));
            return;
        }

        Transport transport = createTransport(transportId, context, socket);
        if (transport == null) {
View Full Code Here

            return;
        }

        Transport transport = createTransport(transportId, context, socket);
        if (transport == null) {
            resp.sendError(400, String.format("Socket %s does not exist", sid.toString()));
            return;
        }
        transport.handle(15000); // TODO make configurable
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.