Package org.apache.tapestry5.http.services

# Interface RestSupport

All Known Implementing Classes:
  `RestSupportImpl`

public interface RestSupport
Service which provides REST-related utilities.

Since:
  5.8.0

- ## 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?

- ## Method Details

  - ### isHttpGet

    boolean isHttpGet()
    Is this request a GET?
    Returns:
      `true` or `false`

  - ### isHttpPost

    boolean isHttpPost()
    Is this request a POST?
    Returns:
      `true` or `false`

  - ### isHttpHead

    boolean isHttpHead()
    Is this request a HEAD?
    Returns:
      `true` or `false`

  - ### isHttpPut

    boolean isHttpPut()
    Is this request a PUT?
    Returns:
      `true` or `false`

  - ### isHttpDelete

    boolean isHttpDelete()
    Is this request a HEAD?
    Returns:
      `true` or `false`

  - ### isHttpPatch

    boolean isHttpPatch()
    Is this request a HEAD?
    Returns:
      `true` or `false`

  - ### getRequestBodyAs

    <T> Optional<T> getRequestBodyAs(Class<T> type)
    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).
    Type Parameters:
      `T` - the type of the return value.
    Parameters:
      `type` - the target type.
    Returns:
      an `Optional` wrapping the resulting object.