Skip to content

Migrate web application from Dropwizard to Ktor - #641

Draft
evanchooly with Copilot wants to merge 4 commits into
masterfrom
copilot/convert-dropwizard-to-ktor
Draft

Migrate web application from Dropwizard to Ktor#641
evanchooly with Copilot wants to merge 4 commits into
masterfrom
copilot/convert-dropwizard-to-ktor

Conversation

Copilot AI commented Feb 2, 2026

Copy link
Copy Markdown

Replaces Dropwizard with Ktor for the web server framework. FreeMarker templating is retained but adapted to Ktor's model-based approach.

Routing

JAX-RS annotations replaced with Ktor DSL:

// Before (Dropwizard)
@Path("/factoids")
@GET
fun factoids(@QueryParam("page") page: Int?): View {
    return viewFactory.createFactoidsView(request, page ?: 1)
}

// After (Ktor)
get("/factoids") {
    val page = call.request.queryParameters["page"]?.toIntOrNull() ?: 1
    val view = viewFactory.createFactoidsView(KtorServletRequest(call), page)
    call.respond(FreeMarkerContent("main.ftl", view.toModel()))
}

Dependencies

  • Removed: dropwizard-core, dropwizard-auth, dropwizard-assets, dropwizard-views-freemarker
  • Added: ktor-server-netty-jvm, ktor-server-freemarker-jvm, ktor-server-sessions-jvm, and supporting modules

View Layer

  • Removed inheritance from io.dropwizard.views.View
  • Added toModel(): Map<String, Any?> methods to convert views to FreeMarker data models
  • Views now return data maps instead of rendering through Dropwizard's view system

Templates

FreeMarker templates updated to access model properties directly:

  • loggedIn()loggedIn
  • getChannels()channels
  • encode(value)value?url

Application Bootstrap

JavabotApplication converted from extending Application<JavabotConfiguration> to using Ktor's embeddedServer:

  • Session management via Ktor Sessions plugin
  • Error handling via StatusPages plugin
  • Static resources via static {} DSL

Compatibility

KtorServletRequest adapter bridges ApplicationCall to HttpServletRequest interface, minimizing changes to existing view code that expects servlet APIs.

Known Issues

  • Authentication implementation incomplete (placeholder returns null)
  • OpenIDAuthenticator still references Dropwizard auth classes
  • Tests not yet updated for Ktor

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • central.sonatype.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.12/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.12/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.12 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.12/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/javabot/javabot org.codehaus.plexus.classworlds.launcher.Launcher clean compile -DskipTests (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

there is a web/ folder that defines a web app based on dropwizard. convert this dropwizard application to one that uses ktor. update the templating of web pages to what it suitable for using with ktor.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 2, 2026 15:46
Co-authored-by: evanchooly <195021+evanchooly@users.noreply.github.com>
Co-authored-by: evanchooly <195021+evanchooly@users.noreply.github.com>
Co-authored-by: evanchooly <195021+evanchooly@users.noreply.github.com>
Copilot AI changed the title [WIP] Convert Dropwizard application to Ktor framework Migrate web application from Dropwizard to Ktor Feb 2, 2026
Copilot AI requested a review from evanchooly February 2, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants