-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request akka#19460 from ktoso/wip-contettype-ktoso
=htc akka#19418 avoid LUB problem in javadsl.model.ContentType, see SI-9621
- Loading branch information
Showing
4 changed files
with
126 additions
and
91 deletions.
There are no files selected for viewing
41 changes: 0 additions & 41 deletions
41
akka-http-core/src/main/java/akka/http/javadsl/model/ContentType.java
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
akka-http-core/src/main/scala/akka/http/javadsl/model/ContentType.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com> | ||
*/ | ||
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] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters