Package org.apache.tapestry5.http.internal.services

# Class RestSupportImpl

java.lang.Object
org.apache.tapestry5.http.internal.services.RestSupportImpl

All Implemented Interfaces:
  `RestSupport`

public class RestSupportImpl extends Object implements RestSupport
Default RestSupport implementation.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RestSupportImpl(javax.servlet.http.HttpServletRequest request, HttpRequestBodyConverter converter)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `<T> Optional<T>`
  `getRequestBodyAs(Class<T> type)`
  Returns, if present, the body of the request body coerced to a given type.
  `boolean`
  `isHttpDelete()`
  Is this request a HEAD?
  `boolean`
  `isHttpGet()`
  Is this request a GET?
  `boolean`
  `isHttpHead()`
  Is this request a HEAD?
  `boolean`
  `isHttpPatch()`
  Is this request a HEAD?
  `boolean`
  `isHttpPost()`
  Is this request a POST?
  `boolean`
  `isHttpPut()`
  Is this request a PUT?

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### RestSupportImpl

    public RestSupportImpl(javax.servlet.http.HttpServletRequest request, HttpRequestBodyConverter converter)

- ## Method Details

  - ### isHttpGet

    public boolean isHttpGet()
    Description copied from interface: `RestSupport`
    Is this request a GET?
    Specified by:
      `isHttpGet` in interface `RestSupport`
    Returns:
      `true` or `false`

  - ### isHttpPost

    public boolean isHttpPost()
    Description copied from interface: `RestSupport`
    Is this request a POST?
    Specified by:
      `isHttpPost` in interface `RestSupport`
    Returns:
      `true` or `false`

  - ### isHttpHead

    public boolean isHttpHead()
    Description copied from interface: `RestSupport`
    Is this request a HEAD?
    Specified by:
      `isHttpHead` in interface `RestSupport`
    Returns:
      `true` or `false`

  - ### isHttpPut

    public boolean isHttpPut()
    Description copied from interface: `RestSupport`
    Is this request a PUT?
    Specified by:
      `isHttpPut` in interface `RestSupport`
    Returns:
      `true` or `false`

  - ### isHttpDelete

    public boolean isHttpDelete()
    Description copied from interface: `RestSupport`
    Is this request a HEAD?
    Specified by:
      `isHttpDelete` in interface `RestSupport`
    Returns:
      `true` or `false`

  - ### isHttpPatch

    public boolean isHttpPatch()
    Description copied from interface: `RestSupport`
    Is this request a HEAD?
    Specified by:
      `isHttpPatch` in interface `RestSupport`
    Returns:
      `true` or `false`

  - ### getRequestBodyAs

    public <T> Optional<T> getRequestBodyAs(Class<T> type)
    Description copied from interface: `RestSupport`
    Returns, if present, the body of the request body coerced to a given type. If the body is empty, an empty Optional is returned. Coercions are done through, which uses TypeCoercer as a fallback (coercing HttpServletRequest to the target type).
    Specified by:
      `getRequestBodyAs` in interface `RestSupport`
    Type Parameters:
      `T` - the type of the return value.
    Parameters:
      `type` - the target type.
    Returns:
      an `Optional` wrapping the resulting object.