All Scala DSL model types extend the Java ones, so you can co over the ScalaDSL to create them, and pass them into any place that expects JavaDSL types.
Thanks in advance for the ticket -- Cheers, Konrad 'ktoso’ Malawski Akka @ Lightbend On 8 March 2016 at 17:48:44, paweł kamiński (kami...@gmail.com) wrote: OK, thanks, any hints how to work this around? I ll create an issue. On Tuesday, 8 March 2016 17:37:48 UTC+1, Konrad Malawski wrote: Seems we might be missing some factory methods on the MediaTypes trait, the scaladsl has methods for returning more specific types, such as `applicationWithCharset` etc. Would you please open a ticket about "feature parity of creating MediaTypes for JavaDSL"? Thanks in advance! Please note that we're reworking the Java Routing DSL nowadays and focusing on such missing bits is definitely something we'll do next up, please keep the feedback coming, thanks! -- Cheers, Konrad 'ktoso’ Malawski Akka @ Lightbend On 8 March 2016 at 17:14:17, paweł kamiński (kam...@gmail.com) wrote: 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+...@googlegroups.com. To post to this group, send email to akka...@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout. -- >>>>>>>>>> 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. -- >>>>>>>>>> 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.