コード例 #1
0
ファイル: Helpers.java プロジェクト: vdeclerk/playframework
 /**
  * Extracts the content as a String.
  *
  * @param result The result to extract the content from.
  * @param mat The materialiser to use to extract the body from the result stream.
  * @return The content of the result as a String.
  */
 public static String contentAsString(Result result, Materializer mat) {
   return contentAsBytes(result, mat, DEFAULT_TIMEOUT)
       .decodeString(result.charset().orElse("utf-8"));
 }
コード例 #2
0
ファイル: Helpers.java プロジェクト: vdeclerk/playframework
 /**
  * Extracts the content as a String.
  *
  * @param result The result to extract the content from.
  * @param mat The materialiser to use to extract the body from the result stream.
  * @param timeout The amount of time, in milliseconds, to wait for the body to be produced.
  * @return The content of the result as a String.
  */
 public static String contentAsString(Result result, Materializer mat, long timeout) {
   return contentAsBytes(result, mat, timeout).decodeString(result.charset().orElse("utf-8"));
 }
コード例 #3
0
ファイル: Helpers.java プロジェクト: vdeclerk/playframework
 /**
  * Extracts the content as a String.
  *
  * <p>This method is only capable of extracting the content of results with strict entities. To
  * extract the content of results with streamed entities, use {@link #contentAsString(Result,
  * Materializer)}.
  *
  * @param result The result to extract the content from.
  * @return The content of the result as a String.
  * @throws UnsupportedOperationException if the result does not have a strict entity.
  */
 public static String contentAsString(Result result) {
   return contentAsBytes(result).decodeString(result.charset().orElse("utf-8"));
 }