/** * Set a Text to this request. * The <tt>Content-Type</tt> header of the request is set to <tt>text/plain; charset=$charset</tt>. * * @param text the text, which is assumed to be already encoded in the format defined by charset. * @param charset the character set that the request is encoded in. * @return this builder, updated */ public RequestBuilder bodyText(String text, Charset charset) { return body(new RequestBody(text), "text/plain; charset=" + charset.name()); }
/** * Set a Text to this request. * The <tt>Content-Type</tt> header of the request is set to <tt>text/plain; charset=$charset</tt>. * * @param text the text, which is assumed to be already encoded in the format defined by charset. * @param charset the character set that the request is encoded in. * @return this builder, updated */ public RequestBuilder bodyText(String text, Charset charset) { return body(new RequestBody(text), "text/plain; charset=" + charset.name()); }
/** * Set a Text to this request. * The <tt>Content-Type</tt> header of the request is set to <tt>text/plain</tt>. * * @param text the text, assumed to be encoded in US_ASCII format, per https://tools.ietf.org/html/rfc6657#section-4 * @return this builder, updated */ public RequestBuilder bodyText(String text) { return body(new RequestBody(text), "text/plain"); }
/** * Set a XML to this request. * * The <tt>Content-Type</tt> header of the request is set to <tt>application/xml</tt>. * * @param xml the XML * @return the modified builder */ public RequestBuilder bodyXml(Document xml) { return body(new RequestBody(xml), "application/xml"); }
/** * Set a Form url encoded body to this request. * * @param data the x-www-form-urlencoded parameters * @return the modified builder */ public RequestBuilder bodyFormArrayValues(Map<String, String[]> data) { return body(new RequestBody(data), "application/x-www-form-urlencoded"); }
/** * Set a Binary Data to this request. * The <tt>Content-Type</tt> header of the request is set to <tt>application/octet-stream</tt>. * * @param data the Binary Data * @param tempFileCreator the temporary file creator for binary data. * @return the modified builder */ public RequestBuilder bodyRaw(ByteString data, Files.TemporaryFileCreator tempFileCreator) { play.api.mvc.RawBuffer buffer = new play.api.mvc.RawBuffer(data.size(), tempFileCreator.asScala(), data); return body(new RequestBody(JavaParsers.toJavaRaw(buffer)), "application/octet-stream"); }
/** * Set a Binary Data to this request using a singleton temp file creator * The <tt>Content-Type</tt> header of the request is set to <tt>application/octet-stream</tt>. * * @param data the Binary Data * @return the modified builder */ public RequestBuilder bodyRaw(ByteString data) { final Files.TemporaryFileCreator tempFileCreator = Files.singletonTemporaryFileCreator(); play.api.mvc.RawBuffer buffer = new play.api.mvc.RawBuffer(data.size(), tempFileCreator.asScala(), data); return body(new RequestBody(JavaParsers.toJavaRaw(buffer)), "application/octet-stream"); }
/** * Set a XML to this request. * * The <tt>Content-Type</tt> header of the request is set to <tt>application/xml</tt>. * * @param xml the XML * @return the modified builder */ public RequestBuilder bodyXml(Document xml) { return body(new RequestBody(xml), "application/xml"); }
/** * Set a Form url encoded body to this request. * * @param data the x-www-form-urlencoded parameters * @return the modified builder */ public RequestBuilder bodyFormArrayValues(Map<String, String[]> data) { return body(new RequestBody(data), "application/x-www-form-urlencoded"); }
/** * Set a Text to this request. * The <tt>Content-Type</tt> header of the request is set to <tt>text/plain</tt>. * * @param text the text, assumed to be encoded in US_ASCII format, per https://tools.ietf.org/html/rfc6657#section-4 * @return this builder, updated */ public RequestBuilder bodyText(String text) { return body(new RequestBody(text), "text/plain"); }
/** * Set a Binary Data to this request using a singleton temp file creator * The <tt>Content-Type</tt> header of the request is set to <tt>application/octet-stream</tt>. * * @param data the Binary Data * @return the modified builder */ public RequestBuilder bodyRaw(ByteString data) { final Files.TemporaryFileCreator tempFileCreator = Files.singletonTemporaryFileCreator(); play.api.mvc.RawBuffer buffer = new play.api.mvc.RawBuffer(data.size(), tempFileCreator.asScala(), data); return body(new RequestBody(JavaParsers.toJavaRaw(buffer)), "application/octet-stream"); }
/** * Set a Json Body to this request. * The <tt>Content-Type</tt> header of the request is set to <tt>application/json</tt>. * * @param node the Json Node * @return this builder, updated */ public RequestBuilder bodyJson(JsonNode node) { return body(new RequestBody(node), "application/json"); }
/** * Set a Binary Data to this request. * The <tt>Content-Type</tt> header of the request is set to <tt>application/octet-stream</tt>. * * @param data the Binary Data * @param tempFileCreator the temporary file creator for binary data. * @return the modified builder */ public RequestBuilder bodyRaw(ByteString data, Files.TemporaryFileCreator tempFileCreator) { play.api.mvc.RawBuffer buffer = new play.api.mvc.RawBuffer(data.size(), tempFileCreator.asScala(), data); return body(new RequestBody(JavaParsers.toJavaRaw(buffer)), "application/octet-stream"); }
/** * Set a XML to this request. * * The <tt>Content-Type</tt> header of the request is set to <tt>application/xml</tt>. * * @param xml the XML * @return the modified builder */ public RequestBuilder bodyXml(Document xml) { return body(new RequestBody(xml), "application/xml"); }
/** * Set a Form url encoded body to this request. * * @param data the x-www-form-urlencoded parameters * @return the modified builder */ public RequestBuilder bodyFormArrayValues(Map<String, String[]> data) { return body(new RequestBody(data), "application/x-www-form-urlencoded"); }
/** * Set a Binary Data to this request using a singleton temp file creator * The <tt>Content-Type</tt> header of the request is set to <tt>application/octet-stream</tt>. * * @param data the Binary Data * @return the modified builder */ public RequestBuilder bodyRaw(ByteString data) { final Files.TemporaryFileCreator tempFileCreator = Files.singletonTemporaryFileCreator(); play.api.mvc.RawBuffer buffer = new play.api.mvc.RawBuffer(data.size(), tempFileCreator.asScala(), data); return body(new RequestBody(JavaParsers.toJavaRaw(buffer)), "application/octet-stream"); }
/** * Set a Json Body to this request. * The <tt>Content-Type</tt> header of the request is set to <tt>application/json</tt>. * * @param node the Json Node * @return this builder, updated */ public RequestBuilder bodyJson(JsonNode node) { return body(new RequestBody(node), "application/json"); }
/** * Set a Text to this request. * The <tt>Content-Type</tt> header of the request is set to <tt>text/plain</tt>. * * @param text the text, assumed to be encoded in US_ASCII format, per https://tools.ietf.org/html/rfc6657#section-4 * @return this builder, updated */ public RequestBuilder bodyText(String text) { return body(new RequestBody(text), "text/plain"); }
/** * Set a Binary Data to this request. * The <tt>Content-Type</tt> header of the request is set to <tt>application/octet-stream</tt>. * * @param data the Binary Data * @param tempFileCreator the temporary file creator for binary data. * @return the modified builder */ public RequestBuilder bodyRaw(ByteString data, Files.TemporaryFileCreator tempFileCreator) { play.api.mvc.RawBuffer buffer = new play.api.mvc.RawBuffer(data.size(), tempFileCreator.asScala(), data); return body(new RequestBody(JavaParsers.toJavaRaw(buffer)), "application/octet-stream"); }
/** * Set a Json Body to this request. * The <tt>Content-Type</tt> header of the request is set to <tt>application/json</tt>. * * @param node the Json Node * @return this builder, updated */ public RequestBuilder bodyJson(JsonNode node) { return body(new RequestBody(node), "application/json"); }