public static Observable<HttpClientResponse<ByteBuf>> createHttpGet(String uri) { return createHttpRequest(HttpClientRequest.createGet(uri)); }
public static Observable<HttpClientResponse<ByteBuf>> createHttpDelete(String uri) { return createHttpRequest(HttpClientRequest.createDelete(uri)); }
public static Observable<HttpClientResponse<ByteBuf>> createHttpGet(String uri) { return createHttpRequest(HttpClientRequest.createGet(uri)); }
public static Observable<HttpClientResponse<ByteBuf>> createHttpDelete(String uri) { return createHttpRequest(HttpClientRequest.createDelete(uri)); }
public static Observable<HttpClientResponse<ByteBuf>> createHttpPost(String uri, Observable<ByteBuf> content) { return createHttpRequest(HttpClientRequest.createPost(uri).withContentSource(content)); }
public static <T> Observable<HttpClientResponse<ByteBuf>> createHttpPost(String uri, Observable<T> content, ContentTransformer<T> transformer) { return createHttpRequest(HttpClientRequest.createPost(uri).withRawContentSource(content, transformer)); }
public static <T> Observable<HttpClientResponse<ByteBuf>> createHttpPut(String uri, Observable<T> content, ContentTransformer<T> transformer) { return createHttpRequest(HttpClientRequest.createPut(uri).withRawContentSource(content, transformer)); }
public static <T> Observable<HttpClientResponse<ByteBuf>> createHttpPut(String uri, Observable<T> content, ContentTransformer<T> transformer) { return createHttpRequest(HttpClientRequest.createPut(uri).withRawContentSource(content, transformer)); }
public static <T> Observable<HttpClientResponse<ByteBuf>> createHttpPost(String uri, Observable<T> content, ContentTransformer<T> transformer) { return createHttpRequest(HttpClientRequest.createPost(uri).withRawContentSource(content, transformer)); }
public static Observable<HttpClientResponse<ByteBuf>> createHttpPut(String uri, Observable<ByteBuf> content) { return createHttpRequest(HttpClientRequest.createPut(uri).withContentSource(content)); }
public static Observable<HttpClientResponse<ByteBuf>> createHttpPut(String uri, Observable<ByteBuf> content) { return createHttpRequest(HttpClientRequest.createPut(uri).withContentSource(content)); }
public static Observable<HttpClientResponse<ByteBuf>> createHttpPost(String uri, Observable<ByteBuf> content) { return createHttpRequest(HttpClientRequest.createPost(uri).withContentSource(content)); }
/** * The Mesos HTTP Scheduler API will send a redirect to a client if it is not the leader. The client that is * constructed during {@link #openStream} is bound to a specific host and port, due to this behavior * we "probe" Mesos to try and find out where it's "master" is before we configure the client. * * This method will attempt to send a simple GET to {@code mesosUri}, however instead of going to the path * specified, it will go to {@code /redirect} and construct a uri relative to mesosUri using the host and port * returned in the Location header of the response. */ @NotNull private static URI resolveMesosUri(final @NotNull URI mesosUri) { final String redirectUri = createRedirectUri(mesosUri); LOGGER.info("Probing Mesos server at {}", redirectUri); // When sending an individual request (rather than creating a client) RxNetty WILL follow redirects, // so here we tell it not to do that for this request by creating the config object below. final HttpClient.HttpClientConfig config = HttpClient.HttpClientConfig.Builder.fromDefaultConfig() .setFollowRedirect(false) .build(); final HttpClientResponse<ByteBuf> redirectResponse = RxNetty.createHttpRequest(HttpClientRequest.createGet(redirectUri), config) .toBlocking() .first(); return getUriFromRedirectResponse(mesosUri, redirectResponse); }
/** * The Mesos HTTP Scheduler API will send a redirect to a client if it is not the leader. The client that is * constructed during {@link #openStream} is bound to a specific host and port, due to this behavior * we "probe" Mesos to try and find out where it's "master" is before we configure the client. * * This method will attempt to send a simple GET to {@code mesosUri}, however instead of going to the path * specified, it will go to {@code /redirect} and construct a uri relative to mesosUri using the host and port * returned in the Location header of the response. */ @NotNull private static URI resolveMesosUri(final @NotNull URI mesosUri) { final String redirectUri = createRedirectUri(mesosUri); LOGGER.info("Probing Mesos server at {}", redirectUri); // When sending an individual request (rather than creating a client) RxNetty WILL follow redirects, // so here we tell it not to do that for this request by creating the config object below. final HttpClient.HttpClientConfig config = HttpClient.HttpClientConfig.Builder.fromDefaultConfig() .setFollowRedirect(false) .build(); final HttpClientResponse<ByteBuf> redirectResponse = RxNetty.createHttpRequest(HttpClientRequest.createGet(redirectUri), config) .toBlocking() .first(); return getUriFromRedirectResponse(mesosUri, redirectResponse); }