Post java object using Play WS

How to send/submit java object of type application/x-java-serialized-object using Play WS

  1. Set the Content-Type header (Scala docs, Java docs)
  2. Call post(body) where body is a Source, InputStream, ByteString, etc. (Scala docs, Java docs)

Thanks. My code using ws.url(…).post(new ByteArrayInputStream(byteArray)) and working fine till date, but latest version post(is) method deprecated. What are all different options?

post(inputstream) API method doesn’t provide documention with alternative option. I tried using DefaultBodyWritables and body(byteArray) not working. it doesn’t seems alternative for post(is)