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

io.vertx.rxjava3.ext.web.handler.sockjs.SockJSHandler Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR2
Show newest version
/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.vertx.rxjava3.ext.web.handler.sockjs;

import io.vertx.rxjava3.RxHelper;
import io.vertx.rxjava3.ObservableHelper;
import io.vertx.rxjava3.FlowableHelper;
import io.vertx.rxjava3.impl.AsyncResultMaybe;
import io.vertx.rxjava3.impl.AsyncResultSingle;
import io.vertx.rxjava3.impl.AsyncResultCompletable;
import io.vertx.rxjava3.WriteStreamObserver;
import io.vertx.rxjava3.WriteStreamSubscriber;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Iterator;
import java.util.function.Function;
import java.util.stream.Collectors;
import io.vertx.core.Handler;
import io.vertx.core.AsyncResult;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.lang.rx.RxGen;
import io.vertx.lang.rx.TypeArg;
import io.vertx.lang.rx.MappingIterator;

/**
 *
 * A handler that allows you to handle SockJS connections from clients.
 * 

* We currently support version 0.3.3 of the SockJS protocol, which can be found in * this tag: * *

* NOTE: This class has been automatically generated from the {@link io.vertx.ext.web.handler.sockjs.SockJSHandler original} non RX-ified interface using Vert.x codegen. */ @RxGen(io.vertx.ext.web.handler.sockjs.SockJSHandler.class) public class SockJSHandler implements Handler { @Override public String toString() { return delegate.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SockJSHandler that = (SockJSHandler) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final TypeArg __TYPE_ARG = new TypeArg<>( obj -> new SockJSHandler((io.vertx.ext.web.handler.sockjs.SockJSHandler) obj), SockJSHandler::getDelegate ); private final io.vertx.ext.web.handler.sockjs.SockJSHandler delegate; public SockJSHandler(io.vertx.ext.web.handler.sockjs.SockJSHandler delegate) { this.delegate = delegate; } public SockJSHandler(Object delegate) { this.delegate = (io.vertx.ext.web.handler.sockjs.SockJSHandler)delegate; } public io.vertx.ext.web.handler.sockjs.SockJSHandler getDelegate() { return delegate; } /** * Create a SockJS handler * @param vertx the Vert.x instance * @return the handler */ public static io.vertx.rxjava3.ext.web.handler.sockjs.SockJSHandler create(io.vertx.rxjava3.core.Vertx vertx) { io.vertx.rxjava3.ext.web.handler.sockjs.SockJSHandler ret = io.vertx.rxjava3.ext.web.handler.sockjs.SockJSHandler.newInstance((io.vertx.ext.web.handler.sockjs.SockJSHandler)io.vertx.ext.web.handler.sockjs.SockJSHandler.create(vertx.getDelegate())); return ret; } /** * Create a SockJS handler * @param vertx the Vert.x instance * @param options options to configure the handler * @return the handler */ public static io.vertx.rxjava3.ext.web.handler.sockjs.SockJSHandler create(io.vertx.rxjava3.core.Vertx vertx, io.vertx.ext.web.handler.sockjs.SockJSHandlerOptions options) { io.vertx.rxjava3.ext.web.handler.sockjs.SockJSHandler ret = io.vertx.rxjava3.ext.web.handler.sockjs.SockJSHandler.newInstance((io.vertx.ext.web.handler.sockjs.SockJSHandler)io.vertx.ext.web.handler.sockjs.SockJSHandler.create(vertx.getDelegate(), options)); return ret; } /** * Set a SockJS socket handler. This handler will be called with a SockJS socket whenever a SockJS connection * is made from a client * @param handler the handler * @return a router to be mounted on an existing router */ public io.vertx.rxjava3.ext.web.Router socketHandler(io.vertx.core.Handler handler) { io.vertx.rxjava3.ext.web.Router ret = io.vertx.rxjava3.ext.web.Router.newInstance((io.vertx.ext.web.Router)delegate.socketHandler(new io.vertx.lang.rx.DelegatingHandler<>(handler, event -> io.vertx.rxjava3.ext.web.handler.sockjs.SockJSSocket.newInstance((io.vertx.ext.web.handler.sockjs.SockJSSocket)event)))); return ret; } /** * Bridge the SockJS handler to the Vert.x event bus. This basically installs a built-in SockJS socket handler * which takes SockJS traffic and bridges it to the event bus, thus allowing you to extend the server-side * Vert.x event bus to browsers * @param bridgeOptions options to configure the bridge with * @return a router to be mounted on an existing router */ public io.vertx.rxjava3.ext.web.Router bridge(io.vertx.ext.web.handler.sockjs.SockJSBridgeOptions bridgeOptions) { io.vertx.rxjava3.ext.web.Router ret = io.vertx.rxjava3.ext.web.Router.newInstance((io.vertx.ext.web.Router)delegate.bridge(bridgeOptions)); return ret; } /** * Like {@link io.vertx.rxjava3.ext.web.handler.sockjs.SockJSHandler#bridge} but specifying a handler * that will receive bridge events. * @param authorizationProvider authorization provider to be used on the bridge * @param bridgeOptions options to configure the bridge with * @param bridgeEventHandler handler to receive bridge events * @return a router to be mounted on an existing router */ public io.vertx.rxjava3.ext.web.Router bridge(io.vertx.rxjava3.ext.auth.authorization.AuthorizationProvider authorizationProvider, io.vertx.ext.web.handler.sockjs.SockJSBridgeOptions bridgeOptions, io.vertx.core.Handler bridgeEventHandler) { io.vertx.rxjava3.ext.web.Router ret = io.vertx.rxjava3.ext.web.Router.newInstance((io.vertx.ext.web.Router)delegate.bridge(authorizationProvider.getDelegate(), bridgeOptions, new io.vertx.lang.rx.DelegatingHandler<>(bridgeEventHandler, event -> io.vertx.rxjava3.ext.web.handler.sockjs.BridgeEvent.newInstance((io.vertx.ext.web.handler.sockjs.BridgeEvent)event)))); return ret; } /** * Like {@link io.vertx.rxjava3.ext.web.handler.sockjs.SockJSHandler#bridge} but specifying a handler * that will receive bridge events. * @param bridgeOptions options to configure the bridge with * @param bridgeEventHandler handler to receive bridge events * @return a router to be mounted on an existing router */ public io.vertx.rxjava3.ext.web.Router bridge(io.vertx.ext.web.handler.sockjs.SockJSBridgeOptions bridgeOptions, io.vertx.core.Handler bridgeEventHandler) { io.vertx.rxjava3.ext.web.Router ret = io.vertx.rxjava3.ext.web.Router.newInstance((io.vertx.ext.web.Router)delegate.bridge(bridgeOptions, new io.vertx.lang.rx.DelegatingHandler<>(bridgeEventHandler, event -> io.vertx.rxjava3.ext.web.handler.sockjs.BridgeEvent.newInstance((io.vertx.ext.web.handler.sockjs.BridgeEvent)event)))); return ret; } /** * @param routingContext the routing context */ @Deprecated() public void handle(io.vertx.rxjava3.ext.web.RoutingContext routingContext) { delegate.handle(routingContext.getDelegate()); } public static SockJSHandler newInstance(io.vertx.ext.web.handler.sockjs.SockJSHandler arg) { return arg != null ? new SockJSHandler(arg) : null; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy