@Immutable @Beta public class Request extends Object
JDisc.handleRequest(Request)
.Response
Modifier and Type | Class and Description |
---|---|
static class |
Request.Method |
Modifier and Type | Field and Description |
---|---|
private Map<String,Object> |
attributes |
private byte[] |
body |
private Headers |
headers |
private Request.Method |
method |
private String |
uri |
private Principal |
userPrincipal |
Constructor and Description |
---|
Request(String uri)
Creates a Request with an empty body.
|
Request(String uri,
byte[] body)
Creates a GET Request with a message body.
|
Request(String uri,
byte[] body,
Request.Method method)
Creates a Request with a message body.
|
Request(String uri,
byte[] body,
Request.Method method,
Principal principal)
Creates a Request with a message body, method and user principal.
|
Request(String uri,
String body)
Creates a GET Request with a message body.
|
Request(String uri,
String body,
Request.Method method)
Creates a Request with a message body.
|
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
getAttributes() |
byte[] |
getBody()
Returns the body of this Request.
|
Headers |
getHeaders()
Returns a mutable multi-map of headers for this Request.
|
Request.Method |
getMethod() |
String |
getUri()
Returns the URI of this Request.
|
Optional<Principal> |
getUserPrincipal() |
String |
toString() |
private final Headers headers
private final String uri
private final byte[] body
private final Request.Method method
private final Principal userPrincipal
public Request(String uri)
uri
- the URI of the requestpublic Request(String uri, byte[] body)
uri
- the URI of the requestbody
- the body of the requestpublic Request(String uri, String body)
uri
- the URI of the requestbody
- the body of the request as a UTF-8 stringpublic Request(String uri, byte[] body, Request.Method method)
uri
- the URI of the requestbody
- the body of the requestpublic Request(String uri, byte[] body, Request.Method method, Principal principal)
uri
- the URI of the requestbody
- the body of the requestmethod
- the method of the requestprincipal
- the user principal of the requestpublic Request(String uri, String body, Request.Method method)
uri
- the URI of the requestbody
- the body of the request as a UTF-8 stringpublic Headers getHeaders()
public byte[] getBody()
public String getUri()
public Map<String,Object> getAttributes()
public Request.Method getMethod()
Copyright © 2018. All rights reserved.