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:

  • Constructor Details

    • RequestAttribute

      public RequestAttribute(RestRequest request, String name, Object value)
      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

      public <T> Optional<T> as(Class<T> type)
      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.