Skip to content

Commit

Permalink
REFACT :: FilterChainProxy ๊ฐœ์„ 
Browse files Browse the repository at this point in the history
  • Loading branch information
Daybreak312 committed Mar 22, 2024
1 parent 3ec8525 commit 3917008
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.info.maeumgagym.error.filter.filterchain

import com.info.maeumgagym.filter.chained.ChainedFilterChain
import com.info.maeumgagym.filter.chained.ChainedFilterChainProxy

class ExceptionChainedFilterChainProxy(
private val exceptionChainedFilterChain: ExceptionChainedFilterChain
) : ChainedFilterChainProxy() {
exceptionChainedFilterChain: ExceptionChainedFilterChain
) : ChainedFilterChainProxy<ExceptionChainedFilterChain>() {

override fun getFilterChain(): ChainedFilterChain = this.exceptionChainedFilterChain
override val filterChain: ExceptionChainedFilterChain = exceptionChainedFilterChain
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
package com.info.maeumgagym.filter.chained

import org.springframework.web.filter.GenericFilterBean
import javax.servlet.FilterChain
import javax.servlet.ServletRequest
import javax.servlet.ServletResponse
import com.info.maeumgagym.filter.global.GlobalFilterChainProxy

abstract class ChainedFilterChainProxy : GenericFilterBean() {
abstract class ChainedFilterChainProxy<out T : ChainedFilterChain> : GlobalFilterChainProxy<T>() {

abstract fun getFilterChain(): ChainedFilterChain

override fun doFilter(request: ServletRequest, response: ServletResponse, chain: FilterChain) {
val filterChain = this.getFilterChain()
filterChain.doFilterChained(request, response, chain)
}
abstract override val filterChain: T
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ import javax.servlet.ServletResponse
*
* @see GlobalFilterChain
*
* @param T ํ•ด๋‹น Proxy ํด๋ž˜์Šค๊ฐ€ ๋Œ€๋ฆฌํ•˜๊ณ  ์žˆ๋Š” FilterChain
*
* @author Daybreak312
* @since 21-03-2024
*/
abstract class GlobalFilterChainProxy : GenericFilterBean() {
abstract class GlobalFilterChainProxy<out T : GlobalFilterChain> : GenericFilterBean() {

protected abstract val filterChain: GlobalFilterChain
protected abstract val filterChain: T

override fun doFilter(request: ServletRequest, response: ServletResponse, chain: FilterChain) {
filterChain.doFilter(request, response)
this.filterChain.doFilter(request, response)
}
}

0 comments on commit 3917008

Please sign in to comment.