Package com.io7m.cardant.server.http

# Class CAHTTPServerRequests

java.lang.Object
com.io7m.cardant.server.http.CAHTTPServerRequests

public final class CAHTTPServerRequests extends Object
Functions over server requests.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static long`
  `contentLength(io.helidon.webserver.http.ServerRequest request)`
  Obtain the content length for the given request, or -1 if none exists.
  `static String`
  `parameter(io.helidon.webserver.http.ServerRequest request, String name)`
  Obtain the value of the given query parameter.
  `static Optional<String>`
  `parameterOrEmpty(io.helidon.webserver.http.ServerRequest request, String name)`
  Obtain the value of the given query parameter.
  `static String`
  `remoteAddress(io.helidon.webserver.http.ServerRequest request)`
  Obtain the remote address for the given request.
  `static String`
  `userAgent(io.helidon.webserver.http.ServerRequest request)`
  Obtain the user agent for the given request, or the empty string if none exists.

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

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

- ## Method Details

  - ### contentLength

    public static long contentLength(io.helidon.webserver.http.ServerRequest request)
    Obtain the content length for the given request, or -1 if none exists.
    Parameters:
      `request` - The request
    Returns:
      The content length

  - ### userAgent

    public static String userAgent(io.helidon.webserver.http.ServerRequest request)
    Obtain the user agent for the given request, or the empty string if none exists.
    Parameters:
      `request` - The request
    Returns:
      The user agent

  - ### remoteAddress

    public static String remoteAddress(io.helidon.webserver.http.ServerRequest request)
    Obtain the remote address for the given request. The function takes into account headers such as "X-Forwarded-For".
    Parameters:
      `request` - The request
    Returns:
      The remote address

  - ### parameter

    public static String parameter(io.helidon.webserver.http.ServerRequest request, String name)
    Obtain the value of the given query parameter.
    Parameters:
      `request` - The request
      `name` - The parameter name
    Returns:
      The parameter value (or null)

  - ### parameterOrEmpty

    public static Optional<String> parameterOrEmpty(io.helidon.webserver.http.ServerRequest request, String name)
    Obtain the value of the given query parameter.
    Parameters:
      `request` - The request
      `name` - The parameter name
    Returns:
      The parameter value