PostMethod setRequestBody(String) deprecated – why?

The javadoc says:

Deprecated. use setRequestEntity(RequestEntity)

RequestEntity has a lot of implementors, namely:

ByteArrayRequestEntity, FileRequestEntity, InputStreamRequestEntity, MultipartRequestEntity, StringRequestEntity

Use the one that suits you:

  • if your xml is in a String, use the StringRequestEntity
  • if it is in a file, use the FileRequestEntity

and so on.

Leave a Comment