@Override public Accumulator<ByteString, F.Either<Result, A>> apply(Http.RequestHeader request) { Flow<ByteString, ByteString, Future<MaxSizeStatus>> takeUpToFlow = Flow.fromGraph(play.api.mvc.BodyParsers$.MODULE$.takeUpTo(maxLength)); Sink<ByteString, CompletionStage<F.Either<Result, A>>> result = apply1(request).toSink(); return Accumulator.fromSink(takeUpToFlow.toMat(result, (statusFuture, resultFuture) -> FutureConverters.toJava(statusFuture).thenCompose(status -> { if (status instanceof MaxSizeNotExceeded$) { return resultFuture; } else { return errorHandler.onClientError(request, Status$.MODULE$.REQUEST_ENTITY_TOO_LARGE(), "Request entity too large") .thenApply(F.Either::<Result, A>Left); } }) )); }
@Override public Accumulator<ByteString, F.Either<Result, A>> apply(Http.RequestHeader request) { Flow<ByteString, ByteString, Future<MaxSizeStatus>> takeUpToFlow = Flow.fromGraph(play.api.mvc.BodyParsers$.MODULE$.takeUpTo(maxLength)); Sink<ByteString, CompletionStage<F.Either<Result, A>>> result = apply1(request).toSink(); return Accumulator.fromSink(takeUpToFlow.toMat(result, (statusFuture, resultFuture) -> FutureConverters.toJava(statusFuture).thenCompose(status -> { if (status instanceof MaxSizeNotExceeded$) { return resultFuture; } else { return errorHandler.onClientError(request, Status$.MODULE$.REQUEST_ENTITY_TOO_LARGE(), "Request entity too large") .thenApply(F.Either::<Result, A>Left); } }) )); }
@Override public Accumulator<ByteString, F.Either<Result, A>> apply(Http.RequestHeader request) { Flow<ByteString, ByteString, Future<MaxSizeStatus>> takeUpToFlow = Flow.fromGraph(play.api.mvc.BodyParsers$.MODULE$.takeUpTo(maxLength)); Sink<ByteString, CompletionStage<F.Either<Result, A>>> result = apply1(request).toSink(); return Accumulator.fromSink(takeUpToFlow.toMat(result, (statusFuture, resultFuture) -> FutureConverters.toJava(statusFuture).thenCompose(status -> { if (status instanceof MaxSizeNotExceeded$) { return resultFuture; } else { return errorHandler.onClientError(request, Status$.MODULE$.REQUEST_ENTITY_TOO_LARGE(), "Request entity too large") .thenApply(F.Either::<Result, A>Left); } }) )); }
public <D> Accumulator<D, A> through(Flow<D, E, ?> flow) { return new SinkAccumulator<>(flow.toMat(toSink, Keep.right())); }
public <D> Accumulator<D, A> through(Flow<D, E, ?> flow) { return new SinkAccumulator<>(flow.toMat(toSink, Keep.right())); }
public <D> Accumulator<D, A> through(Flow<D, E, ?> flow) { return new SinkAccumulator<>(flow.toMat(sink, Keep.right())); }
public <D> Accumulator<D, A> through(Flow<D, E, ?> flow) { return new SinkAccumulator<>(flow.toMat(sink, Keep.right())); }