-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
311cb3f
commit 7b68f9a
Showing
9 changed files
with
48 additions
and
53 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
src/backend/media/biz-media/src/main/kotlin/com/tencent/bkrepo/media/config/WebConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.tencent.bkrepo.media.config | ||
|
||
import com.tencent.bkrepo.media.web.PluginDelegateFilter | ||
import org.springframework.boot.web.servlet.FilterRegistrationBean | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
|
||
@Configuration | ||
class WebConfig { | ||
@Bean | ||
fun pluginDelegateFilter(): FilterRegistrationBean<PluginDelegateFilter> { | ||
val registrationBean = FilterRegistrationBean<PluginDelegateFilter>() | ||
registrationBean.filter = PluginDelegateFilter() | ||
return registrationBean | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...kend/media/biz-media/src/main/kotlin/com/tencent/bkrepo/media/web/PluginDelegateFilter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.tencent.bkrepo.media.web | ||
|
||
import javax.servlet.Filter | ||
import javax.servlet.FilterChain | ||
import javax.servlet.ServletRequest | ||
import javax.servlet.ServletResponse | ||
|
||
class PluginDelegateFilter : Filter { | ||
override fun doFilter(request: ServletRequest, response: ServletResponse, chain: FilterChain) { | ||
if (delegate != null) { | ||
delegate!!.doFilter(request, response, chain) | ||
} else { | ||
chain.doFilter(request, response) | ||
} | ||
} | ||
|
||
companion object { | ||
var delegate: Filter? = null | ||
} | ||
} |