org.mashupbots.socko.context

HttpRequestProcessingContext

case class HttpRequestProcessingContext (channel: Channel, httpRequest: HttpRequest) extends HttpProcessingContext with Product with Serializable

Context for processing HTTP requests.

channel

Channel by which the request entered and response will be written

httpRequest

Incoming request for processing

Linear Supertypes
Serializable, Serializable, Product, Equals, HttpProcessingContext, ProcessingContext, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. HttpRequestProcessingContext
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. HttpProcessingContext
  7. ProcessingContext
  8. AnyRef
  9. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new HttpRequestProcessingContext (channel: Channel, httpRequest: HttpRequest)

    channel

    Channel by which the request entered and response will be written

    httpRequest

    Incoming request for processing

Value Members

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

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

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

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

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

    Attributes
    final
    Definition Classes
    Any
  6. val acceptedEncodings : Array[String]

    Array of accepted encoding for content compression from the HTTP header

    Array of accepted encoding for content compression from the HTTP header

    For example, give then header Accept-Encoding: gzip, deflate, then an array containing gzip and defalte will be returned.

    Definition Classes
    HttpRequestProcessingContextHttpProcessingContext
  7. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  8. val cache : Map[String, String]

    Cache that can be use to pass data from handler to processor and between processors

    Cache that can be use to pass data from handler to processor and between processors

    Definition Classes
    ProcessingContext
  9. def canEqual (arg0: Any): Boolean

    Definition Classes
    HttpRequestProcessingContext → Equals
  10. val channel : Channel

    Channel by which the request entered and response will be written

    Channel by which the request entered and response will be written

    Definition Classes
    HttpRequestProcessingContextProcessingContext
  11. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  12. val endPoint : EndPoint

    HTTP End point for this request

    HTTP End point for this request

    Definition Classes
    HttpRequestProcessingContextHttpProcessingContextProcessingContext
  13. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  14. def equals (arg0: Any): Boolean

    Definition Classes
    HttpRequestProcessingContext → Equals → AnyRef → Any
  15. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  16. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef → Any
  17. def getHeader (name: String): Option[String]

    Returns the header value with the specified header name.

    Returns the header value with the specified header name. If there are more than one header value for the specified header name, the first value is returned.

    returns

    Some(String) or None if there is no such header or the header content is an empty string

  18. def getIfModifiedSinceHeader (): Option[Date]

    Returns the If-Modified-Since header as Some(Date).

    Returns the If-Modified-Since header as Some(Date). None is returned if the header not present or cannot be parsed

  19. def hashCode (): Int

    Definition Classes
    HttpRequestProcessingContext → AnyRef → Any
  20. val headers : List[Entry[String, String]]

    List of HTTP request headers

  21. val httpRequest : HttpRequest

    Incoming request for processing

  22. val is100ContinueExpected : Boolean

    True if and only if 100 continue is expected to be returned

  23. val isChunked : Boolean

    True if and only if the contents of this HTTP request will be arriving in subsequent HTTPChunks

    True if and only if the contents of this HTTP request will be arriving in subsequent HTTPChunks

    Note that if True, this HTTP request will NOT have any content. The content will be coming in subsequent HTTP chunks and sent for processing as HttpChunkProcessingContext.

  24. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  25. val isKeepAlive : Boolean

    True if and only if is connection is to be kept alive and the channel should NOT be closed after a response is returned.

    True if and only if is connection is to be kept alive and the channel should NOT be closed after a response is returned.

    This flag is controlled by the existence of the keep alive HTTP header.

    Connection: keep-alive
    
    Definition Classes
    HttpRequestProcessingContextHttpProcessingContext
  26. def isWebSocketUpgrade : Boolean

    True if and only if this is a request to upgrade to a websocket connection

  27. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  28. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  29. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  30. def productArity : Int

    Definition Classes
    HttpRequestProcessingContext → Product
  31. def productElement (arg0: Int): Any

    Definition Classes
    HttpRequestProcessingContext → Product
  32. def productIterator : Iterator[Any]

    Definition Classes
    Product
  33. def productPrefix : String

    Definition Classes
    HttpRequestProcessingContext → Product
  34. def readBinaryContent (): Array[Byte]

    Returns the content as byte array.

    Returns the content as byte array. An empty array is returned if there is no content

    Definition Classes
    HttpRequestProcessingContextProcessingContext
  35. def readStringContent (charset: Charset): String

    Returns the content as a string.

    Returns the content as a string. And empty string is returned if there is no content.

    charset

    Character set to use to convert data to string

    Definition Classes
    HttpRequestProcessingContextProcessingContext
  36. def readStringContent (): String

    Returns the content of this request as a string.

    Returns the content of this request as a string. It is assumed that content is encoded in UTF-8. An empty string is returned if there is no content.

    Definition Classes
    HttpRequestProcessingContextProcessingContext
  37. def redirect (url: String): Unit

    Redirects the browser to the specified URL using the 302 HTTP status code.

    Redirects the browser to the specified URL using the 302 HTTP status code.

    Request

    GET /index.html HTTP/1.1
    Host: www.example.com
    

    Response

    HTTP/1.1 302 Found
    Location: http://www.newurl.org/
    
    url

    URL to which the browser will be redirected

    Definition Classes
    HttpProcessingContext
  38. def setContentTypeHeader (response: HttpResponse, mimeType: String): Unit

    Sets the content type header for the HTTP Response

    Sets the content type header for the HTTP Response

    For example:

    Content-Type: image/gif
    
    response

    HTTP response

    mimeType

    MIME type

    Definition Classes
    HttpProcessingContext
  39. def setContentTypeHeader (response: HttpResponse, file: File): Unit

    Sets the content type header for the HTTP Response based on the file name extension

    Sets the content type header for the HTTP Response based on the file name extension

    For example:

    Content-Type: image/gif
    

    This implementation uses MimetypesFileTypeMap and relies on the presence of the file extening in a mime.types file.

    response

    HTTP response

    file

    file to extract content type

    Definition Classes
    HttpProcessingContext
  40. def setDateAndCacheHeaders (response: HttpResponse, lastModified: Date, browserCacheSeconds: Int): Unit

    Sets the Date, Last-Modified, Expires and Cache-Control headers in the HTTP Response

    Sets the Date, Last-Modified, Expires and Cache-Control headers in the HTTP Response

    For example:

    Date:          Tue, 01 Mar 2011 22:44:26 GMT
    Last-Modified: Wed, 30 Jun 2010 21:36:48 GMT
    Expires:       Tue, 01 Mar 2012 22:44:26 GMT
    Cache-Control: private, max-age=31536000
    
    response

    HTTP response

    lastModified

    When the file was last modified

    browserCacheSeconds

    Number of seconds for which the file should be cached by the browser

    Definition Classes
    HttpProcessingContext
  41. def setDateHeader (response: HttpResponse): Unit

    Sets the Date header in the HTTP response.

    Sets the Date header in the HTTP response.

    For example:

    Date: Tue, 01 Mar 2011 22:44:26 GMT
    
    response

    HTTP response

    Definition Classes
    HttpProcessingContext
  42. def setKeepAliveHeader (response: HttpResponse): Unit

    Sets the connection header for the HTTP Response

    Sets the connection header for the HTTP Response

    According to HTTP 1.1 specifications: The Connection header field with a keep-alive keyword must be sent on all requests and responses that wish to continue the persistence.

    For example:

    Connection: keep-alive
    
    response

    HTTP response

    Definition Classes
    HttpProcessingContext
  43. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  44. def toString (): String

    Definition Classes
    HttpRequestProcessingContext → AnyRef → Any
  45. def wait (): Unit

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

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  48. def write100Continue (): Unit

    Sends a 100 continue to the client

  49. def writeErrorResponse (status: HttpResponseStatus, forceCloseChannel: Boolean = false, msg: String = null): Unit

    Sends a HTTP error response to the client.

    Sends a HTTP error response to the client.

    status

    HTTP error status indicating the nature of the error

    forceCloseChannel

    Option flag to force closing channel. Default is false and channel will only be closed if keep-alive header is not set.

    msg

    Optional error message. If not supplied, status description will be used.

    Definition Classes
    HttpProcessingContext
  50. def writeResponse (content: Array[Byte], contentType: String, headers: Map[String, String]): Unit

    Sends a binary HTTP response to the client with a status of "200 OK".

    Sends a binary HTTP response to the client with a status of "200 OK".

    content

    String to send

    contentType

    MIME content type to set in the response header. For example, "image/gif"

    headers

    Additional headers to add to the HTTP response. Defaults to empty map; i.e. no additional headers.

    Definition Classes
    HttpProcessingContext
  51. def writeResponse (content: String, contentType: String = "text/plain; charset=UTF-8", charset: Charset = CharsetUtil.UTF_8, headers: Map[String, String] = Map.empty): Unit

    Sends a string HTTP response to the client with a status of "200 OK".

    Sends a string HTTP response to the client with a status of "200 OK".

    content

    String to send

    contentType

    MIME content type to set in the response header. Defaults to "text/plain; charset=UTF-8".

    charset

    Character set encoding. Defaults to "UTF-8"

    headers

    Additional headers to add to the HTTP response. Defaults to empty map; i.e. no additional headers.

    Definition Classes
    HttpProcessingContext

Deprecated Value Members

  1. def productElements : Iterator[Any]

    Definition Classes
    Product
    Annotations
    @deprecated
    Deprecated

    use productIterator instead

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from HttpProcessingContext

Inherited from ProcessingContext

Inherited from AnyRef

Inherited from Any