pcp-ui-service: удалить мёртвый реактивный CorsFilterComponent (сервлет-стек его не вызывает)
This commit is contained in:
-32
@@ -7,38 +7,6 @@ import org.springframework.web.filter.CorsFilter
|
|||||||
import org.springframework.web.servlet.config.annotation.CorsRegistry
|
import org.springframework.web.servlet.config.annotation.CorsRegistry
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
|
||||||
|
|
||||||
import org.springframework.stereotype.Component
|
|
||||||
import org.springframework.web.server.ServerWebExchange
|
|
||||||
import org.springframework.web.server.WebFilter
|
|
||||||
import org.springframework.web.server.WebFilterChain
|
|
||||||
import reactor.core.publisher.Mono
|
|
||||||
|
|
||||||
|
|
||||||
@Component
|
|
||||||
class CorsFilterComponent : WebFilter {
|
|
||||||
|
|
||||||
override fun filter(ctx: ServerWebExchange, chain: WebFilterChain): Mono<Void> {
|
|
||||||
if (ctx != null) {
|
|
||||||
ctx.response.headers.add("Access-Control-Allow-Origin", "*")
|
|
||||||
ctx.response.headers.add("Access-Control-Allow-Methods", "GET, PUT, POST, DELETE, OPTIONS")
|
|
||||||
ctx.response.headers.add(
|
|
||||||
"Access-Control-Allow-Headers",
|
|
||||||
"DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range"
|
|
||||||
)
|
|
||||||
ctx.response.headers.add(
|
|
||||||
"Access-Control-Expose-Headers",
|
|
||||||
"DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range"
|
|
||||||
)
|
|
||||||
return chain?.filter(ctx) ?: Mono.empty()
|
|
||||||
|
|
||||||
} else {
|
|
||||||
return chain?.filter(ctx) ?: Mono.empty()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
class WebConfig : WebMvcConfigurer {
|
class WebConfig : WebMvcConfigurer {
|
||||||
Reference in New Issue
Block a user