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

org.zodiac.sentinel.base.config.web.ReactiveSentinelConfigurer Maven / Gradle / Ivy

package org.zodiac.sentinel.base.config.web;

import java.util.List;

import org.springframework.http.codec.ServerCodecConfigurer;
import org.springframework.web.reactive.result.view.ViewResolver;
import org.zodiac.sentinel.base.client.callback.reactive.ReactivePlatformBlockFallbackHandler;

import com.alibaba.csp.sentinel.adapter.spring.webflux.SentinelWebFluxFilter;
import com.alibaba.csp.sentinel.adapter.spring.webflux.callback.BlockRequestHandler;
import com.alibaba.csp.sentinel.adapter.spring.webflux.exception.SentinelBlockExceptionHandler;

public class ReactiveSentinelConfigurer {

    private final List viewResolvers;

    private final ServerCodecConfigurer serverCodecConfigurer;

    public ReactiveSentinelConfigurer(List viewResolvers, ServerCodecConfigurer serverCodecConfigurer) {
        this.viewResolvers = viewResolvers;
        this.serverCodecConfigurer = serverCodecConfigurer;
    }

    public BlockRequestHandler blockRequestHandler() {
        return new ReactivePlatformBlockFallbackHandler();
    }

    public SentinelBlockExceptionHandler sentinelBlockExceptionHandler() {
        return new SentinelBlockExceptionHandler(viewResolvers, serverCodecConfigurer);
    }

    public SentinelWebFluxFilter sentinelWebFluxFilter() {
        return new SentinelWebFluxFilter();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy