Codota Logo
Eventual.from
Code IndexAdd Codota to your IDE (free)

How to use
from
method
in
com.hotels.styx.api.Eventual

Best Java code snippets using com.hotels.styx.api.Eventual.from (Showing top 6 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: HotelsDotCom/styx

@Override
public Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain) {
  return chain.proceed(request)
      .flatMap(response -> Eventual.from(processAsynchronously(response, config.delayMillis())));
}
origin: HotelsDotCom/styx

/**
 * Aggregates content stream and converts this request to a {@link HttpRequest}.
 * <p>
 * Returns a {@link Eventual} that eventually produces a
 * {@link HttpRequest}. The resulting full request object has the same
 * request line, headers, and content as this request.
 * <p>
 * The content stream is aggregated asynchronously. The stream may be connected
 * to a network socket or some other content producer. Once aggregated, a
 * HttpRequest object is emitted on the returned {@link Eventual}.
 * <p>
 * A sole {@code maxContentBytes} argument is a backstop defence against excessively
 * long content streams. The {@code maxContentBytes} should be set to a sensible
 * value according to your application requirements and heap size. When the content
 * size stream exceeds the {@code maxContentBytes}, a @{link ContentOverflowException}
 * is emitted on the returned observable.
 *
 * @param maxContentBytes maximum expected content size
 * @return a {@link Eventual}
 */
public Eventual<HttpRequest> aggregate(int maxContentBytes) {
  return Eventual.from(
      body.aggregate(maxContentBytes)
        .thenApply(it -> new HttpRequest.Builder(this, decodeAndRelease(it)).build())
  );
}
origin: HotelsDotCom/styx

@Test
public void createFromCompletionStage() {
  CompletableFuture<String> future = new CompletableFuture<>();
  Eventual<String> eventual = Eventual.from(future);
  StepVerifier.create(eventual)
      .thenRequest(1)
      .expectNextCount(0)
      .then(() -> future.complete("hello"))
      .expectNext("hello")
      .verifyComplete();
}
origin: HotelsDotCom/styx

@Override
public Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain) {
  return chain.proceed(request)
      .flatMap(response ->  response.aggregate(this.maxContentLength))
      .flatMap(fullResponse -> Eventual.from(asyncEvent(this.delayMillis))
          .map(x -> fullResponse))
      .map(HttpResponse::stream);
}
origin: HotelsDotCom/styx

/**
 * Aggregates content stream and converts this response to a {@link HttpResponse}.
 * <p>
 * Returns a {@link Eventual <HttpResponse>} that eventually produces a
 * {@link HttpResponse}. The resulting full response object has the same
 * response line, headers, and content as this response.
 * <p>
 * The content stream is aggregated asynchronously. The stream may be connected
 * to a network socket or some other content producer. Once aggregated, a
 * HttpResponse object is emitted on the returned {@link Eventual}.
 * <p>
 * A sole {@code maxContentBytes} argument is a backstop defence against excessively
 * long content streams. The {@code maxContentBytes} should be set to a sensible
 * value according to your application requirements and heap size. When the content
 * size stream exceeds the {@code maxContentBytes}, a @{link ContentOverflowException}
 * is emitted on the returned observable.
 *
 * @param maxContentBytes maximum expected content size
 * @return a {@link Eventual}
 */
public Eventual<HttpResponse> aggregate(int maxContentBytes) {
  return Eventual.from(body.aggregate(maxContentBytes))
      .map(it -> new HttpResponse.Builder(this, decodeAndRelease(it))
        .disableValidation()
        .build()
      );
}
origin: HotelsDotCom/styx

  @Override
  public Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain) {
    return request.aggregate(config.maxContentLength())
            .flatMap(fullHttpRequest -> Eventual.from(asyncOperation(config.delayMillis())))
            .map(outcome -> request.newBuilder().header("X-Outcome", outcome.result()))
            .flatMap(x -> chain.proceed(request));
  }
}
com.hotels.styx.apiEventualfrom

Javadoc

Creates a new Eventual from a CompletionStage.

Popular methods of Eventual

  • of
    Creates a new Eventual object from given value.
  • map
    Transforms an element synchronously by applying a mapping function.
  • <init>
    Constructs a new Eventual object from an reactive streams Publisher.
  • flatMap
    Transform an element asynchronously by applying a mapping function.
  • error
    Creates a new (@link Eventual} that emits an error.
  • onError
    Transforms an error by applying an error handler function.
  • fromMono

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • getContentResolver (Context)
  • requestLocationUpdates (LocationManager)
  • Path (java.nio.file)
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • SortedSet (java.util)
    A Set that further provides a total ordering on its elements. The elements are ordered using their C
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now