All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.resteasy.reactive.server.handlers.InterceptorHandler Maven / Gradle / Ivy

There is a newer version: 3.17.5
Show newest version
package org.jboss.resteasy.reactive.server.handlers;

import jakarta.ws.rs.ext.ReaderInterceptor;
import jakarta.ws.rs.ext.WriterInterceptor;

import org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext;
import org.jboss.resteasy.reactive.server.spi.ServerRestHandler;

public class InterceptorHandler implements ServerRestHandler {

    private final WriterInterceptor[] writerInterceptors;
    private final ReaderInterceptor[] readerInterceptors;

    public InterceptorHandler(WriterInterceptor[] writerInterceptors, ReaderInterceptor[] readerInterceptors) {
        this.writerInterceptors = writerInterceptors;
        this.readerInterceptors = readerInterceptors;
    }

    @Override
    public void handle(ResteasyReactiveRequestContext requestContext) throws Exception {
        requestContext.setWriterInterceptors(writerInterceptors);
        requestContext.setReaderInterceptors(readerInterceptors);
    }

    public boolean hasWriterInterceptors() {
        return writerInterceptors != null && writerInterceptors.length > 0;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy