Class/Object

fr.hmil.scalahttp.client

HttpRequest

Related Docs: object HttpRequest | package client

Permalink

final class HttpRequest extends AnyRef

Builds an HTTP request.

The request is sent using send. A request can be sent multiple times. Each time yields a Future[HttpResponse] which either succeeds with an HttpResponse or fails with an HttpNetworkError

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. HttpRequest
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  11. val headers: HeaderMap[String]

    Permalink
  12. val host: String

    Permalink
  13. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  14. val longPath: String

    Permalink

    The path with the query string or just the path if there is no query string

  15. val method: Method

    Permalink
  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. val path: String

    Permalink
  20. val port: Int

    Permalink
  21. val protocol: Protocol

    Permalink
  22. val queryString: Option[String]

    Permalink
  23. def send(): Future[HttpResponse]

    Permalink

    Sends this request.

    Sends this request.

    A request can be sent multiple times. When a request is sent, it returns a Future[HttpResponse] which either succeeds with an HttpResponse or fails with an HttpNetworkError.

    Possible reasons for the future failing are: - A status code >= 400 - A network error

    Note that in some cases the response body can still be obtained after a failure through the HttpNetworkError.

    returns

    A future of HttpResponse which may fail with an HttpNetworkError

  24. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  25. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  26. val url: String

    Permalink

    The target url for this request

  27. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. def withHeader(key: String, value: String): HttpRequest

    Permalink

    Adds or updates a header to the current set of headers.

    Adds or updates a header to the current set of headers.

    key

    The header key (case insensitive)

    value

    The header value

    returns

    A copy of this HttpRequest with an updated header set.

  31. def withHeaders(newHeaders: Map[String, String]): HttpRequest

    Permalink

    Adds or updates multiple headers to the current set of headers.

    Adds or updates multiple headers to the current set of headers.

    newHeaders

    The headers to add.

    returns

    A copy of this HttpRequest with an updated header set.

  32. def withHost(host: String): HttpRequest

    Permalink

    Sets the host used in the request URI.

    Sets the host used in the request URI.

    host

    The new host

    returns

    A copy of this HttpRequest with an updated host

  33. def withPath(path: String): HttpRequest

    Permalink

    Sets the path used in the request URI.

    Sets the path used in the request URI.

    The path is the part that lies between the host (or port if present) and the query string or the end of the request. Note that the query string is not part of the path.

    path

    The new path, including the leading '/' and excluding any '?' or '#' and subsequent characters

    returns

    A copy of this HttpRequest with an updated path

  34. def withPort(port: Int): HttpRequest

    Permalink

    Sets the port used in the request URI.

    Sets the port used in the request URI.

    port

    The new port

    returns

    A copy of this HttpRequest with an updated port

  35. def withProtocol(protocol: Protocol): HttpRequest

    Permalink

    Sets the protocol used in the request URL.

    Sets the protocol used in the request URL.

    At the moment, only HTTP is supported.

    protocol

    The HTTP protocol

    returns

    A copy of this HttpRequest with an updated protocol

    Exceptions thrown

    IllegalArgumentException when something else than HTTP is passed as argument

  36. def withQueryParameter(key: String, values: Map[String, String]): HttpRequest

    Permalink

    Adds a query map parameter or updates it if it already exists.

    Adds a query map parameter or updates it if it already exists.

    Although this is not part of a spec, most servers recognize bracket indices in a query string as array indices or object keys.

    example: ?obj[foo]=bar&obj[baz]=42

    This method formats map values according to the above example.

    key

    The unescaped parameter key

    values

    The unescaped parameter map values

    returns

    A copy of this HttpRequest with an updated query string.

    See also

    withQueryParameter(String,String)

  37. def withQueryParameter(key: String, values: List[String]): HttpRequest

    Permalink

    Adds a query array parameter or updates it if it already exists.

    Adds a query array parameter or updates it if it already exists.

    Although this is not part of a spec, most servers recognize bracket indices in a query string as array indices or object keys.

    example: ?list[0]=foo&list[1]=bar

    This method formats array values according to the above example.

    key

    The unescaped parameter key

    values

    The unescaped parameter array values

    returns

    A copy of this HttpRequest with an updated query string.

    See also

    withQueryParameter(String,String)

  38. def withQueryParameter(key: String, value: String): HttpRequest

    Permalink

    Adds a query parameter or updates it if it already exists.

    Adds a query parameter or updates it if it already exists.

    Query parameters end up in the query string as key=value pairs separated by ampersands. Both the key and parameter are escaped to ensure proper query string format.

    key

    The unescaped parameter key

    value

    The unescaped parameter value

    returns

    A copy of this HttpRequest with an updated query string.

  39. def withQueryParameters(parameters: Map[String, String]): HttpRequest

    Permalink

    Adds multiple query parameters and updates those already existing.

    Adds multiple query parameters and updates those already existing.

    parameters

    A map of new parameters.

    returns

    A copy of this HttpRequest with an updated query string.

    See also

    withQueryParameter(String,String)

  40. def withQueryString(queryString: String): HttpRequest

    Permalink

    Sets the query string.

    Sets the query string.

    The argument is escaped by this method. If you want to bypass the escaping, use withQueryStringRaw.

    Escaping also means that the queryString property will generally not be equal to what you passed as argument to withQueryString.

    For instance: request.withQueryString("äéuô").queryString.get != "%C3%A4%C3%A9u%C3%B4"

    queryString

    The unescaped query string.

    returns

    A copy of this HttpRequest with an updated queryString

  41. def withQueryStringRaw(queryString: String): HttpRequest

    Permalink

    Sets the query string without escaping.

    Sets the query string without escaping.

    Raw query strings must only contain legal characters as per rfc3986. Adding special characters yields undefined behaviour.

    In most cases, withQueryString should be preferred.

    queryString

    The raw, escaped query string

    returns

    A copy of this HttpRequest with an updated queryString

  42. def withURL(url: String): HttpRequest

    Permalink

    Updates request protocol, host, port, path and queryString according to a url.

    Updates request protocol, host, port, path and queryString according to a url.

    url

    A valid HTTP url

    returns

    A copy of this HttpRequest with updated URL-related attributes.

  43. def withoutQueryString(): HttpRequest

    Permalink

    Removes the query string.

    Removes the query string.

    returns

    A copy of this HttpRequest without query string

Inherited from AnyRef

Inherited from Any

Ungrouped