diff --git a/akka-http-core/src/main/java/akka/http/javadsl/model/ContentType.java b/akka-http-core/src/main/java/akka/http/javadsl/model/ContentType.java deleted file mode 100644 index 9d7d2cf34a..0000000000 --- a/akka-http-core/src/main/java/akka/http/javadsl/model/ContentType.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (C) 2009-2014 Typesafe Inc. - */ - -package akka.http.javadsl.model; - -import akka.japi.Option; - -/** - * Represents an Http content-type. A content-type consists of a media-type and an optional charset. - */ -public interface ContentType { - - /** - * The media-type of this content-type. - */ - MediaType mediaType(); - - /** - * True if this ContentType is non-textual. - */ - boolean binary(); - - /** - * Returns the charset if this ContentType is non-binary. - */ - Option getCharsetOption(); - - interface Binary extends ContentType { - } - - interface NonBinary extends ContentType { - HttpCharset charset(); - } - - interface WithFixedCharset extends NonBinary { - } - - interface WithCharset extends NonBinary { - } -} diff --git a/akka-http-core/src/main/scala/akka/http/javadsl/model/ContentType.scala b/akka-http-core/src/main/scala/akka/http/javadsl/model/ContentType.scala new file mode 100644 index 0000000000..bc514fe201 --- /dev/null +++ b/akka-http-core/src/main/scala/akka/http/javadsl/model/ContentType.scala @@ -0,0 +1,45 @@ +/** + * Copyright (C) 2009-2014 Typesafe Inc. + */ +package akka.http.javadsl.model + +import akka.japi.Option + +/** + * Represents an Http content-type. A content-type consists of a media-type and an optional charset. + */ +// Has to be defined in Scala even though it's JavaDSL because of: +// https://issues.scala-lang.org/browse/SI-9621 +object ContentType { + + trait Binary extends ContentType { + } + + trait NonBinary extends ContentType { + def charset: HttpCharset + } + + trait WithFixedCharset extends NonBinary { + } + + trait WithCharset extends NonBinary { + } + +} + +trait ContentType { + /** + * The media-type of this content-type. + */ + def mediaType: MediaType + + /** + * True if this ContentType is non-textual. + */ + def binary: Boolean + + /** + * Returns the charset if this ContentType is non-binary. + */ + def getCharsetOption: Option[HttpCharset] +} diff --git a/akka-http-core/src/main/scala/akka/http/javadsl/model/MediaType.scala b/akka-http-core/src/main/scala/akka/http/javadsl/model/MediaType.scala index 06101fb9f4..6fd07d4ed3 100644 --- a/akka-http-core/src/main/scala/akka/http/javadsl/model/MediaType.scala +++ b/akka-http-core/src/main/scala/akka/http/javadsl/model/MediaType.scala @@ -6,8 +6,9 @@ package akka.http.javadsl.model /** * Represents an Http media-type. A media-type consists of a main-type and a sub-type. * - * Has to be defined in Scala even though it's JavaDSL because of: https://issues.scala-lang.org/browse/SI-9621 */ +// Has to be defined in Scala even though it's JavaDSL because of: +// https://issues.scala-lang.org/browse/SI-9621 object MediaType { trait Binary extends MediaType {