Top wishes
14 | <#list topWishList as topWish> 15 |17 | 18 | ${topWish.id} 19 | 20 | 21 | ${topWish.wish} 22 | 23 |
24 |Wishlist
14 | <#list wishList as wish> 15 |17 | 18 | ${wish.id} 19 | 20 | 21 | ${wish.wish} 22 | 23 |
24 |17 | Delete kweet 18 |
19 | 20 | 24 | #if> 25 | 26 | @layout.mainLayout> -------------------------------------------------------------------------------- /location-header/README.md: -------------------------------------------------------------------------------- 1 | # Location Header 2 | 3 | An application demonstrating how to use the `Location` HTTP headers. 4 | 5 | ## Running 6 | 7 | Execute this command to run this sample: 8 | 9 | ```bash 10 | ./gradlew run 11 | ``` 12 | 13 | To work with the demo, you need to make a POST request. If using IntelliJ IDEA, open the [Test.http](Test.http) file to make test requests. 14 | 15 | -------------------------------------------------------------------------------- /location-header/Test.http: -------------------------------------------------------------------------------- 1 | ### Manual setting of Location Header 2 | POST http://localhost:8080/manual 3 | 4 | ### Automatic setting of Location Header 5 | POST http://localhost:8080/extension 6 | -------------------------------------------------------------------------------- /location-header/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kotlin_version: String by project 2 | val logback_version: String by project 3 | 4 | plugins { 5 | kotlin("jvm") version "2.1.20" 6 | id("io.ktor.plugin") version "3.1.3" 7 | } 8 | 9 | application { 10 | mainClass.set("io.ktor.samples.location.LocationHeaderApplicationKt") 11 | } 12 | 13 | repositories { 14 | mavenCentral() 15 | } 16 | 17 | dependencies { 18 | implementation("io.ktor:ktor-server-core-jvm") 19 | implementation("io.ktor:ktor-server-netty-jvm") 20 | implementation("ch.qos.logback:logback-classic:$logback_version") 21 | } 22 | -------------------------------------------------------------------------------- /location-header/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin_version=2.1.20 2 | logback_version=1.3.14 3 | kotlin.code.style=official 4 | -------------------------------------------------------------------------------- /location-header/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ktorio/ktor-samples/477179a902f994e3b175bf7cd3c7c7b72a66fb90/location-header/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /location-header/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /location-header/src/main/kotlin/io/ktor/samples/location/LocationHeaderApplication.kt: -------------------------------------------------------------------------------- 1 | package io.ktor.samples.location 2 | 3 | import io.ktor.server.application.* 4 | import io.ktor.http.* 5 | import io.ktor.server.request.* 6 | import io.ktor.server.response.* 7 | import io.ktor.server.routing.* 8 | import io.ktor.server.engine.* 9 | import io.ktor.server.netty.* 10 | 11 | /** 12 | * Main entrypoint of the executable that starts a Netty webserver at port 8080 13 | * and registers the [module]. 14 | * 15 | */ 16 | 17 | fun main() { 18 | embeddedServer(Netty, port = 8080) { module() }.start(wait = true) 19 | } 20 | 21 | fun Application.module() { 22 | routing { 23 | post("/manual") { 24 | // AF4GH is a sample code for demo purposes 25 | call.response.header("Location", "/manual/AF4GH") 26 | call.response.status(HttpStatusCode.Created) 27 | call.respondText("Manually setting the location header") 28 | } 29 | post("/extension") { 30 | // AF4GH is a sample code for demo purposes 31 | call.response.created("AF4GH") 32 | call.respondText("Extension setting the location header") 33 | } 34 | } 35 | } 36 | 37 | private fun ApplicationResponse.created(id: String) { 38 | call.response.status(HttpStatusCode.Created) 39 | call.response.header("Location", "${call.request.uri}/$id") 40 | } 41 | -------------------------------------------------------------------------------- /maven-google-appengine-standard/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ktorio/ktor-samples/477179a902f994e3b175bf7cd3c7c7b72a66fb90/maven-google-appengine-standard/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /maven-google-appengine-standard/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip -------------------------------------------------------------------------------- /maven-google-appengine-standard/README.md: -------------------------------------------------------------------------------- 1 | # Maven Google Appengine Standard 2 | 3 | A sample project for [Ktor](https://ktor.io) running under [Google App Engine](https://cloud.google.com/appengine/) 4 | standard infrastructure with [Maven](https://maven.apache.org) build script. 5 | 6 | ## Prerequisites 7 | 8 | * [Java SDK 8](https://www.oracle.com/technetwork/java/javase/downloads/index.html) or later 9 | * [Google Cloud SDK](https://cloud.google.com/sdk/docs/) 10 | 11 | ## Running 12 | 13 | Run this project under local dev mode with: 14 | 15 | ``` 16 | ./mvnw appengine:run 17 | ``` 18 | 19 | Then, navigate to [http://localhost:8080/](http://localhost:8080/) to see the sample home page. 20 | 21 | ## Deploying 22 | 23 | Use Google Cloud SDK to create application similarly to 24 | [Google App Engine for Java Quickstart](https://cloud.google.com/appengine/docs/standard/java/quickstart): 25 | 26 | Install all the Google Cloud components and login into your account: 27 | 28 | ``` 29 | gcloud init 30 | gcloud components install app-engine-java 31 | gcloud components update 32 | gcloud auth application-default login 33 | ``` 34 | 35 | Create the project and application: 36 | 37 | ``` 38 | gcloud projects create17 | 18 | ${topWish.id} 19 | 20 | 21 | ${topWish.wish} 22 | 23 |
24 |17 | 18 | ${wish.id} 19 | 20 | 21 | ${wish.wish} 22 | 23 |
24 |