Hello,
I dont find how to set the content type to "*application/json;
charset=UTF-8*" with the *completeOKWithFuture* and Jackson marshaller.
Currently, Akka Http return the Content-Type "application/json" without
specifying the charset. So in some browsers (like Opera or Chrome) the
output text is not good.
get(() -> {
final MessageDispatcher dispatcher = akkaSystem.dispatchers().lookup(
"application.dispatcher");
return completeOKWithFuture(CompletableFuture.supplyAsync(() -> {
final Map<String, Object> result = new HashMap<>();
result.put("trackingNumber", trackingNumber);
ArrayList<Map<String, String>> status;
if (this.cache == null) {
status = TrackingCrawler.parseDocument(trackingNumber);
} else {
status = this.cache.readFromCache("tracking." + trackingNumber);
if (status == null) {
status = TrackingCrawler.parseDocument(trackingNumber);
this.cache.writeToCache(
"tracking." + trackingNumber,
status
);
}
}
result.put("status", status);
return result;
}, dispatcher).exceptionally(ex -> {
LOG.error("Something goes wrong", ex);
return new HashMap<>();
}), Jackson.marshaller());
})
Sincerly.
--
>>>>>>>>>> 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.