MessageEntity转换的隐式实例
来源:互联网 发布:c语言调用matlab函数 编辑:程序博客网 时间:2024/06/06 00:33
MessageEntity转换的隐式实例,如下:
trait PredefinedToEntityMarshallers extends MultipartMarshallers {
implicit val ByteArrayMarshaller: ToEntityMarshaller[Array[Byte]] = byteArrayMarshaller(`application/octet-stream`)
def byteArrayMarshaller(contentType: ContentType): ToEntityMarshaller[Array[Byte]] =武侯区无痛人流医院哪家好
武侯区治疗阳痿专业的男科医院
武侯区割包皮好的医院
锦江区治早泄好的医院
锦江区男科医院排名
天府广场做阴道紧缩术效果怎么样?
成都韩式处女膜修补手术好么
Marshaller.withFixedContentType(contentType) { bytes ⇒ HttpEntity(contentType, bytes) }
implicit val ByteStringMarshaller: ToEntityMarshaller[ByteString] = byteStringMarshaller(`application/octet-stream`)
def byteStringMarshaller(contentType: ContentType): ToEntityMarshaller[ByteString] =
Marshaller.withFixedContentType(contentType) { bytes ⇒ HttpEntity(contentType, bytes) }
implicit val CharArrayMarshaller: ToEntityMarshaller[Array[Char]] = charArrayMarshaller(`text/plain`)彭州市哪家医院做无痛人流做得好
武侯区治疗包皮过长好的医院
锦江区阴茎延长手术费用
锦江区治疗早泄大概要多少钱嘛
锦江区做阴茎延长专业的医院
青羊区医院做人流收费贵么
青羊区人流医院哪家好?
武侯区比较正规的人流医院
def charArrayMarshaller(mediaType: MediaType.WithOpenCharset): ToEntityMarshaller[Array[Char]] =
Marshaller.withOpenCharset(mediaType) { (value, charset) ⇒ marshalCharArray(value, mediaType withCharset charset) }
def charArrayMarshaller(mediaType: MediaType.WithFixedCharset): ToEntityMarshaller[Array[Char]] =
Marshaller.withFixedContentType(mediaType) { value ⇒ marshalCharArray(value, mediaType) }
private def marshalCharArray(value: Array[Char], contentType: ContentType.NonBinary): HttpEntity.Strict =
if (value.length > 0) {温江人工流产哪里比较好
武侯区哪家医院人流比较好一点
武侯区做人流需要多少钱
青羊区哪家医院无痛人流好
锦江区做人流哪家医院好
天府新区治盆腔炎专业的医院
锦江区治月经不调好的妇科医院
温江做无痛人流手术什么方法好
彭州市哪家医院做无痛人流做得好
val charBuffer = CharBuffer.wrap(value)
val byteBuffer = contentType.charset.nioCharset.encode(charBuffer)
val array = new Array[Byte](byteBuffer.remaining())
byteBuffer.get(array)
HttpEntity(contentType, array)
} else HttpEntity.Empty
implicit val DoneMarshaller: ToEntityMarshaller[akka.Done] =
Marshaller.withFixedContentType(`text/plain(UTF-8)`) { done ⇒
HttpEntity(`text/plain(UTF-8)`, "")
}
implicit val StringMarshaller: ToEntityMarshaller[String] = stringMarshaller(`text/plain`)
def stringMarshaller(mediaType: MediaType.WithOpenCharset): ToEntityMarshaller[String] =
Marshaller.withOpenCharset(mediaType) { (s, cs) ⇒ HttpEntity(mediaType withCharset cs, s) }
def stringMarshaller(mediaType: MediaType.WithFixedCharset): ToEntityMarshaller[String] =
Marshaller.withFixedContentType(mediaType) { s ⇒ HttpEntity(mediaType, s) }
implicit val FormDataMarshaller: ToEntityMarshaller[FormData] =温江区做人流安全的医院是哪家
成都无痛人流去那里做好
温江人工流产哪里比较好
武侯区哪家医院人流比较好一点
武侯区做人流需要多少钱
青羊区哪家医院无痛人流好
Marshaller.withOpenCharset(`application/x-www-form-urlencoded`) { _ toEntity _ }
implicit val MessageEntityMarshaller: ToEntityMarshaller[MessageEntity] =
Marshaller strict { value ⇒ Marshalling.WithFixedContentType(value.contentType, () ⇒ value) }
}
object PredefinedToEntityMarshallers extends PredefinedToEntityMarshallers
注意:上面的这些转换函数类型都是ToEntityMarshaller,这是一个类型别称,实际上就是Marshaller[T,MessageEntity]:
- MessageEntity转换的隐式实例
- 向上转换的一个实例
- Struts2的类型转换实例
- struts2的类型转换实例
- c++类的拷贝构造函数、隐式转换、重载的赋值操作符的一些分析和实例
- xml文档与字符串的转换实例
- json实例及各种形态的转换
- 由SQL数据库转换Redis的实例
- 实例:常用数据类型之间的相互转换
- Java中XSLT转换的简单实例
- Struts2的类型转换实例详解
- Struts2的类型转换实例详解(升级)
- Gson 转换树型结构的实例
- pinyin4j:拼音与汉字的转换实例
- xml与bean的转换实例
- 实例详解Unity各种坐标的转换
- JS的类型转换,强制转换和隐式转换
- JS的类型转换,强制转换和隐式转换
- SPRING MVC_3
- QT延迟函数实现
- 构建Linux根文件系统(二)
- 编码规范(二)
- bool型变量问题详解
- MessageEntity转换的隐式实例
- U-boot主循环main_loop分析
- 10-CSS综合练习
- /zookeeper_server.pid: No such file or directory FAILED TO WRITE PID
- 读《批判性思维》
- Windows与Linux下tftp服务的使用
- win7 sp1 mbr.asm
- 数据库的基本命令实战
- Thrift 介绍及java实例(1)