hi hakkers,
i asked this as a part of a discussion in other thread but got no answer,
so i'm trying my luck here.
i use akka-http with java api. i need to return a json entity in
httpresponse with response headers. i was advised to do something like this:
return ctx.complete(
HttpResponse.create()
.withEntity(HttpEntities.create("example"))
.addHeader(Location.create("http://akka.io")));
my problem is that i don't know how to send a json entity. the docs show a
way to use marshallers which doesn't involve httpresponse object, which
unfortunately doesn't answer my needs:
ctx.completeAs(Jackson.json(), object)
i tried a workaround
response.withEntity( json_string ).addHeader( new RawHeader( "Content-Type",
"application/json" ) )
but this doesn't work - the response arrives with content-type text/plain
and i see following warn in logs: Explicitly set HTTP header 'Content-Type:
application/json' is ignored, illegal RawHeader.
any ideas?
thanks!
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.