{"action":"created","issue":{"url":"https://api.github.com/repos/akka/akka/issues/19976","repository_url":"https://api.github.com/repos/akka/akka","labels_url":"https://api.github.com/repos/akka/akka/issues/19976/labels{/name}","comments_url":"https://api.github.com/repos/akka/akka/issues/19976/comments","events_url":"https://api.github.com/repos/akka/akka/issues/19976/events","html_url":"https://github.com/akka/akka/issues/19976","id":139401651,"number":19976,"title":"feature parity of creating MediaTypes for JavaDSL","user":{"login":"pawel-kaminski-krk","id":1647910,"avatar_url":"https://avatars.githubusercontent.com/u/1647910?v=3","gravatar_id":"","url":"https://api.github.com/users/pawel-kaminski-krk","html_url":"https://github.com/pawel-kaminski-krk","followers_url":"https://api.github.com/users/pawel-kaminski-krk/followers","following_url":"https://api.github.com/users/pawel-kaminski-krk/following{/other_user}","gists_url":"https://api.github.com/users/pawel-kaminski-krk/gists{/gist_id}","starred_url":"https://api.github.com/users/pawel-kaminski-krk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pawel-kaminski-krk/subscriptions","organizations_url":"https://api.github.com/users/pawel-kaminski-krk/orgs","repos_url":"https://api.github.com/users/pawel-kaminski-krk/repos","events_url":"https://api.github.com/users/pawel-kaminski-krk/events{/privacy}","received_events_url":"https://api.github.com/users/pawel-kaminski-krk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/akka/akka/labels/1%20-%20triaged","name":"1 - triaged","color":"5319e7"},{"url":"https://api.github.com/repos/akka/akka/labels/2%20-%20pick%20next","name":"2 - pick next","color":"207de5"},{"url":"https://api.github.com/repos/akka/akka/labels/3%20-%20in%20progress","name":"3 - in progress","color":"eb6420"},{"url":"https://api.github.com/repos/akka/akka/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/akka/akka/labels/t:http","name":"t:http","color":"CCCCCC"},{"url":"https://api.github.com/repos/akka/akka/labels/t:http:java","name":"t:http:java","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-03-08T21:41:10Z","updated_at":"2016-03-18T15:47:08Z","closed_at":null,"body":"I am using java dsl for akka-http. the original question is here https://groups.google.com/forum/?hl=en-GB#!topic/akka-user/19GPYsUzpSk but I try to summarize it :\r\n\r\nI cannot use RawHeader for headers like contentType, contentLength when constructing httpResponse are ignored (as pointed in documentation). \r\n\r\nsetting content-type using HttpEntity#create is just pain in java. It is super easy for common types like application/json but for a custom one to convert my, string mime back to ContentType I need to decide whether it is binary or not. \r\n\r\nI tried ```ContentTypes.create(MediaTypes.custom()) ``` but it creates MediaType rather than Binary, WithFixedCharset instances and there is no way to get ContentType from such custom MediaType. \r\n\r\nthen I tried \r\n\r\n    ContentType.WithFixedCharset contentType = ContentTypes.create(\r\n        **akka.http.scaladsl.model.**MediaType.applicationWithFixedCharset(\r\n            \"my-own\", \r\n            HttpCharsets.UTF$minus8(), \r\n            ?)); // <---- I dont know event how to create empty Seq in java\r\n\r\nbut it suddenly is a scaladsl and I need to pass some scala charsets / scala collection ... and there is no equivalent in javadsl.\r\n\r\nWhy ContentTypes.create isn't just consume string??? maybe rawHeader??\r\n\r\nI dont understand the hierarchy of the ContentType, the benefit of having Binary, applicationWithFixedCharset, applicationWithOpenCharset, and so on. this is not explained nowhere in docs."},"comment":{"url":"https://api.github.com/repos/akka/akka/issues/comments/198419518","html_url":"https://github.com/akka/akka/issues/19976#issuecomment-198419518","issue_url":"https://api.github.com/repos/akka/akka/issues/19976","id":198419518,"user":{"login":"lolski","id":464164,"avatar_url":"https://avatars.githubusercontent.com/u/464164?v=3","gravatar_id":"","url":"https://api.github.com/users/lolski","html_url":"https://github.com/lolski","followers_url":"https://api.github.com/users/lolski/followers","following_url":"https://api.github.com/users/lolski/following{/other_user}","gists_url":"https://api.github.com/users/lolski/gists{/gist_id}","starred_url":"https://api.github.com/users/lolski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lolski/subscriptions","organizations_url":"https://api.github.com/users/lolski/orgs","repos_url":"https://api.github.com/users/lolski/repos","events_url":"https://api.github.com/users/lolski/events{/privacy}","received_events_url":"https://api.github.com/users/lolski/received_events","type":"User","site_admin":false},"created_at":"2016-03-18T15:47:08Z","updated_at":"2016-03-18T15:47:08Z","body":"My remark:\r\n\r\n1. `ContentType` javadsl has way less functionality than the scaladsl counterpart, so they need to be added\r\n2. We don't have `MediaType.Compressibility` javadsl, which is needed as well"}}