Package org.forgerock.http.protocol
Class Request
- java.lang.Object
-
- org.forgerock.http.protocol.MessageImpl<Request>
-
- org.forgerock.http.protocol.Request
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Message<Request>
public final class Request extends MessageImpl<Request>
A request message.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RequestCookies
getCookies()
Returns the incoming request cookies.Form
getForm()
Returns a copy of the query parameters andapplication/x-www-form-urlencoded
entity decoded as a form.String
getMethod()
Returns the method to be performed on the resource.MutableUri
getUri()
Returns the fully-qualified URI of the resource being accessed.Request
setEntity(Object o)
Sets the content of the entity to the provided value.Request
setMethod(String method)
Sets the method to be performed on the resource.Request
setUri(String uri)
Sets the fully-qualified string URI of the resource being accessed.Request
setUri(URI uri)
Sets the fully-qualified URI of the resource being accessed.Request
setVersion(String version)
Sets the protocol version.-
Methods inherited from class org.forgerock.http.protocol.MessageImpl
addHeaders, close, getEntity, getHeaders, getVersion, modifyHeaders, putHeaders
-
-
-
-
Constructor Detail
-
Request
public Request()
Creates a new request message.
-
Request
public Request(Request request) throws IOException
Creates a defensive copy of the givenrequest
message.- Parameters:
request
- request to be copied- Throws:
IOException
- when entity cannot be cloned
-
-
Method Detail
-
getCookies
public RequestCookies getCookies()
Returns the incoming request cookies.- Returns:
- The incoming request cookies.
-
getForm
public Form getForm()
Returns a copy of the query parameters andapplication/x-www-form-urlencoded
entity decoded as a form. Modifications to the returned form are not reflected in this request.- Returns:
- The query parameters and
application/x-www-form-urlencoded
entity as a form.
-
getMethod
public String getMethod()
Returns the method to be performed on the resource.- Returns:
- The method to be performed on the resource.
-
getUri
public MutableUri getUri()
Returns the fully-qualified URI of the resource being accessed.- Returns:
- The fully-qualified URI of the resource being accessed.
-
setEntity
public Request setEntity(Object o)
Description copied from interface:Message
Sets the content of the entity to the provided value. Calling this method will close any existing streams associated with the entity. May also set theContent-Length
header, overwriting any existing header.This method is intended mostly as a convenience method within scripts. The parameter will be handled depending on its type as follows:
BranchingInputStream
- equivalent to callingEntity.setRawContentInputStream(org.forgerock.http.io.BranchingInputStream)
byte[]
- equivalent to callingEntity.setBytes(byte[])
String
- equivalent to callingEntity.setString(java.lang.String)
Object
- equivalent to callingEntity.setJson(java.lang.Object)
.
Note: This method does not attempt to encode the entity based-on any codings specified in the
Content-Encoding
header.- Parameters:
o
- The object whose value should be stored in the entity.- Returns:
- This message.
-
setMethod
public Request setMethod(String method)
Sets the method to be performed on the resource.- Parameters:
method
- The method to be performed on the resource.- Returns:
- This request.
-
setUri
public Request setUri(String uri) throws URISyntaxException
Sets the fully-qualified string URI of the resource being accessed.- Parameters:
uri
- The fully-qualified string URI of the resource being accessed.- Returns:
- This request.
- Throws:
URISyntaxException
- if the given URI string is not well-formed.
-
setUri
public Request setUri(URI uri)
Sets the fully-qualified URI of the resource being accessed.- Parameters:
uri
- The fully-qualified URI of the resource being accessed.- Returns:
- This request.
-
-