Play 2.0 How to Post MultipartFormData using WS.url or WS.WSRequest

后端 未结 6 1317
小蘑菇
小蘑菇 2021-02-08 22:42

In Java Http request, we can do this to make multipart HTTP POST.

HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);

FileBo         


        
6条回答
  •  醉酒成梦
    2021-02-08 23:30

    It seems, based on play API documentation, that there is no built-in for multipart POST bodies.

    However, it may be possible to create your own multipart body using the method

    post[T](body: T)(implicit wrt: Writeable[T], ct: ContentTypeOf[T]): Future[Response]
    

    with a type T of your choice, and the corresponding Writeable and ContentTypeOf types too.

    But this would imply digging in how multipart bodies work with HTTP.

提交回复
热议问题