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

io.vertx.rxjava3.httpproxy.ProxyRequest 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.httpproxy;

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;

/**
 *
 * Handles the interoperability of the request between the user agent and the origin.
 *
 * 

* NOTE: This class has been automatically generated from the {@link io.vertx.httpproxy.ProxyRequest original} non RX-ified interface using Vert.x codegen. */ @RxGen(io.vertx.httpproxy.ProxyRequest.class) public class ProxyRequest { @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; ProxyRequest that = (ProxyRequest) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final TypeArg __TYPE_ARG = new TypeArg<>( obj -> new ProxyRequest((io.vertx.httpproxy.ProxyRequest) obj), ProxyRequest::getDelegate ); private final io.vertx.httpproxy.ProxyRequest delegate; public ProxyRequest(io.vertx.httpproxy.ProxyRequest delegate) { this.delegate = delegate; } public ProxyRequest(Object delegate) { this.delegate = (io.vertx.httpproxy.ProxyRequest)delegate; } public io.vertx.httpproxy.ProxyRequest getDelegate() { return delegate; } private static final TypeArg TYPE_ARG_0 = new TypeArg(o1 -> io.vertx.rxjava3.httpproxy.ProxyResponse.newInstance((io.vertx.httpproxy.ProxyResponse)o1), o1 -> o1.getDelegate()); /** * Create a new ProxyRequest instance, the proxied request will be paused. * @param proxiedRequest the HttpServerRequest that is proxied * @return a reference to this, so the API can be used fluently */ public static io.vertx.rxjava3.httpproxy.ProxyRequest reverseProxy(io.vertx.rxjava3.core.http.HttpServerRequest proxiedRequest) { io.vertx.rxjava3.httpproxy.ProxyRequest ret = io.vertx.rxjava3.httpproxy.ProxyRequest.newInstance((io.vertx.httpproxy.ProxyRequest)io.vertx.httpproxy.ProxyRequest.reverseProxy(proxiedRequest.getDelegate())); return ret; } /** * @return the HTTP version of the proxied request */ public io.vertx.core.http.HttpVersion version() { io.vertx.core.http.HttpVersion ret = delegate.version(); return ret; } /** * @return the absolute URI of the proxied request */ public java.lang.String absoluteURI() { java.lang.String ret = delegate.absoluteURI(); return ret; } /** * @return the HTTP method to be sent to the origin server. */ public io.vertx.core.http.HttpMethod getMethod() { io.vertx.core.http.HttpMethod ret = delegate.getMethod(); return ret; } /** * Set the HTTP method to be sent to the origin server. * *

The initial HTTP method value is the proxied request HTTP method. * @param method the new HTTP method * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava3.httpproxy.ProxyRequest setMethod(io.vertx.core.http.HttpMethod method) { delegate.setMethod(method); return this; } /** * @return the request URI to be sent to the origin server. */ public java.lang.String getURI() { java.lang.String ret = delegate.getURI(); return ret; } /** * Set the request URI to be sent to the origin server. * *

The initial request URI value is the proxied request URI. * @param uri the new URI * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava3.httpproxy.ProxyRequest setURI(java.lang.String uri) { delegate.setURI(uri); return this; } /** * @return the request body to be sent to the origin server. */ public io.vertx.rxjava3.httpproxy.Body getBody() { io.vertx.rxjava3.httpproxy.Body ret = io.vertx.rxjava3.httpproxy.Body.newInstance((io.vertx.httpproxy.Body)delegate.getBody()); return ret; } /** * Set the request body to be sent to the origin server. * *

The initial request body value is the proxied request body. * @param body the new body * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava3.httpproxy.ProxyRequest setBody(io.vertx.rxjava3.httpproxy.Body body) { delegate.setBody(body.getDelegate()); return this; } /** * Set the request authority * *

    *
  • for HTTP/1 the header
  • *
  • for HTTP/2 the pseudo header
  • *
* * The value must follow the syntax. * @param authority the authority * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava3.httpproxy.ProxyRequest setAuthority(io.vertx.rxjava3.core.net.HostAndPort authority) { delegate.setAuthority(authority.getDelegate()); return this; } /** * @return the request authority, for HTTP2 the pseudo header otherwise the header */ public io.vertx.rxjava3.core.net.HostAndPort getAuthority() { io.vertx.rxjava3.core.net.HostAndPort ret = io.vertx.rxjava3.core.net.HostAndPort.newInstance((io.vertx.core.net.HostAndPort)delegate.getAuthority()); return ret; } /** * @return the headers that will be sent to the origin server, the returned headers can be modified. The headers map is populated with the proxied request headers */ public io.vertx.rxjava3.core.MultiMap headers() { io.vertx.rxjava3.core.MultiMap ret = io.vertx.rxjava3.core.MultiMap.newInstance((io.vertx.core.MultiMap)delegate.headers()); return ret; } /** * Proxy this request to the origin server using the specified request and then send the proxy response. * @param request the request connected to the origin server * @return */ public io.reactivex.rxjava3.core.Completable proxy(io.vertx.rxjava3.core.http.HttpClientRequest request) { io.reactivex.rxjava3.core.Completable ret = rxProxy(request); ret = ret.cache(); ret.subscribe(io.vertx.rxjava3.CompletableHelper.nullObserver()); return ret; } /** * Proxy this request to the origin server using the specified request and then send the proxy response. * @param request the request connected to the origin server * @return */ public io.reactivex.rxjava3.core.Completable rxProxy(io.vertx.rxjava3.core.http.HttpClientRequest request) { return AsyncResultCompletable.toCompletable(delegate.proxy(request.getDelegate())); } /** * Send this request to the origin server using the specified request. * *

The returned future will be completed with the proxy response returned by the origin. * @param request the request connected to the origin server * @return */ public io.reactivex.rxjava3.core.Single send(io.vertx.rxjava3.core.http.HttpClientRequest request) { io.reactivex.rxjava3.core.Single ret = rxSend(request); ret = ret.cache(); ret.subscribe(io.vertx.rxjava3.SingleHelper.nullObserver()); return ret; } /** * Send this request to the origin server using the specified request. * *

The returned future will be completed with the proxy response returned by the origin. * @param request the request connected to the origin server * @return */ public io.reactivex.rxjava3.core.Single rxSend(io.vertx.rxjava3.core.http.HttpClientRequest request) { return AsyncResultSingle.toSingle(delegate.send(request.getDelegate()), __value -> io.vertx.rxjava3.httpproxy.ProxyResponse.newInstance((io.vertx.httpproxy.ProxyResponse)__value)); } /** * Release the proxy request and its associated resources * *

The HTTP server request is resumed, no HTTP server response is sent. * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava3.httpproxy.ProxyRequest release() { delegate.release(); return this; } /** * @return the proxied HTTP server request */ public io.vertx.rxjava3.core.http.HttpServerRequest proxiedRequest() { io.vertx.rxjava3.core.http.HttpServerRequest ret = io.vertx.rxjava3.core.http.HttpServerRequest.newInstance((io.vertx.core.http.HttpServerRequest)delegate.proxiedRequest()); return ret; } /** * Create and return the proxy response. * @return the proxy response */ public io.vertx.rxjava3.httpproxy.ProxyResponse response() { io.vertx.rxjava3.httpproxy.ProxyResponse ret = io.vertx.rxjava3.httpproxy.ProxyResponse.newInstance((io.vertx.httpproxy.ProxyResponse)delegate.response()); return ret; } public static ProxyRequest newInstance(io.vertx.httpproxy.ProxyRequest arg) { return arg != null ? new ProxyRequest(arg) : null; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy