Package org.apache.juneau.rest.httppart
Class RequestAttribute
java.lang.Object
org.apache.juneau.rest.httppart.BasicNamedAttribute
org.apache.juneau.rest.httppart.RequestAttribute
- All Implemented Interfaces:
NamedAttribute
Represents a single request attribute on an HTTP request.
Typically accessed through the RequestAttributes
class.
Some important methods on this class are:
RequestAttribute
- Methods for retrieving simple string values:
- Methods for retrieving as custom types:
- Methods for performing assertion checks:
- Other methods:
See Also:
-
Constructor Summary
ConstructorDescriptionRequestAttribute
(RestRequest request, String name, Object value) Constructor. -
Method Summary
Methods inherited from class org.apache.juneau.rest.httppart.BasicNamedAttribute
assertName, assertValue, get, getName, getValue, isPresent, of, of, ofPair, orElse, toString
-
Constructor Details
-
RequestAttribute
Constructor.- Parameters:
request
- The request object.name
- The parameter name.value
- The parameter value.
-
-
Method Details
-
asString
Returns the value of this part as a string.- Returns:
- The value of this part as a string, or
Optional.empty()
if the part was not present.
-
as
Converts this part to the specified POJO.- Type Parameters:
T
- The type to convert to.- Parameters:
type
- The type to convert to.- Returns:
- The converted type, or
Optional.empty()
if the part is not present. - Throws:
BasicHttpException
- If value could not be parsed.
-