+htc,java #18600 Add missing convenience ContentTypes class
This commit is contained in:
parent
239b4ca268
commit
2f2e07666e
4 changed files with 25 additions and 2 deletions
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* Copyright (C) 2009-2015 Typesafe Inc. <http:__www.typesafe.com>
|
||||
*/
|
||||
package akka.http.javadsl.model;
|
||||
|
||||
|
||||
/**
|
||||
* Contains the set of predefined content-types.
|
||||
* <p>
|
||||
* If the {@link ContentType} you're looking for is not pre-defined here,
|
||||
* you can obtain it from a {@link MediaType} by using:
|
||||
* <p>
|
||||
* {@code MediaTypes.TEXT_HTML.toContentType()}
|
||||
*/
|
||||
public final class ContentTypes {
|
||||
public static final ContentType APPLICATION_JSON = MediaTypes.APPLICATION_JSON.toContentType();
|
||||
public static final ContentType TEXT_PLAIN = MediaTypes.TEXT_PLAIN.toContentType();
|
||||
public static final ContentType TEXT_PLAIN_UTF8 = akka.http.scaladsl.model.ContentTypes.text$divplain$u0028UTF$minus8$u0029();
|
||||
public static final ContentType TEXT_HTML = MediaTypes.TEXT_HTML.toContentType();
|
||||
public static final ContentType APPLICATION_OCTET_STREAM = MediaTypes.APPLICATION_OCTET_STREAM.toContentType();
|
||||
}
|
||||
|
|
@ -92,6 +92,7 @@ object ContentTypes {
|
|||
val `application/json` = ContentType(MediaTypes.`application/json`)
|
||||
val `text/plain` = ContentType(MediaTypes.`text/plain`)
|
||||
val `text/plain(UTF-8)` = ContentType(MediaTypes.`text/plain`, HttpCharsets.`UTF-8`)
|
||||
val `text/html` = ContentType(MediaTypes.`text/html`)
|
||||
val `application/octet-stream` = ContentType(MediaTypes.`application/octet-stream`)
|
||||
|
||||
// used for explicitly suppressing the rendering of Content-Type headers on requests and responses
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue