org.mashupbots.socko.context

HttpProcessingContext

class HttpProcessingContext extends ProcessingContext

Abstract context for reading HTTP requests and writing HTTP responses

Attributes
abstract
Linear Supertypes
ProcessingContext, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. HttpProcessingContext
  2. ProcessingContext
  3. AnyRef
  4. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new HttpProcessingContext ()

Abstract Value Members

  1. def 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.

    Attributes
    abstract
  2. def channel : Channel

    Netty channel associated with this request

    Netty channel associated with this request

    Attributes
    abstract
    Definition Classes
    ProcessingContext
  3. def endPoint : EndPoint

    HTTP End point

    HTTP End point

    Attributes
    abstract
    Definition Classes
    HttpProcessingContextProcessingContext
  4. def 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
    
    Attributes
    abstract
  5. def readBinaryContent (): Array[Byte]

    Returns the request content as a byte array

    Returns the request content as a byte array

    Attributes
    abstract
    Definition Classes
    ProcessingContext
  6. def readStringContent (charset: Charset): String

    Returns the request content as a string

    Returns the request content as a string

    charset

    Character set to use to decode binary data into a string

    Attributes
    abstract
    Definition Classes
    ProcessingContext
  7. def readStringContent (): String

    Returns the request content as a string

    Returns the request content as a string

    Attributes
    abstract
    Definition Classes
    ProcessingContext

Concrete 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. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  7. 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
  8. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  9. def eq (arg0: AnyRef): Boolean

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

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

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

    Attributes
    final
    Definition Classes
    AnyRef → Any
  13. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  14. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  15. def ne (arg0: AnyRef): Boolean

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

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

    Attributes
    final
    Definition Classes
    AnyRef
  18. 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

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

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

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

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

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

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

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

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

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

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  29. 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.

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

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

Inherited from ProcessingContext

Inherited from AnyRef

Inherited from Any