I try to force my http server (using only http-core) to respond with 
headers.

I get from request Accept header 

String mime = request.getHeader(Accept.class)
        .map(HttpHeader::value)
        .orElse("application/json");


but then it is not clear to me how to create custom Content-Type header. I 
cannot use RawHeader as it is ignored (as documentation suggested). using 
HttpEntity.create is just pain in java
to convert my mime back to ContentType I need to decide whether it is 
binary or not. I tried

ContentTypes.create(MediaTypes.custom()) // but it creates MediaType rather 
than Binary, WithFixedCharset ..


then I tried 


ContentType.WithFixedCharset contentType = ContentTypes.create(
        
akka.http.scaladsl.model.MediaType.applicationWithFixedCharset("my-own", ?, ?));


but it suddenly is a scaladsl and I need to pass some scala collection / 
charsets ... and there is no equivalent in javadsl (or maybe I am missing 
it).


what I am looking for is a way to convert Accept header into ContentType. I 
dont know why this is so complicated. why ContentTypes.create isn't just 
consume string???

none http frameworks are making creating response so complicated. Or maybe only 
javadsl is immature.


(I dont want to offend anyone, I am just tired)


thanks for any help

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to