Skip to content
Permalink
Browse files

Step 2: Add simple hello world end point

  • Loading branch information...
baens committed Feb 17, 2018
1 parent cb13731 commit c281332c897fa4bb0de573d447ab3c6adebd5ee1
Showing with 22 additions and 0 deletions.
  1. +1 −0 build.gradle
  2. +2 −0 src/Server.kt
  3. +9 −0 src/jaxrs/Application.kt
  4. +10 −0 src/jaxrs/resources/HelloWorld.kt
@@ -22,6 +22,7 @@ repositories {
dependencies {
compile 'org.jetbrains.kotlin:kotlin-stdlib-jre8'
compile "org.glassfish.jersey.containers:jersey-container-grizzly2-http:2.26"
compile "org.glassfish.jersey.inject:jersey-hk2:2.26"
}

/**
@@ -1,3 +1,4 @@
import jaxrs.Application
import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory
import javax.ws.rs.core.UriBuilder

@@ -8,6 +9,7 @@ fun main(args: Array<String>) {

val httpServer = GrizzlyHttpServerFactory.createHttpServer(
url,
Application(),
true
)

@@ -0,0 +1,9 @@
package jaxrs

import org.glassfish.jersey.server.ResourceConfig

class Application : ResourceConfig() {
init {
packages("jaxrs.resources")
}
}
@@ -0,0 +1,10 @@
package jaxrs.resources

import javax.ws.rs.GET
import javax.ws.rs.Path

@Path("helloWorld")
class HelloWorldResource{
@GET
fun helloWorld() = "Hello World"
}

0 comments on commit c281332

Please sign in to comment.
You can’t perform that action at this time.