org.jboss.resteasy.reactive.common.model.ResourceInterceptors Maven / Gradle / Ivy
package org.jboss.resteasy.reactive.common.model;
import java.util.function.Function;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.ext.ReaderInterceptor;
import javax.ws.rs.ext.WriterInterceptor;
import org.jboss.resteasy.reactive.spi.BeanFactory;
public class ResourceInterceptors {
private InterceptorContainer containerResponseFilters = new InterceptorContainer.Reversed<>();
private PreMatchInterceptorContainer containerRequestFilters = new PreMatchInterceptorContainer<>();
private InterceptorContainer writerInterceptors = new InterceptorContainer<>();
private InterceptorContainer readerInterceptors = new InterceptorContainer<>();
public InterceptorContainer getContainerResponseFilters() {
return containerResponseFilters;
}
public ResourceInterceptors setContainerResponseFilters(
InterceptorContainer containerResponseFilters) {
this.containerResponseFilters = containerResponseFilters;
return this;
}
public PreMatchInterceptorContainer getContainerRequestFilters() {
return containerRequestFilters;
}
public ResourceInterceptors setContainerRequestFilters(
PreMatchInterceptorContainer containerRequestFilters) {
this.containerRequestFilters = containerRequestFilters;
return this;
}
public InterceptorContainer getWriterInterceptors() {
return writerInterceptors;
}
public ResourceInterceptors setWriterInterceptors(InterceptorContainer writerInterceptors) {
this.writerInterceptors = writerInterceptors;
return this;
}
public InterceptorContainer getReaderInterceptors() {
return readerInterceptors;
}
public ResourceInterceptors setReaderInterceptors(InterceptorContainer readerInterceptors) {
this.readerInterceptors = readerInterceptors;
return this;
}
public void initializeDefaultFactories(Function> factoryCreator) {
containerRequestFilters.initializeDefaultFactories(factoryCreator);
containerResponseFilters.initializeDefaultFactories(factoryCreator);
readerInterceptors.initializeDefaultFactories(factoryCreator);
writerInterceptors.initializeDefaultFactories(factoryCreator);
}
// we sort this at build time as the order of the elements in the lists is retained in generated bytecode
// therefore at runtime the elements are already properly sorted
public ResourceInterceptors sort() {
containerRequestFilters.sort();
containerResponseFilters.sort();
writerInterceptors.sort();
readerInterceptors.sort();
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy