Merge pull request #20181 from lolski/lolski-issue-19976-javadsl-wip
Adding HTTP Java DSL
This commit is contained in:
commit
ca61a4eec4
1 changed files with 113 additions and 0 deletions
|
|
@ -187,6 +187,119 @@ public final class MediaTypes {
|
|||
public static final MediaType.Binary VIDEO_X_SGI_MOVIE = akka.http.scaladsl.model.MediaTypes.video$divx$minussgi$minusmovie();
|
||||
public static final MediaType.Binary VIDEO_WEBM = akka.http.scaladsl.model.MediaTypes.video$divwebm();
|
||||
|
||||
public static MediaType.Binary applicationBinary(String subType, boolean compressible, String... fileExtensions) {
|
||||
akka.http.scaladsl.model.MediaType.Compressibility comp = compressible ?
|
||||
akka.http.scaladsl.model.MediaType.Compressible$.MODULE$ : akka.http.scaladsl.model.MediaType.NotCompressible$.MODULE$;
|
||||
|
||||
scala.collection.immutable.List<String> fileEx =
|
||||
scala.collection.JavaConversions.asScalaBuffer(java.util.Arrays.asList(fileExtensions)).toList();
|
||||
|
||||
return akka.http.scaladsl.model.MediaType.applicationBinary(subType, comp, fileEx);
|
||||
}
|
||||
|
||||
public static MediaType.WithFixedCharset applicationWithFixedCharset(String subType, HttpCharset charset, String... fileExtensions) {
|
||||
akka.http.scaladsl.model.HttpCharset cs = (akka.http.scaladsl.model.HttpCharset) charset;
|
||||
|
||||
scala.collection.immutable.List<String> fileEx =
|
||||
scala.collection.JavaConversions.asScalaBuffer(java.util.Arrays.asList(fileExtensions)).toList();
|
||||
|
||||
return akka.http.scaladsl.model.MediaType.applicationWithFixedCharset(subType, cs, fileEx);
|
||||
}
|
||||
|
||||
public static MediaType.WithOpenCharset applicationWithOpenCharset(String subType, String... fileExtensions) {
|
||||
scala.collection.immutable.List<String> fileEx =
|
||||
scala.collection.JavaConversions.asScalaBuffer(java.util.Arrays.asList(fileExtensions)).toList();
|
||||
|
||||
return akka.http.scaladsl.model.MediaType.applicationWithOpenCharset(subType, fileEx);
|
||||
}
|
||||
|
||||
public static MediaType.Binary audio(String subType, boolean compressible, String... fileExtensions) {
|
||||
akka.http.scaladsl.model.MediaType.Compressibility comp = compressible ?
|
||||
akka.http.scaladsl.model.MediaType.Compressible$.MODULE$ : akka.http.scaladsl.model.MediaType.NotCompressible$.MODULE$;
|
||||
|
||||
scala.collection.immutable.List<String> fileEx =
|
||||
scala.collection.JavaConversions.asScalaBuffer(java.util.Arrays.asList(fileExtensions)).toList();
|
||||
|
||||
return akka.http.scaladsl.model.MediaType.audio(subType, comp, fileEx);
|
||||
}
|
||||
|
||||
public static MediaType.Binary image(String subType, boolean compressible, String... fileExtensions) {
|
||||
akka.http.scaladsl.model.MediaType.Compressibility comp = compressible ?
|
||||
akka.http.scaladsl.model.MediaType.Compressible$.MODULE$ : akka.http.scaladsl.model.MediaType.NotCompressible$.MODULE$;
|
||||
|
||||
scala.collection.immutable.List<String> fileEx =
|
||||
scala.collection.JavaConversions.asScalaBuffer(java.util.Arrays.asList(fileExtensions)).toList();
|
||||
|
||||
return akka.http.scaladsl.model.MediaType.image(subType, comp, fileEx);
|
||||
}
|
||||
|
||||
public static MediaType.Binary message(String subType, boolean compressible, String... fileExtensions) {
|
||||
akka.http.scaladsl.model.MediaType.Compressibility comp = compressible ?
|
||||
akka.http.scaladsl.model.MediaType.Compressible$.MODULE$ : akka.http.scaladsl.model.MediaType.NotCompressible$.MODULE$;
|
||||
|
||||
scala.collection.immutable.List<String> fileEx =
|
||||
scala.collection.JavaConversions.asScalaBuffer(java.util.Arrays.asList(fileExtensions)).toList();
|
||||
|
||||
return akka.http.scaladsl.model.MediaType.message(subType, comp, fileEx);
|
||||
}
|
||||
|
||||
public static MediaType.WithOpenCharset text(String subType, String... fileExtensions) {
|
||||
scala.collection.immutable.List<String> fileEx =
|
||||
scala.collection.JavaConversions.asScalaBuffer(java.util.Arrays.asList(fileExtensions)).toList();
|
||||
|
||||
return akka.http.scaladsl.model.MediaType.text(subType, fileEx);
|
||||
}
|
||||
|
||||
public static MediaType.Binary video(String subType, boolean compressible, String... fileExtensions) {
|
||||
akka.http.scaladsl.model.MediaType.Compressibility comp = compressible ?
|
||||
akka.http.scaladsl.model.MediaType.Compressible$.MODULE$ : akka.http.scaladsl.model.MediaType.NotCompressible$.MODULE$;
|
||||
|
||||
scala.collection.immutable.List<String> fileEx =
|
||||
scala.collection.JavaConversions.asScalaBuffer(java.util.Arrays.asList(fileExtensions)).toList();
|
||||
|
||||
return akka.http.scaladsl.model.MediaType.video(subType, comp, fileEx);
|
||||
}
|
||||
|
||||
// arguments have been reordered due to varargs having to be the last argument
|
||||
// should we create multiple overloads of this function?
|
||||
public static MediaType.Binary customBinary(String mainType, String subType, boolean compressible, java.util.Map<String, String> params, boolean allowArbitrarySubtypes, String... fileExtensions) {
|
||||
akka.http.scaladsl.model.MediaType.Compressibility comp = compressible ?
|
||||
akka.http.scaladsl.model.MediaType.Compressible$.MODULE$ : akka.http.scaladsl.model.MediaType.NotCompressible$.MODULE$;
|
||||
|
||||
scala.collection.immutable.List<String> fileEx =
|
||||
scala.collection.JavaConversions.asScalaBuffer(java.util.Arrays.asList(fileExtensions)).toList();
|
||||
|
||||
scala.collection.immutable.Map<String, String> p = Util.convertMapToScala(params);
|
||||
|
||||
return akka.http.scaladsl.model.MediaType.customBinary(mainType, subType, comp, fileEx, p, allowArbitrarySubtypes);
|
||||
}
|
||||
|
||||
public static MediaType.WithFixedCharset customWithFixedCharset(String mainType, String subType, HttpCharset charset, java.util.Map<String, String> params, boolean allowArbitrarySubtypes, String... fileExtensions) {
|
||||
akka.http.scaladsl.model.HttpCharset cs = (akka.http.scaladsl.model.HttpCharset) charset;
|
||||
|
||||
scala.collection.immutable.List<String> fileEx =
|
||||
scala.collection.JavaConversions.asScalaBuffer(java.util.Arrays.asList(fileExtensions)).toList();
|
||||
|
||||
scala.collection.immutable.Map<String, String> p = Util.convertMapToScala(params);
|
||||
|
||||
return akka.http.scaladsl.model.MediaType.customWithFixedCharset(mainType, subType, cs, fileEx, p, allowArbitrarySubtypes);
|
||||
}
|
||||
|
||||
public static MediaType.WithOpenCharset customWithOpenCharset(String mainType, String subType, java.util.Map<String, String> params, boolean allowArbitrarySubtypes, String... fileExtensions) {
|
||||
scala.collection.immutable.List<String> fileEx =
|
||||
scala.collection.JavaConversions.asScalaBuffer(java.util.Arrays.asList(fileExtensions)).toList();
|
||||
|
||||
scala.collection.immutable.Map<String, String> p = Util.convertMapToScala(params);
|
||||
|
||||
return akka.http.scaladsl.model.MediaType.customWithOpenCharset(mainType, subType, fileEx, p, allowArbitrarySubtypes);
|
||||
}
|
||||
|
||||
public static MediaType.Multipart customMultipart(String subType, java.util.Map<String, String> params) {
|
||||
scala.collection.immutable.Map<String, String> p = Util.convertMapToScala(params);
|
||||
return akka.http.scaladsl.model.MediaType.customMultipart(subType, p);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a custom media type.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue