fr.hmil.roshttp

HttpRequest

final class HttpRequest extends AnyRef

Builds an HTTP request.

The request is sent using send. A request can be sent multiple times.

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

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. val backendConfig: BackendConfig

  8. val body: Option[BodyPart]

  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. val crossDomainCookies: Boolean

  11. final def eq(arg0: AnyRef): Boolean

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

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

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. def get()(implicit scheduler: Scheduler): Future[SimpleHttpResponse]

    Sends this request with the GET method.

    Sends this request with the GET method.

    See also

    send

  15. final def getClass(): Class[_]

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

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

  18. val host: String

  19. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  20. val longPath: String

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

  21. val method: Method

  22. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  23. final def notify(): Unit

    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  25. def options(body: BodyPart)(implicit scheduler: Scheduler): Future[SimpleHttpResponse]

    Sends this request with the OPTIONS method and a body

    Sends this request with the OPTIONS method and a body

    body

    The body to send with the request

    See also

    post

  26. val path: String

  27. val port: Option[Int]

  28. def post(body: BodyPart)(implicit scheduler: Scheduler): Future[SimpleHttpResponse]

    Sends this request with the POST method and a body

    Sends this request with the POST method and a body

    body

    The body to send with the request

    See also

    send

  29. val protocol: Protocol

  30. def put(body: BodyPart)(implicit scheduler: Scheduler): Future[SimpleHttpResponse]

    Sends this request with the PUT method and a body

    Sends this request with the PUT method and a body

    body

    The body to send with the request

    See also

    post

  31. val queryString: Option[String]

  32. def send(body: BodyPart)(implicit scheduler: Scheduler): Future[SimpleHttpResponse]

    Sends this request with a body.

    Sends this request with a body.

    This method should not be used directly. If you want to post or put some data, you should use the appropriate methods. If you do not want to send data with the request, you should use post without arguments.

    body

    The body to send.

  33. def send()(implicit scheduler: Scheduler): Future[SimpleHttpResponse]

    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.]]

  34. def stream()(implicit scheduler: Scheduler): Future[StreamHttpResponse]

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

    Definition Classes
    AnyRef
  36. val timeout: FiniteDuration

  37. def toString(): String

    Definition Classes
    AnyRef → Any
  38. val url: String

    The target url for this request

  39. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. def withBackendConfig(backendConfig: BackendConfig): HttpRequest

    Use the provided backend configuration when executing the request

  43. def withBody(body: BodyPart): HttpRequest

    Attaches a body to this request and sets the Content-Type header.

    Attaches a body to this request and sets the Content-Type header.

    The body will be sent with the request regardless of other parameters once send() is invoked. Any subsequent call to withBody(), send(BodyPart), post(BodyPart), put(BodyPart) or similar methods will override the request body.

    The Content-Type header is set to this body's content-type. It can still be manually overridden using a method of the withHeader() family.

    Note that the HTTP spec forbids sending data with some methods. In case you need to deal with a broken backend, this library allows you to do so anyway. **Beware that in this case, the JVM can still enforce a compliant HTTP method**.

  44. def withCrossDomainCookies(toggle: Boolean): HttpRequest

    Allows browser to add a cookie to a cross-domain request, if one was received prior from the server.

    Allows browser to add a cookie to a cross-domain request, if one was received prior from the server.

    toggle

    If true, browser is allowed to add cookie to cross-domain request.

    returns

    A copy of this HttpRequest with an updated header set.

  45. def withDefaultPort(): HttpRequest

    Discards changes introduced by any call to withPort

    Discards changes introduced by any call to withPort

    returns

    A copy of this HttpRequest with no explicit port.

  46. def withHeader(key: String, value: String): HttpRequest

    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.

  47. def withHeaders(newHeaders: (String, String)*): HttpRequest

    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.

  48. def withHost(host: String): HttpRequest

    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

  49. def withMethod(method: Method): HttpRequest

    Sets the HTTP method.

    Sets the HTTP method. Defaults to GET.

    Beware of browser limitations when using exotic methods.

    method

    The new method

    returns

    A copy of this HttpRequest with an updated method

  50. def withPath(path: String): HttpRequest

    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

  51. def withPort(port: Int): HttpRequest

    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

  52. def withProtocol(protocol: Protocol): HttpRequest

    Sets the protocol used in the request URL.

    Sets the protocol used in the request URL.

    Setting the protocol also sets the port accordingly (80 for HTTP, 443 for HTTPS).

    protocol

    The HTTP or HTTPS protocol

    returns

    A copy of this HttpRequest with an updated protocol and port

  53. def withQueryObjectParameter(key: String, values: Seq[(String, String)]): HttpRequest

    Adds an object made of key/value pairs to the query string.

    Adds an object made of key/value pairs to the query string.

    Although this is not part of a spec, most servers recognize bracket indices in a query string as object keys. The same key can appear multiple times as some server will interpret this as multiple elements in an array for that key.

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

    key

    The unescaped parameter key

    values

    The unescaped parameter map values

    returns

    A copy of this HttpRequest with an updated query string.

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

    Adds a query parameter key/value pair.

    Adds a query parameter key/value pair.

    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.

  55. def withQueryParameters(parameters: (String, String)*): HttpRequest

    Adds multiple query parameters.

    Adds multiple query parameters.

    parameters

    A sequence of new, unescaped parameters.

    returns

    A copy of this HttpRequest with an updated query string.

  56. def withQuerySeqParameter(key: String, values: Seq[String]): HttpRequest

    Adds a query array parameter.

    Adds a query array parameter.

    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.

  57. def withQueryString(queryString: String): HttpRequest

    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

  58. def withQueryStringRaw(queryString: String): HttpRequest

    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

  59. def withTimeout(timeout: FiniteDuration): HttpRequest

    Specifies the request timeout.

    Specifies the request timeout.

    When a request takes longer than timeout to complete, the future is rejected with a fr.hmil.roshttp.exceptions.TimeoutException.

    timeout

    The duration to wait before throwing a timeout exception.

    returns

    A copu of this HttpRequest with an updated timeout setting.

  60. def withURL(url: String): HttpRequest

    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.

  61. def withoutQueryString(): HttpRequest

    Removes the query string.

    Removes the query string.

    returns

    A copy of this HttpRequest without query string

Inherited from AnyRef

Inherited from Any

Ungrouped