Package playn.core
Class Net.Builder
java.lang.Object
playn.core.Net.Builder
- Enclosing class:
Net
Builds a request and allows it to be configured and executed.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds the supplied request header.execute()
Executes this request, delivering the response viacallback
.boolean
isPost()
method()
setPayload
(byte[] payload) Configures the payload of this request as raw bytes with content type "application/octet-stream".setPayload
(byte[] payload, String contentType) Configures the payload of this request as raw bytes with the specified content type.setPayload
(String payload) Configures the payload of this request as a UTF-8 string with content type "text/plain".setPayload
(String payload, String contentType) Configures the payload of this request as a UTF-8 string with content type configured as "contentType
; charset=UTF-8".
-
Field Details
-
url
-
headers
-
contentType
-
payloadString
-
payloadBytes
public byte[] payloadBytes
-
-
Method Details
-
setPayload
Configures the payload of this request as a UTF-8 string with content type "text/plain". This converts the request to a POST. -
setPayload
Configures the payload of this request as a UTF-8 string with content type configured as "contentType
; charset=UTF-8". The supplied content type should probably be something liketext/plain
ortext/xml
orapplication/json
. This converts the request to a POST. -
setPayload
Configures the payload of this request as raw bytes with content type "application/octet-stream". This converts the request to a POST. -
setPayload
Configures the payload of this request as raw bytes with the specified content type. This converts the request to a POST. -
addHeader
Adds the supplied request header.- Parameters:
name
- the name of the header (e.g.Authorization
).value
- the value of the header.
-
execute
Executes this request, delivering the response viacallback
. -
isPost
public boolean isPost() -
method
-
contentType
-