=htc #19418 avoid LUB calculation problem, see SI-9621
This commit is contained in:
parent
be0c8af4c0
commit
9fd543bff0
2 changed files with 77 additions and 67 deletions
|
|
@ -1,67 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
package akka.http.javadsl.model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an Http media-type. A media-type consists of a main-type and a sub-type.
|
|
||||||
*/
|
|
||||||
public interface MediaType {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The main-type of this media-type.
|
|
||||||
*/
|
|
||||||
String mainType();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The sub-type of this media-type.
|
|
||||||
*/
|
|
||||||
String subType();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* True when this media-type is generally compressible.
|
|
||||||
*/
|
|
||||||
boolean isCompressible();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* True when this media-type is not character-based.
|
|
||||||
*/
|
|
||||||
boolean binary();
|
|
||||||
|
|
||||||
boolean isApplication();
|
|
||||||
boolean isAudio();
|
|
||||||
boolean isImage();
|
|
||||||
boolean isMessage();
|
|
||||||
boolean isMultipart();
|
|
||||||
boolean isText();
|
|
||||||
boolean isVideo();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a media-range from this media-type.
|
|
||||||
*/
|
|
||||||
MediaRange toRange();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a media-range from this media-type with a given qValue.
|
|
||||||
*/
|
|
||||||
MediaRange toRange(float qValue);
|
|
||||||
|
|
||||||
interface Binary extends MediaType {
|
|
||||||
ContentType.Binary toContentType();
|
|
||||||
}
|
|
||||||
|
|
||||||
interface NonBinary extends MediaType {
|
|
||||||
}
|
|
||||||
|
|
||||||
interface WithFixedCharset extends NonBinary {
|
|
||||||
ContentType.WithFixedCharset toContentType();
|
|
||||||
}
|
|
||||||
|
|
||||||
interface WithOpenCharset extends NonBinary {
|
|
||||||
ContentType.WithCharset toContentType(HttpCharset charset);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Multipart extends WithOpenCharset {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
|
||||||
|
*/
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
object MediaType {
|
||||||
|
|
||||||
|
trait Binary extends MediaType {
|
||||||
|
def toContentType: ContentType.Binary
|
||||||
|
}
|
||||||
|
|
||||||
|
trait NonBinary extends MediaType {
|
||||||
|
}
|
||||||
|
|
||||||
|
trait WithFixedCharset extends NonBinary {
|
||||||
|
def toContentType: ContentType.WithFixedCharset
|
||||||
|
}
|
||||||
|
|
||||||
|
trait WithOpenCharset extends NonBinary {
|
||||||
|
def toContentType(charset: HttpCharset): ContentType.WithCharset
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Multipart extends WithOpenCharset {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
trait MediaType {
|
||||||
|
/**
|
||||||
|
* The main-type of this media-type.
|
||||||
|
*/
|
||||||
|
def mainType: String
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The sub-type of this media-type.
|
||||||
|
*/
|
||||||
|
def subType: String
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True when this media-type is generally compressible.
|
||||||
|
*/
|
||||||
|
def isCompressible: Boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True when this media-type is not character-based.
|
||||||
|
*/
|
||||||
|
def binary: Boolean
|
||||||
|
|
||||||
|
def isApplication: Boolean
|
||||||
|
|
||||||
|
def isAudio: Boolean
|
||||||
|
|
||||||
|
def isImage: Boolean
|
||||||
|
|
||||||
|
def isMessage: Boolean
|
||||||
|
|
||||||
|
def isMultipart: Boolean
|
||||||
|
|
||||||
|
def isText: Boolean
|
||||||
|
|
||||||
|
def isVideo: Boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a media-range from this media-type.
|
||||||
|
*/
|
||||||
|
def toRange: MediaRange
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a media-range from this media-type with a given qValue.
|
||||||
|
*/
|
||||||
|
def toRange(qValue: Float): MediaRange
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue