Package io.micronaut.http.server.netty
Class AbstractHttpContentProcessor<T>
- java.lang.Object
-
- io.micronaut.core.async.subscriber.CompletionAwareSubscriber<T>
-
- io.micronaut.core.async.processor.SingleSubscriberProcessor<io.netty.buffer.ByteBufHolder,T>
-
- io.micronaut.http.server.netty.AbstractHttpContentProcessor<T>
-
- Type Parameters:
T- The type
- All Implemented Interfaces:
io.micronaut.core.async.publisher.Publishers.MicronautPublisher<T>,io.micronaut.core.async.subscriber.Completable,io.micronaut.core.async.subscriber.Emitter<io.netty.buffer.ByteBufHolder>,io.micronaut.core.util.Toggleable,HttpContentProcessor<T>,org.reactivestreams.Processor<io.netty.buffer.ByteBufHolder,T>,org.reactivestreams.Publisher<T>,org.reactivestreams.Subscriber<io.netty.buffer.ByteBufHolder>
- Direct Known Subclasses:
FormDataHttpContentProcessor,JsonContentProcessor
@Internal public abstract class AbstractHttpContentProcessor<T> extends io.micronaut.core.async.processor.SingleSubscriberProcessor<io.netty.buffer.ByteBufHolder,T> implements HttpContentProcessor<T>
Abstract implementation of theHttpContentProcessorinterface that deals with limiting file upload sizes.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description protected longadvertisedLengthprotected io.micronaut.http.server.HttpServerConfigurationconfigurationprotected NettyHttpRequest<?>nettyHttpRequestprotected java.util.concurrent.atomic.AtomicLongreceivedLengthprotected longrequestMaxSize
-
Constructor Summary
Constructors Constructor Description AbstractHttpContentProcessor(NettyHttpRequest<?> nettyHttpRequest, io.micronaut.http.server.HttpServerConfiguration configuration)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voiddoOnNext(io.netty.buffer.ByteBufHolder message)protected voiddoSubscribe(org.reactivestreams.Subscriber<? super T> subscriber)protected voidfireExceedsLength(long receivedLength, long expected, io.netty.buffer.ByteBufHolder message)protected abstract voidonData(io.netty.buffer.ByteBufHolder message)Called after verifying the data of the message.-
Methods inherited from class io.micronaut.core.async.processor.SingleSubscriberProcessor
currentSubscriber, doAfterComplete, doAfterOnError, doAfterOnSubscribe, doOnComplete, doOnError, doOnSubscribe, doOnSubscribe, getSubscriber, subscribe
-
Methods inherited from class io.micronaut.core.async.subscriber.CompletionAwareSubscriber
isComplete, onComplete, onError, onNext, onSubscribe
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Field Detail
-
nettyHttpRequest
protected final NettyHttpRequest<?> nettyHttpRequest
-
advertisedLength
protected final long advertisedLength
-
requestMaxSize
protected final long requestMaxSize
-
receivedLength
protected final java.util.concurrent.atomic.AtomicLong receivedLength
-
configuration
protected final io.micronaut.http.server.HttpServerConfiguration configuration
-
-
Constructor Detail
-
AbstractHttpContentProcessor
public AbstractHttpContentProcessor(NettyHttpRequest<?> nettyHttpRequest, io.micronaut.http.server.HttpServerConfiguration configuration)
- Parameters:
nettyHttpRequest- TheNettyHttpRequestconfiguration- TheHttpServerConfiguration
-
-
Method Detail
-
onData
protected abstract void onData(io.netty.buffer.ByteBufHolder message)
Called after verifying the data of the message.- Parameters:
message- The message
-
doSubscribe
protected final void doSubscribe(org.reactivestreams.Subscriber<? super T> subscriber)
- Specified by:
doSubscribein classio.micronaut.core.async.processor.SingleSubscriberProcessor<io.netty.buffer.ByteBufHolder,T>
-
doOnNext
protected final void doOnNext(io.netty.buffer.ByteBufHolder message)
- Specified by:
doOnNextin classio.micronaut.core.async.subscriber.CompletionAwareSubscriber<io.netty.buffer.ByteBufHolder>
-
fireExceedsLength
protected void fireExceedsLength(long receivedLength, long expected, io.netty.buffer.ByteBufHolder message)- Parameters:
receivedLength- The length of the content receivedexpected- The expected length of the contentmessage- The message to release
-
-