All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mcollovati.vertx.vaadin.sockjs.communication.ShareableSockJsSocket Maven / Gradle / Ivy

The newest version!
/*
 * The MIT License
 * Copyright © 2016-2020 Marco Collovati ([email protected])
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package com.github.mcollovati.vertx.vaadin.sockjs.communication;

import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.MultiMap;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.net.SocketAddress;
import io.vertx.core.shareddata.Shareable;
import io.vertx.core.streams.Pipe;
import io.vertx.core.streams.WriteStream;
import io.vertx.ext.auth.User;
import io.vertx.ext.web.RoutingContext;
import io.vertx.ext.web.Session;
import io.vertx.ext.web.handler.sockjs.SockJSSocket;

/**
 * A wrapper for {@link SockJSSocket} just to implement {@link Shareable}
 * interface in order to let instance work with {@link io.vertx.core.shareddata.LocalMap}.
 */
class ShareableSockJsSocket implements SockJSSocket, Shareable {
    private final SockJSSocket socket;

    ShareableSockJsSocket(SockJSSocket socket) {
        this.socket = socket;
    }

    @Override
    public SockJSSocket exceptionHandler(Handler handler) {
        return socket.exceptionHandler(handler);
    }

    @Override
    public SockJSSocket handler(Handler handler) {
        return socket.handler(handler);
    }

    @Override
    public SockJSSocket pause() {
        return socket.pause();
    }

    @Override
    public SockJSSocket resume() {
        return socket.resume();
    }

    @Override
    public SockJSSocket endHandler(Handler endHandler) {
        return socket.endHandler(endHandler);
    }

    @Override
    public SockJSSocket closeHandler(Handler closeHandler) {
        return socket.closeHandler(closeHandler);
    }

    @Override
    public Future write(Buffer data) {
        return socket.write(data);
    }

    @Override
    public Future write(String data) {
        return socket.write(data);
    }

    @Override
    public void write(String data, Handler> handler) {
        socket.write(data, handler);
    }

    @Override
    public void write(Buffer data, Handler> handler) {
        socket.write(data, handler);
    }

    @Override
    public SockJSSocket setWriteQueueMaxSize(int maxSize) {
        return socket.setWriteQueueMaxSize(maxSize);
    }

    @Override
    public SockJSSocket drainHandler(Handler handler) {
        return socket.drainHandler(handler);
    }

    @Override
    public String writeHandlerID() {
        return socket.writeHandlerID();
    }

    @Override
    public Future end() {
        return socket.end();
    }

    @Override
    public void close() {
        socket.close();
    }

    @Override
    public void close(int statusCode, String reason) {
        socket.close(statusCode, reason);
    }

    @Override
    public SocketAddress remoteAddress() {
        return socket.remoteAddress();
    }

    @Override
    public SocketAddress localAddress() {
        return socket.localAddress();
    }

    @Override
    public MultiMap headers() {
        return socket.headers();
    }

    @Override
    public String uri() {
        return socket.uri();
    }

    @Override
    public RoutingContext routingContext() {
        return socket.routingContext();
    }

    @Override
    public Session webSession() {
        return socket.webSession();
    }

    @Override
    public User webUser() {
        return socket.webUser();
    }

    @Override
    public SockJSSocket fetch(long amount) {
        return socket.fetch(amount);
    }

    @Override
    public Pipe pipe() {
        return socket.pipe();
    }

    @Override
    public Future pipeTo(WriteStream dst) {
        return socket.pipeTo(dst);
    }

    @Override
    public void pipeTo(WriteStream dst, Handler> handler) {
        socket.pipeTo(dst, handler);
    }

    @Override
    public void end(Handler> handler) {
        socket.end(handler);
    }

    @Override
    public Future end(Buffer data) {
        return socket.end(data);
    }

    @Override
    public void end(Buffer data, Handler> handler) {
        socket.end(data, handler);
    }

    @Override
    public boolean writeQueueFull() {
        return socket.writeQueueFull();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy