Hexa
02/13/2019, 3:46 PMShawn
02/13/2019, 3:49 PM@Path
argument on the get endpoint?POST
endpoint is likely being called but 500ing because you probably don’t have anything set up to deserialize the json blob to String
Hexa
02/13/2019, 4:01 PMShawn
02/13/2019, 4:01 PMHexa
02/13/2019, 4:02 PM> Task :run
Feb 13, 2019 4:02:25 PM org.glassfish.grizzly.http.server.NetworkListener start
INFO: Started listener bound to [0.0.0.0:8080]
Feb 13, 2019 4:02:25 PM org.glassfish.grizzly.http.server.HttpServer start
INFO: [HttpServer] Started.
Press any key to shutdown
<==========---> 80% EXECUTING [27s]
> :run
Shawn
02/13/2019, 4:03 PMHexa
02/13/2019, 4:03 PMFeb 13, 2019 4:03:16 PM org.glassfish.jersey.logging.LoggingInterceptor log
INFO: 2 * Server has received a request on thread grizzly-http-server-1
2 > GET <http://localhost:8080/myresource/test123>
2 > accept: */*
2 > host: localhost:8080
2 > user-agent: curl/7.54.0
Feb 13, 2019 4:03:16 PM org.glassfish.jersey.logging.LoggingInterceptor log
INFO: 2 * Server responded with a response on thread grizzly-http-server-1
2 < 200
2 < Content-Type: application/json
hello
Shawn
02/13/2019, 4:04 PMHexa
02/13/2019, 4:08 PM{"message": "foo"}'
Shawn
02/13/2019, 4:08 PMHexa
02/13/2019, 4:09 PMMessage(message: String)
do??Shawn
02/13/2019, 4:09 PMtddmonkey
02/13/2019, 4:09 PMMap<Any, Any>
KotlinModule
you will need to registerjackson-module-kotlin
Hexa
02/13/2019, 4:10 PMfun createMessage(testPost: Map<Any, Any>)
?Joe
02/13/2019, 4:14 PMHexa
02/13/2019, 4:24 PM@POST
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN)
fun createMessage(message: String): Response {
return Response.status(200).entity("test").build()
}
curl -v -X POST \
<http://localhost:8080/messages> \
-H 'Content-Type: application/json'
Shawn
02/13/2019, 8:10 PMJoe
02/13/2019, 9:11 PMtddmonkey
02/13/2019, 9:19 PM