-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
22 changed files
with
703 additions
and
366 deletions.
There are no files selected for viewing
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
95 changes: 54 additions & 41 deletions
95
src/main/kotlin/com/KY/KoreanYoutube/config/SecurityConfig.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
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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
package com.KY.KoreanYoutube.config | ||
|
||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.web.servlet.config.annotation.CorsRegistry | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer | ||
|
||
|
||
@Configuration | ||
class WebConfig : WebMvcConfigurer { | ||
override fun addCorsMappings(registry: CorsRegistry) { | ||
registry.addMapping("/**") | ||
.allowedOrigins("*") | ||
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") | ||
.allowedHeaders("*") | ||
.allowCredentials(false) | ||
.maxAge(3600) | ||
} | ||
} | ||
// | ||
//import org.springframework.context.annotation.Configuration | ||
//import org.springframework.web.servlet.config.annotation.CorsRegistry | ||
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer | ||
// | ||
// | ||
//@Configuration | ||
//class WebConfig : WebMvcConfigurer { | ||
// override fun addCorsMappings(registry: CorsRegistry) { | ||
// registry.addMapping("/**") | ||
// .allowedOrigins("*") | ||
// .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") | ||
// .allowedHeaders("*") | ||
// .allowCredentials(false) | ||
// .maxAge(3600) | ||
// } | ||
//} |
68 changes: 68 additions & 0 deletions
68
src/main/kotlin/com/KY/KoreanYoutube/config/WebFluxConfig.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,68 @@ | ||
package com.KY.KoreanYoutube.config | ||
|
||
import org.springframework.context.ApplicationContext | ||
import org.springframework.context.ApplicationContextAware | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.web.reactive.config.CorsRegistry | ||
import org.springframework.web.reactive.config.EnableWebFlux | ||
import org.springframework.web.reactive.config.ViewResolverRegistry | ||
import org.springframework.web.reactive.config.WebFluxConfigurer | ||
import org.thymeleaf.spring6.ISpringWebFluxTemplateEngine | ||
import org.thymeleaf.spring6.SpringWebFluxTemplateEngine | ||
import org.thymeleaf.spring6.templateresolver.SpringResourceTemplateResolver | ||
import org.thymeleaf.spring6.view.reactive.ThymeleafReactiveViewResolver | ||
import org.thymeleaf.templatemode.TemplateMode | ||
|
||
|
||
@Configuration | ||
@EnableWebFlux | ||
class WebFluxConfig( | ||
private var ctx : ApplicationContext | ||
) : ApplicationContextAware, WebFluxConfigurer{ | ||
|
||
override fun setApplicationContext(applicationContext: ApplicationContext) { | ||
ctx = applicationContext | ||
} | ||
@Bean | ||
fun thymeleafTemplateResolver(): SpringResourceTemplateResolver { | ||
val resolver = SpringResourceTemplateResolver() | ||
resolver.setApplicationContext(this.ctx) | ||
resolver.prefix = "classpath:/templates/" | ||
resolver.suffix = ".html" | ||
resolver.templateMode = TemplateMode.HTML | ||
resolver.isCacheable = false | ||
resolver.checkExistence = false | ||
return resolver | ||
} | ||
|
||
@Bean | ||
fun thymeleafTemplateEngine(): ISpringWebFluxTemplateEngine { | ||
val templateEngine = SpringWebFluxTemplateEngine() | ||
templateEngine.setTemplateResolver(thymeleafTemplateResolver()) | ||
return templateEngine | ||
} | ||
|
||
@Bean | ||
fun thymeleafChunkedAndDataDrivenViewResolver(): ThymeleafReactiveViewResolver { | ||
val viewResolver = ThymeleafReactiveViewResolver() | ||
viewResolver.templateEngine = thymeleafTemplateEngine() | ||
viewResolver.responseMaxChunkSizeBytes = 8192 | ||
return viewResolver | ||
} | ||
|
||
override fun configureViewResolvers(registry: ViewResolverRegistry) { | ||
registry.viewResolver(thymeleafChunkedAndDataDrivenViewResolver()) | ||
} | ||
|
||
override fun addCorsMappings(registry: CorsRegistry) { | ||
registry.addMapping("/**") | ||
.allowedOrigins("*") | ||
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") | ||
.allowedHeaders("*") | ||
.allowCredentials(false) | ||
.maxAge(3600) | ||
} | ||
|
||
|
||
} |
3 changes: 3 additions & 0 deletions
3
src/main/kotlin/com/KY/KoreanYoutube/dto/VideoDetailResponseDTO.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,3 @@ | ||
package com.KY.KoreanYoutube.dto | ||
|
||
data class VideoDetailResponseDTO() |
63 changes: 36 additions & 27 deletions
63
src/main/kotlin/com/KY/KoreanYoutube/main/MainController.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
Oops, something went wrong.