Class

scalaj.http

HttpRequest

Related Doc: package http

Permalink

case class HttpRequest(url: String, method: String, connectFunc: HttpExec, params: Seq[(String, String)], headers: Seq[(String, String)], options: Seq[HttpOption], proxyConfig: Option[Proxy], charset: String, sendBufferSize: Int, urlBuilder: (HttpRequest) ⇒ String, compress: Boolean) extends Product with Serializable

Immutable builder for creating an http request

This is the workhorse of the scalaj-http library.

You shouldn't need to construct this manually. Use scalaj.http.Http.apply to get an instance

The params, headers and options methods are all additive. They will always add things to the request. If you want to replace those things completely, you can do something like

.copy(params=newparams)
Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. HttpRequest
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new HttpRequest(url: String, method: String, connectFunc: HttpExec, params: Seq[(String, String)], headers: Seq[(String, String)], options: Seq[HttpOption], proxyConfig: Option[Proxy], charset: String, sendBufferSize: Int, urlBuilder: (HttpRequest) ⇒ String, compress: Boolean)

    Permalink

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. def asBytes: HttpResponse[Array[Byte]]

    Permalink

    Execute this request and parse http body as Array[Byte]

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def asParamMap: HttpResponse[Map[String, String]]

    Permalink

    Execute this request and parse http body as query string key-value pairs

  7. def asParams: HttpResponse[Seq[(String, String)]]

    Permalink

    Execute this request and parse http body as query string key-value pairs

  8. def asString: HttpResponse[String]

    Permalink

    Execute this request and parse http body as String using configured charset

  9. def asToken: HttpResponse[Token]

    Permalink

    Execute this request and parse http body as a querystring containing oauth_token and oauth_token_secret tupple

  10. def auth(user: String, password: String): HttpRequest

    Permalink

    Add a standard basic authorization header

  11. def charset(cs: String): HttpRequest

    Permalink

    Change the charset used to encode the request and decode the response.

    Change the charset used to encode the request and decode the response. UTF-8 by default

  12. val charset: String

    Permalink
  13. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def compress(c: Boolean): HttpRequest

    Permalink

    Should HTTP compression be used If true, Accept-Encoding: gzip,deflate will be sent with request.

    Should HTTP compression be used If true, Accept-Encoding: gzip,deflate will be sent with request. If the server response with Content-Encoding: (gzip|deflate) the client will automatically handle decompression

    This is on by default

    c

    should compress

  15. val compress: Boolean

    Permalink
  16. val connectFunc: HttpExec

    Permalink
  17. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. def exec[T](parser: (Int, Map[String, String], InputStream) ⇒ T): HttpResponse[T]

    Permalink

    Executes this request

    Executes this request

    This is a power user method for parsing the response body. The parser function will be passed the response code, response headers and the InputStream

    T

    the type returned by the input stream parser

    parser

    function to process the response body InputStream

  19. def execute[T](parser: (InputStream) ⇒ T = ...): HttpResponse[T]

    Permalink

    Executes this request

    Executes this request

    T

    the type returned by the input stream parser

    parser

    function to process the response body InputStream. Will be used for all response codes

  20. def finalize(): Unit

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

    Permalink
    Definition Classes
    AnyRef → Any
  22. def header(key: String, value: String): HttpRequest

    Permalink

    Add a http header to the request

  23. def headers(h: (String, String), rest: (String, String)*): HttpRequest

    Permalink

    Add http headers to the request

  24. def headers(h: Seq[(String, String)]): HttpRequest

    Permalink

    Add http headers to the request

  25. def headers(h: Map[String, String]): HttpRequest

    Permalink

    Add http headers to the request

  26. val headers: Seq[(String, String)]

    Permalink
  27. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  28. def method(m: String): HttpRequest

    Permalink

    Change the http request method.

    Change the http request method. The library will allow you to set this to whatever you want. If you want to do a POST, just use the postData, postForm, or postMulti methods. If you want to setup your request as a form, data or multi request, but want to change the method type, call this method after the post method:

    Http(url).postData(dataBytes).method("PUT").asString
  29. val method: String

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

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

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

    Permalink
    Definition Classes
    AnyRef
  33. def oauth(consumer: Token, token: Option[Token], verifier: Option[String]): HttpRequest

    Permalink

    OAuth v1 sign the request with with both the consumer and client token and a verifier

  34. def oauth(consumer: Token, token: Token, verifier: String): HttpRequest

    Permalink

    OAuth v1 sign the request with with both the consumer and client token and a verifier

  35. def oauth(consumer: Token, token: Token): HttpRequest

    Permalink

    OAuth v1 sign the request with with both the consumer and client token

  36. def oauth(consumer: Token): HttpRequest

    Permalink

    OAuth v1 sign the request with the consumer token

  37. def option(o: HttpOption): HttpRequest

    Permalink

    Entry point fo modifying the java.net.HttpURLConnection before the request is executed

  38. def options(o: HttpOption, rest: HttpOption*): HttpRequest

    Permalink

    Entry point fo modifying the java.net.HttpURLConnection before the request is executed

  39. def options(o: Seq[HttpOption]): HttpRequest

    Permalink

    Entry point fo modifying the java.net.HttpURLConnection before the request is executed

  40. val options: Seq[HttpOption]

    Permalink
  41. def param(key: String, value: String): HttpRequest

    Permalink

    Add a param to the GET querystring or POST form request

  42. def params(p: (String, String), rest: (String, String)*): HttpRequest

    Permalink

    Add params to the GET querystring or POST form request

  43. def params(p: Seq[(String, String)]): HttpRequest

    Permalink

    Add params to the GET querystring or POST form request

  44. def params(p: Map[String, String]): HttpRequest

    Permalink

    Add params to the GET querystring or POST form request

  45. val params: Seq[(String, String)]

    Permalink
  46. def postData(data: Array[Byte]): HttpRequest

    Permalink

    Raw byte data POST request

  47. def postData(data: String): HttpRequest

    Permalink

    Raw data POST request.

    Raw data POST request. String bytes written out in using configured charset

  48. def postForm(params: Seq[(String, String)]): HttpRequest

    Permalink

    Standard form POST request and set some parameters.

    Standard form POST request and set some parameters. Same as .postForm.params(params)

  49. def postForm: HttpRequest

    Permalink

    Standard form POST request

  50. def postMulti(parts: MultiPart*): HttpRequest

    Permalink

    Multipart POST request.

    Multipart POST request.

    This is probably what you want if you need to upload a mix of form data and binary data (like a photo)

  51. def proxy(proxy: Proxy): HttpRequest

    Permalink

    Send request via a proxy

  52. def proxy(host: String, port: Int, proxyType: Type): HttpRequest

    Permalink

    Send request via a proxy.

    Send request via a proxy. You choose the type (HTTP or SOCKS)

  53. def proxy(host: String, port: Int): HttpRequest

    Permalink

    Send request via a standard http proxy

  54. val proxyConfig: Option[Proxy]

    Permalink
  55. def sendBufferSize(numBytes: Int): HttpRequest

    Permalink

    The buffer size to use when sending Multipart posts

  56. val sendBufferSize: Int

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

    Permalink
    Definition Classes
    AnyRef
  58. def timeout(connTimeoutMs: Int, readTimeoutMs: Int): HttpRequest

    Permalink

    The socket connection and read timeouts in milliseconds.

    The socket connection and read timeouts in milliseconds. Defaults are 1000 and 5000 respectively

  59. val url: String

    Permalink
  60. val urlBuilder: (HttpRequest) ⇒ String

    Permalink
  61. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped