Class 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 the HttpContentProcessor interface that deals with limiting file upload sizes.
    Since:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected long advertisedLength  
      protected io.micronaut.http.server.HttpServerConfiguration configuration  
      protected NettyHttpRequest<?> nettyHttpRequest  
      protected java.util.concurrent.atomic.AtomicLong receivedLength  
      protected long requestMaxSize  
      • Fields inherited from class io.micronaut.core.async.processor.SingleSubscriberProcessor

        EMPTY_SUBSCRIPTION, parentSubscription
      • Fields inherited from class io.micronaut.core.async.subscriber.CompletionAwareSubscriber

        subscription
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doOnNext​(io.netty.buffer.ByteBufHolder message)  
      protected void doSubscribe​(org.reactivestreams.Subscriber<? super T> subscriber)  
      protected void fireExceedsLength​(long receivedLength, long expected, io.netty.buffer.ByteBufHolder message)  
      protected abstract void onData​(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
      • Methods inherited from interface org.reactivestreams.Publisher

        subscribe
      • Methods inherited from interface org.reactivestreams.Subscriber

        onComplete, onError, onNext, onSubscribe
      • Methods inherited from interface io.micronaut.core.util.Toggleable

        isEnabled
    • Field Detail

      • 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 - The NettyHttpRequest
        configuration - The HttpServerConfiguration
    • 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:
        doSubscribe in class io.micronaut.core.async.processor.SingleSubscriberProcessor<io.netty.buffer.ByteBufHolder,​T>
      • doOnNext

        protected final void doOnNext​(io.netty.buffer.ByteBufHolder message)
        Specified by:
        doOnNext in class io.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 received
        expected - The expected length of the content
        message - The message to release