diff --git a/commons-core/pom.xml b/commons-core/pom.xml
index 6ffb34e..2de377e 100644
--- a/commons-core/pom.xml
+++ b/commons-core/pom.xml
@@ -7,11 +7,11 @@
ru.sokomishalov.commons
commons-parent
- 1.0.24
+ 1.0.25
commons-core
- 1.0.24
+ 1.0.25
1.3.61
@@ -27,12 +27,12 @@
1.7.29
1.2.3
4.1.0
- 4.8.57
1.12.1
+
org.jetbrains.kotlin
kotlin-stdlib-jdk8
@@ -43,11 +43,6 @@
kotlin-reflect
${kotlin.version}
-
- org.jetbrains.kotlinx
- kotlinx-coroutines-core-common
- ${kotlinx.version}
-
org.jetbrains.kotlinx
kotlinx-coroutines-core
@@ -79,22 +74,7 @@
reactor-netty
${reactor-netty.version}
-
- io.projectreactor.addons
- reactor-extra
- ${reactor-addons.version}
-
-
- io.projectreactor.addons
- reactor-adapter
- ${reactor.version}
-
-
- com.fasterxml.jackson.core
- jackson-core
- ${jackson.version}
-
com.fasterxml.jackson.core
jackson-databind
@@ -115,65 +95,44 @@
jackson-datatype-jsr310
${jackson.version}
-
- com.fasterxml.jackson.datatype
- jackson-datatype-guava
- ${jackson.version}
-
-
- com.fasterxml.jackson.dataformat
- jackson-dataformat-yaml
- ${jackson.version}
-
org.apache.commons
commons-lang3
${commons-lang.version}
-
- commons-io
- commons-io
- ${commons-io.version}
-
-
- org.apache.commons
- commons-collections4
- ${commons-collections.version}
-
- com.google.guava
- guava
- ${guava.version}
+ org.slf4j
+ slf4j-api
+ ${slf4j.version}
-
- io.github.classgraph
- classgraph
- ${classgraph.version}
-
+
org.jeasy
easy-random-core
${easy-random.version}
-
-
-
- org.slf4j
- slf4j-api
- ${slf4j.version}
+ true
org.jsoup
jsoup
${jsoup.version}
+ true
+
+ commons-io
+ commons-io
+ ${commons-io.version}
+ true
+
+
ch.qos.logback
logback-classic
diff --git a/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/collections/IterableUtils.kt b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/collections/CoroutineIterableUtils.kt
similarity index 100%
rename from commons-core/src/main/kotlin/ru/sokomishalov/commons/core/collections/IterableUtils.kt
rename to commons-core/src/main/kotlin/ru/sokomishalov/commons/core/collections/CoroutineIterableUtils.kt
diff --git a/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/collections/MapUtils.kt b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/collections/MapUtils.kt
index cc09c9c..b053c99 100644
--- a/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/collections/MapUtils.kt
+++ b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/collections/MapUtils.kt
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-@file:Suppress("unused", "NOTHING_TO_INLINE")
+@file:Suppress("unused")
package ru.sokomishalov.commons.core.collections
@@ -22,14 +22,6 @@ package ru.sokomishalov.commons.core.collections
* @author sokomishalov
*/
-inline fun Map?.isNullOrEmpty(): Boolean {
- return this == null || isEmpty()
-}
-
-inline fun Map?.isNotNullOrEmpty(): Boolean {
- return (this == null || isEmpty()).not()
-}
-
infix fun Map.containsEntryFrom(other: Map): Boolean {
return this.entries.intersect(other.entries).isNullOrEmpty().not()
}
diff --git a/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/common/Common.kt b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/common/Common.kt
index 56ad97a..f1755c8 100644
--- a/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/common/Common.kt
+++ b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/common/Common.kt
@@ -21,4 +21,6 @@ package ru.sokomishalov.commons.core.common
/**
* @author sokomishalov
*/
-fun Any?.unit() {}
+fun Any?.unit(): Unit = Unit
+
+fun Any?.void(): Void? = null
diff --git a/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/log/CustomLoggerFactory.kt b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/log/CustomLoggerFactory.kt
index d218e3e..03901b0 100644
--- a/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/log/CustomLoggerFactory.kt
+++ b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/log/CustomLoggerFactory.kt
@@ -15,7 +15,6 @@
*/
package ru.sokomishalov.commons.core.log
-import io.github.classgraph.ClassGraph
import org.slf4j.Logger
import java.util.concurrent.ConcurrentHashMap
@@ -26,16 +25,6 @@ object CustomLoggerFactory {
private val loggersMap: MutableMap = ConcurrentHashMap()
- init {
- ClassGraph()
- .enableClassInfo()
- .disableJarScanning()
- .scan()
- .getClassesImplementing(Loggable::class.java.name)
- .names
- .forEach { loggersMap[it] = loggerFor(it) }
- }
-
fun getLogger(clazz: Class): Logger {
val logger = loggersMap[clazz.name]
return when {
diff --git a/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/random/RandomUtils.kt b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/random/JEasyRandomUtils.kt
similarity index 87%
rename from commons-core/src/main/kotlin/ru/sokomishalov/commons/core/random/RandomUtils.kt
rename to commons-core/src/main/kotlin/ru/sokomishalov/commons/core/random/JEasyRandomUtils.kt
index 2535d30..d9c8434 100644
--- a/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/random/RandomUtils.kt
+++ b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/random/JEasyRandomUtils.kt
@@ -17,7 +17,6 @@
package ru.sokomishalov.commons.core.random
-import org.apache.commons.lang3.RandomStringUtils.random
import org.jeasy.random.EasyRandom
import org.jeasy.random.EasyRandomParameters
import java.nio.charset.StandardCharsets.UTF_8
@@ -45,10 +44,4 @@ inline fun randomPojoSequence(params: EasyRandomParameters = EASY_RA
while (true) {
yield(randomPojo(params))
}
-}
-
-fun randomString(
- length: Int = 20,
- useLetters: Boolean = true,
- useDigits: Boolean = false
-): String = random(length, useLetters, useDigits)
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/random/RandomStringUtils.kt b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/random/RandomStringUtils.kt
new file mode 100644
index 0000000..137dfad
--- /dev/null
+++ b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/random/RandomStringUtils.kt
@@ -0,0 +1,30 @@
+/**
+ * Copyright 2019-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+@file:Suppress("unused")
+
+package ru.sokomishalov.commons.core.random
+
+import org.apache.commons.lang3.RandomStringUtils.random
+
+/**
+ * @author sokomishalov
+ */
+
+fun randomString(
+ length: Int = 20,
+ useLetters: Boolean = true,
+ useDigits: Boolean = false
+): String = random(length, useLetters, useDigits)
\ No newline at end of file
diff --git a/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/serialization/ObjectMapperHelper.kt b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/serialization/ObjectMapperHelper.kt
index dcc97bc..bff8e8c 100644
--- a/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/serialization/ObjectMapperHelper.kt
+++ b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/serialization/ObjectMapperHelper.kt
@@ -24,11 +24,9 @@ import com.fasterxml.jackson.databind.MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUM
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.PropertyNamingStrategy
import com.fasterxml.jackson.databind.PropertyNamingStrategy.LOWER_CAMEL_CASE
-import com.fasterxml.jackson.databind.PropertyNamingStrategy.SNAKE_CASE
import com.fasterxml.jackson.databind.SerializationFeature.FAIL_ON_EMPTY_BEANS
import com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS
-import com.fasterxml.jackson.dataformat.yaml.YAMLFactory
-import com.fasterxml.jackson.datatype.guava.GuavaModule
+import com.fasterxml.jackson.datatype.jdk8.Jdk8Module
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import com.fasterxml.jackson.module.kotlin.registerKotlinModule
@@ -38,10 +36,6 @@ import com.fasterxml.jackson.module.kotlin.registerKotlinModule
*/
val OBJECT_MAPPER: ObjectMapper = buildComplexObjectMapper()
-val SNAKE_CASE_OBJECT_MAPPER: ObjectMapper = buildComplexObjectMapper(namingStrategy = SNAKE_CASE)
-
-val YAML_OBJECT_MAPPER: ObjectMapper = buildComplexObjectMapper(YAMLFactory())
-
fun buildComplexObjectMapper(
factory: JsonFactory? = null,
namingStrategy: PropertyNamingStrategy = LOWER_CAMEL_CASE
@@ -49,7 +43,7 @@ fun buildComplexObjectMapper(
return ObjectMapper(factory)
.registerKotlinModule()
.registerModule(JavaTimeModule())
- .registerModule(GuavaModule())
+ .registerModule(Jdk8Module())
.enable(
READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE,
ACCEPT_SINGLE_VALUE_AS_ARRAY,
diff --git a/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/string/StringUtils.kt b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/string/StringUtils.kt
index d071417..3e53064 100644
--- a/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/string/StringUtils.kt
+++ b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/string/StringUtils.kt
@@ -30,4 +30,76 @@ inline fun CharSequence?.isNotNullOrBlank(): Boolean {
returns(true) implies (this@isNotNullOrBlank != null)
}
return (this == null || this.isBlank()).not()
+}
+
+
+// https://stackoverflow.com/a/1248627/5843129
+fun String.convertGlobToRegex(): Regex {
+ val sb = StringBuilder(length)
+ var inGroup = 0
+ var inClass = 0
+ var firstIndexInClass = -1
+ val arr = toCharArray()
+ var i = 0
+ while (i < arr.size) {
+ when (val ch = arr[i]) {
+ '\\' -> if (++i >= arr.size) {
+ sb.append('\\')
+ } else {
+ val next = arr[i]
+ when (next) {
+ ',' -> {
+ }
+ 'Q', 'E' -> {
+ // extra escape needed
+ sb.append('\\')
+ sb.append('\\')
+ }
+ else -> sb.append('\\')
+ }// escape not needed
+ sb.append(next)
+ }
+ '*' -> if (inClass == 0)
+ sb.append(".*")
+ else
+ sb.append('*')
+ '?' -> if (inClass == 0)
+ sb.append('.')
+ else
+ sb.append('?')
+ '[' -> {
+ inClass++
+ firstIndexInClass = i + 1
+ sb.append('[')
+ }
+ ']' -> {
+ inClass--
+ sb.append(']')
+ }
+ '.', '(', ')', '+', '|', '^', '$', '@', '%' -> {
+ if (inClass == 0 || firstIndexInClass == i && ch == '^')
+ sb.append('\\')
+ sb.append(ch)
+ }
+ '!' -> if (firstIndexInClass == i)
+ sb.append('^')
+ else
+ sb.append('!')
+ '{' -> {
+ inGroup++
+ sb.append('(')
+ }
+ '}' -> {
+ inGroup--
+ sb.append(')')
+ }
+ ',' -> if (inGroup > 0)
+ sb.append('|')
+ else
+ sb.append(',')
+ else -> sb.append(ch)
+ }
+ i++
+ }
+ return sb.toString().toRegex()
}
\ No newline at end of file
diff --git a/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/url/UrlUtils.kt b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/url/UrlUtils.kt
index e8c081c..5052e12 100644
--- a/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/url/UrlUtils.kt
+++ b/commons-core/src/main/kotlin/ru/sokomishalov/commons/core/url/UrlUtils.kt
@@ -13,18 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-@file:Suppress("unused")
-
package ru.sokomishalov.commons.core.url
-import org.apache.commons.lang3.SystemUtils.getHostName
import ru.sokomishalov.commons.core.consts.EMPTY
-import java.net.InetAddress
+import java.lang.System.getenv
+import java.net.InetAddress.getLocalHost
/**
* @author sokomishalov
*/
-val HOSTNAME: String
- get() = getHostName()
- ?: runCatching { InetAddress.getLocalHost().hostAddress }.getOrNull()
- ?: EMPTY
\ No newline at end of file
+
+val HOSTNAME: String by lazy {
+ getenv("HOSTNAME")
+ ?: getenv("COMPUTERNAME")
+ ?: runCatching { getLocalHost().hostAddress }.getOrNull()
+ ?: EMPTY
+}
\ No newline at end of file
diff --git a/commons-spring/pom.xml b/commons-spring/pom.xml
index a307df7..739dd1a 100644
--- a/commons-spring/pom.xml
+++ b/commons-spring/pom.xml
@@ -7,11 +7,11 @@
ru.sokomishalov.commons
commons-parent
- 1.0.24
+ 1.0.25
commons-spring
- 1.0.24
+ 1.0.25
1.3.61
@@ -31,7 +31,7 @@
ru.sokomishalov.commons
commons-core
- 1.0.24
+ 1.0.25
@@ -42,35 +42,45 @@
org.springframework
- spring-webflux
+ spring-context
${spring.version}
org.springframework
- spring-context
+ spring-web
${spring.version}
+
+
org.springframework
spring-context-support
${spring.version}
+ true
- com.github.ben-manes.caffeine
- caffeine
- ${caffeine.cache}
+ org.springframework
+ spring-webflux
+ ${spring.version}
+ true
io.springfox
springfox-swagger2
${springfox.version}
+ true
-
+
+ com.github.ben-manes.caffeine
+ caffeine
+ ${caffeine.cache}
+ true
+
org.mongodb
@@ -78,6 +88,7 @@
${mongo-reactive.version}
true
+
io.lettuce
lettuce-core
diff --git a/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/CacheManagerExtensions.kt b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/CacheManagerExtensions.kt
new file mode 100644
index 0000000..fb1f145
--- /dev/null
+++ b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/CacheManagerExtensions.kt
@@ -0,0 +1,43 @@
+/**
+ * Copyright 2019-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+@file:Suppress("UNCHECKED_CAST", "unused")
+
+package ru.sokomishalov.commons.spring.cache
+
+import org.springframework.cache.CacheManager
+
+/**
+ * @author sokomishalov
+ */
+
+fun CacheManager.put(cacheName: String, key: String, value: V?) {
+ getCache(cacheName)?.put(key, value)
+}
+
+operator fun CacheManager.set(cacheName: String, key: String, value: V?) {
+ put(cacheName, key, value)
+}
+
+fun CacheManager.evict(cacheName: String, key: String) {
+ getCache(cacheName)?.evict(key)
+}
+
+operator fun CacheManager.get(cacheName: String, key: String): V? {
+ return when (val value = getCache(cacheName)?.get(key)?.get()) {
+ null -> null
+ else -> value as V
+ }
+}
\ No newline at end of file
diff --git a/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/CacheManagerService.kt b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/CacheManagerService.kt
index ccb46b0..b954538 100644
--- a/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/CacheManagerService.kt
+++ b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/CacheManagerService.kt
@@ -19,6 +19,7 @@ package ru.sokomishalov.commons.spring.cache
import org.springframework.cache.Cache
import org.springframework.cache.CacheManager
+import org.springframework.cache.concurrent.ConcurrentMapCacheManager
import ru.sokomishalov.commons.core.common.unit
@@ -27,7 +28,7 @@ import ru.sokomishalov.commons.core.common.unit
*/
class CacheManagerService(
private val caches: List = emptyList(),
- private val cacheManager: CacheManager = createDefaultCacheManager(caches)
+ private val cacheManager: CacheManager = ConcurrentMapCacheManager(*caches.toTypedArray())
) : CacheService {
private fun getCache(cacheName: String): Cache? = cacheManager.getCache(cacheName)
diff --git a/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/CacheService.kt b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/CacheService.kt
index 8425984..0a908e9 100644
--- a/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/CacheService.kt
+++ b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/CacheService.kt
@@ -23,7 +23,7 @@ package ru.sokomishalov.commons.spring.cache
interface CacheService {
companion object {
- const val DEFAULT_CACHE = "COMMON_CACHE"
+ const val DEFAULT_CACHE = "DEFAULT"
}
suspend fun get(cacheName: String = DEFAULT_CACHE, key: String): T?
diff --git a/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/CacheUtils.kt b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/caffeine/CaffeineCacheUtils.kt
similarity index 71%
rename from commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/CacheUtils.kt
rename to commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/caffeine/CaffeineCacheUtils.kt
index 826e122..eafb856 100644
--- a/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/CacheUtils.kt
+++ b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/cache/caffeine/CaffeineCacheUtils.kt
@@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-@file:Suppress("UNCHECKED_CAST", "unused")
-package ru.sokomishalov.commons.spring.cache
+@file:Suppress("unused")
+
+package ru.sokomishalov.commons.spring.cache.caffeine
import com.github.benmanes.caffeine.cache.Caffeine.newBuilder
import org.springframework.cache.CacheManager
@@ -26,7 +27,7 @@ import java.time.Duration
* @author sokomishalov
*/
-fun createDefaultCacheManager(
+fun createDefaultCaffeineCacheManager(
cacheNames: List,
expireAfterWrite: Duration? = null,
expireAfterAccess: Duration? = null
@@ -40,19 +41,4 @@ fun createDefaultCacheManager(
}
})
}
-}
-
-fun CacheManager.put(cacheName: String, key: String, value: V?) {
- getCache(cacheName)?.put(key, value)
-}
-
-fun CacheManager.evict(cacheName: String, key: String) {
- getCache(cacheName)?.evict(key)
-}
-
-fun CacheManager.get(cacheName: String, key: String): V? {
- return when (val value = getCache(cacheName)?.get(key)?.get()) {
- null -> null
- else -> value as V
- }
}
\ No newline at end of file
diff --git a/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/swagger/SwaggerRouterFunctionUtils.kt b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/swagger/SwaggerRouterFunctionUtils.kt
new file mode 100644
index 0000000..9046311
--- /dev/null
+++ b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/swagger/SwaggerRouterFunctionUtils.kt
@@ -0,0 +1,30 @@
+/**
+ * Copyright 2019-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+@file:Suppress("unused")
+
+package ru.sokomishalov.commons.spring.swagger
+
+
+/**
+ * @author sokomishalov
+ */
+import org.springframework.web.reactive.function.server.RouterFunctionDsl
+import java.net.URI.create
+
+fun RouterFunctionDsl.redirectRootToSwagger() {
+ (GET("/") or POST("/")) { permanentRedirect(create("/${SWAGGER_UI_PAGE}")).build() }
+}
\ No newline at end of file
diff --git a/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/swagger/SwaggerUtils.kt b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/swagger/SwaggerUtils.kt
index 2b8d06e..003724c 100644
--- a/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/swagger/SwaggerUtils.kt
+++ b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/swagger/SwaggerUtils.kt
@@ -22,7 +22,6 @@ import org.springframework.http.ResponseEntity
import org.springframework.http.codec.multipart.FilePart
import org.springframework.http.server.reactive.ServerHttpRequest
import org.springframework.web.multipart.MultipartFile
-import org.springframework.web.reactive.function.server.RouterFunctionDsl
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono
import ru.sokomishalov.commons.core.consts.EMPTY
@@ -32,7 +31,6 @@ import springfox.documentation.service.Contact
import springfox.documentation.service.SecurityScheme
import springfox.documentation.spi.service.contexts.SecurityContext
import springfox.documentation.spring.web.plugins.Docket
-import java.net.URI.create
import kotlin.coroutines.Continuation
/**
@@ -40,14 +38,9 @@ import kotlin.coroutines.Continuation
*/
const val SWAGGER_UI_PAGE = "swagger-ui.html"
-
const val REDIRECT_TO_SWAGGER = "redirect:${SWAGGER_UI_PAGE}"
-fun RouterFunctionDsl.redirectRootToSwagger() {
- (GET("/") or POST("/")) { permanentRedirect(create("/${SWAGGER_UI_PAGE}")).build() }
-}
-
-fun Docket.customizeDocket(
+fun Docket.customize(
securityContext: SecurityContext? = null,
securityScheme: SecurityScheme? = null,
ignoredParameterTypes: List> = listOf(ServerHttpRequest::class.java, Continuation::class.java),
diff --git a/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/common/CommonUtils.kt b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/web/WebExtensions.kt
similarity index 92%
rename from commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/common/CommonUtils.kt
rename to commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/web/WebExtensions.kt
index fa128fc..a152394 100644
--- a/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/common/CommonUtils.kt
+++ b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/web/WebExtensions.kt
@@ -15,7 +15,11 @@
*/
@file:Suppress("unused")
-package ru.sokomishalov.commons.spring.common
+package ru.sokomishalov.commons.spring.web
+
+/**
+ * @author sokomishalov
+ */
import org.springframework.http.ResponseEntity
diff --git a/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/reactive/ReactiveUtils.kt b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/web/WebFluxExtensions.kt
similarity index 97%
rename from commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/reactive/ReactiveUtils.kt
rename to commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/web/WebFluxExtensions.kt
index d5fb2fb..f1e0452 100644
--- a/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/reactive/ReactiveUtils.kt
+++ b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/web/WebFluxExtensions.kt
@@ -15,7 +15,7 @@
*/
@file:Suppress("unused")
-package ru.sokomishalov.commons.spring.reactive
+package ru.sokomishalov.commons.spring.web
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.withContext
diff --git a/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/webclient/WebClientUtils.kt b/commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/webclient/ReactiveWebClientUtils.kt
similarity index 100%
rename from commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/webclient/WebClientUtils.kt
rename to commons-spring/src/main/kotlin/ru/sokomishalov/commons/spring/webclient/ReactiveWebClientUtils.kt
diff --git a/pom.xml b/pom.xml
index 0853595..ef4cf8d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
ru.sokomishalov.commons
commons-parent
- 1.0.24
+ 1.0.25
pom
@@ -37,6 +37,7 @@
+
com.mycila
license-maven-plugin
3.0