From 4bec33386d5b7112e4f4ab4c97f477cedd77ebf2 Mon Sep 17 00:00:00 2001 From: Anton Keks Date: Wed, 20 Nov 2024 00:00:49 +0200 Subject: [PATCH] change servlet namespace to jakarta --- .idea/compiler.xml | 2 +- .idea/gradle.xml | 3 --- .idea/misc.xml | 3 ++- build.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- src/photos/LocalContent.kt | 4 ++-- src/web/Renderer.kt | 4 ++-- src/web/RequestFilter.kt | 10 +++++----- src/web/RequestRouter.kt | 10 +++++----- src/web/RobotsServlet.kt | 8 ++++---- src/web/SiteMapServlet.kt | 10 +++++----- test/photos/LocalContentTest.kt | 2 +- test/web/RequestRouterTest.kt | 6 +++--- web/WEB-INF/appengine-web.xml | 4 ++-- 14 files changed, 35 insertions(+), 37 deletions(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index f8012e6..4e1667e 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,7 +1,7 @@ - + diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 00eac52..1e679c7 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -6,16 +6,13 @@ diff --git a/.idea/misc.xml b/.idea/misc.xml index c258fed..e11b755 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,3 +1,4 @@ + @@ -6,7 +7,7 @@ - + diff --git a/build.gradle b/build.gradle index 1a904c5..af33e3c 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'com.google.cloud.tools.appengine-appenginewebxml' compileKotlin { kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '21' } } @@ -38,7 +38,7 @@ sourceSets { dependencies { implementation 'com.google.appengine:appengine-api-1.0-sdk:+' - providedCompile 'javax.servlet:javax.servlet-api:3.1.0' + providedCompile 'jakarta.servlet:jakarta.servlet-api:5.0.0' implementation 'com.atlassian.commonmark:commonmark:0.17.0' implementation 'com.github.scribejava:scribejava-apis:8.3.1' implementation 'com.google.code.gson:gson:2.8.9' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6043638..29899eb 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists diff --git a/src/photos/LocalContent.kt b/src/photos/LocalContent.kt index 9473268..acbf468 100644 --- a/src/photos/LocalContent.kt +++ b/src/photos/LocalContent.kt @@ -1,9 +1,9 @@ package photos +import jakarta.servlet.ServletContext import org.commonmark.parser.Parser import org.commonmark.renderer.html.HtmlRenderer import java.io.File -import javax.servlet.ServletContext class LocalContent(path: String?) { constructor(servletContext: ServletContext): this(servletContext.getRealPath("content")) @@ -34,4 +34,4 @@ class LocalContent(path: String?) { fun forAlbum(albumName: String?) = albums[albumName] } -data class AlbumContent(val content: String?, val geo: GeoLocation?) \ No newline at end of file +data class AlbumContent(val content: String?, val geo: GeoLocation?) diff --git a/src/web/Renderer.kt b/src/web/Renderer.kt index 2242aeb..879348c 100644 --- a/src/web/Renderer.kt +++ b/src/web/Renderer.kt @@ -1,6 +1,6 @@ package web -import javax.servlet.http.HttpServletResponse +import jakarta.servlet.http.HttpServletResponse open class Renderer { open operator fun invoke(response: HttpServletResponse, lastModified: Long? = null, html: () -> String) { @@ -12,4 +12,4 @@ open class Renderer { response.writer.write(html()) } -} \ No newline at end of file +} diff --git a/src/web/RequestFilter.kt b/src/web/RequestFilter.kt index b856f1c..7ba42c6 100644 --- a/src/web/RequestFilter.kt +++ b/src/web/RequestFilter.kt @@ -1,12 +1,12 @@ package web import integration.OAuth +import jakarta.servlet.* +import jakarta.servlet.annotation.WebFilter +import jakarta.servlet.http.HttpServletRequest +import jakarta.servlet.http.HttpServletResponse import photos.LocalContent import photos.Picasa -import javax.servlet.* -import javax.servlet.annotation.WebFilter -import javax.servlet.http.HttpServletRequest -import javax.servlet.http.HttpServletResponse @WebFilter("/*") class RequestFilter : Filter { @@ -23,4 +23,4 @@ class RequestFilter : Filter { } override fun destroy() { } -} \ No newline at end of file +} diff --git a/src/web/RequestRouter.kt b/src/web/RequestRouter.kt index 165c3b8..e0703ea 100644 --- a/src/web/RequestRouter.kt +++ b/src/web/RequestRouter.kt @@ -2,15 +2,15 @@ package web import integration.BackgroundTasks import integration.OAuth +import jakarta.servlet.FilterChain +import jakarta.servlet.http.HttpServletRequest +import jakarta.servlet.http.HttpServletResponse +import jakarta.servlet.http.HttpServletResponse.SC_MOVED_PERMANENTLY +import jakarta.servlet.http.HttpServletResponse.SC_NOT_FOUND import photos.AlbumPart import photos.Cache import photos.Picasa import java.util.* -import javax.servlet.FilterChain -import javax.servlet.http.HttpServletRequest -import javax.servlet.http.HttpServletResponse -import javax.servlet.http.HttpServletResponse.SC_MOVED_PERMANENTLY -import javax.servlet.http.HttpServletResponse.SC_NOT_FOUND class RequestRouter( val req: HttpServletRequest, diff --git a/src/web/RobotsServlet.kt b/src/web/RobotsServlet.kt index 565ef19..0741823 100644 --- a/src/web/RobotsServlet.kt +++ b/src/web/RobotsServlet.kt @@ -1,9 +1,9 @@ package web -import javax.servlet.annotation.WebServlet -import javax.servlet.http.HttpServlet -import javax.servlet.http.HttpServletRequest -import javax.servlet.http.HttpServletResponse +import jakarta.servlet.annotation.WebServlet +import jakarta.servlet.http.HttpServlet +import jakarta.servlet.http.HttpServletRequest +import jakarta.servlet.http.HttpServletResponse @WebServlet("/robots.txt") class RobotsServlet : HttpServlet() { diff --git a/src/web/SiteMapServlet.kt b/src/web/SiteMapServlet.kt index 77f31e5..0e27025 100644 --- a/src/web/SiteMapServlet.kt +++ b/src/web/SiteMapServlet.kt @@ -1,14 +1,14 @@ package web import integration.OAuth +import jakarta.servlet.ServletConfig +import jakarta.servlet.annotation.WebServlet +import jakarta.servlet.http.HttpServlet +import jakarta.servlet.http.HttpServletRequest +import jakarta.servlet.http.HttpServletResponse import photos.LocalContent import photos.Picasa import views.sitemap -import javax.servlet.ServletConfig -import javax.servlet.annotation.WebServlet -import javax.servlet.http.HttpServlet -import javax.servlet.http.HttpServletRequest -import javax.servlet.http.HttpServletResponse @WebServlet("/sitemap.xml") class SiteMapServlet : HttpServlet() { diff --git a/test/photos/LocalContentTest.kt b/test/photos/LocalContentTest.kt index 93b1710..c771134 100644 --- a/test/photos/LocalContentTest.kt +++ b/test/photos/LocalContentTest.kt @@ -2,9 +2,9 @@ package photos import io.mockk.every import io.mockk.mockk +import jakarta.servlet.ServletContext import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import javax.servlet.ServletContext class LocalContentTest { val servletContext = mockk() diff --git a/test/web/RequestRouterTest.kt b/test/web/RequestRouterTest.kt index ab767a3..c33ff53 100644 --- a/test/web/RequestRouterTest.kt +++ b/test/web/RequestRouterTest.kt @@ -2,15 +2,15 @@ package web import integration.OAuth import io.mockk.* +import jakarta.servlet.http.HttpServletRequest +import jakarta.servlet.http.HttpServletResponse +import jakarta.servlet.http.HttpServletResponse.SC_MOVED_PERMANENTLY import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import photos.Album import photos.Photo import photos.Picasa -import javax.servlet.http.HttpServletRequest -import javax.servlet.http.HttpServletResponse -import javax.servlet.http.HttpServletResponse.SC_MOVED_PERMANENTLY class RequestRouterTest { val req = mockk(relaxed = true) diff --git a/web/WEB-INF/appengine-web.xml b/web/WEB-INF/appengine-web.xml index f8f9d65..af155e1 100644 --- a/web/WEB-INF/appengine-web.xml +++ b/web/WEB-INF/appengine-web.xml @@ -2,8 +2,8 @@ anton-photos 3 - true - java8 + java21 + true urlfetch false