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.
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
Channel by which the request entered and response will be written
Channel by which the request entered and response will be written
HTTP end point
HTTP end point
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.
Some(String) or None if there is no such header or the header content is
an empty string
HTTP headers
HTTP request associated with the upgrade to web sockets connection
Flag to be set to True by the route to indicate if the upgrade to a web socket connection is permitted or not
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
Returns the content as byte array.
Returns the content as byte array. An empty array is returned if there is no content
Returns the content as a string.
Returns the content as a string. And empty string is returned if there is no content.
Character set to use to convert data to 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.
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 to which the browser will be redirected
Sets the content type header for the HTTP Response
Sets the content type header for the HTTP Response
For example:
Content-Type: image/gif
HTTP response
MIME type
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.
HTTP response
file to extract content type
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
HTTP response
When the file was last modified
Number of seconds for which the file should be cached by the browser
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
HTTP response
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
HTTP response
Sends a HTTP error response to the client.
Sends a HTTP error response to the client.
HTTP error status indicating the nature of the error
Option flag to force closing channel. Default is false and channel will only be
closed if keep-alive header is not set.
Optional error message. If not supplied, status description will be used.
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".
String to send
MIME content type to set in the response header. For example, "image/gif"
Additional headers to add to the HTTP response. Defaults to empty map; i.e. no additional headers.
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".
String to send
MIME content type to set in the response header. Defaults to "text/plain; charset=UTF-8".
Character set encoding. Defaults to "UTF-8"
Additional headers to add to the HTTP response. Defaults to empty map; i.e. no additional headers.
Context for processing web socket handshakes.
Socko requires that this context be processed in your route and NOT passed to processor actors. The only action that needs to be taken is to set
isAllowedtoTrue.val routes = Routes({ case ctx @ Path("/snoop/websocket/") => ctx match { case ctx: WsHandshakeProcessingContext => { val hctx = ctx.asInstanceOf[WsHandshakeProcessingContext] hctx.isAllowed = true } case ctx: WsProcessingContext => { myActorSystem.actorOf(Props[MyWebSocketFrameProcessor], name) ! ctx } } })If
isAllowedis set toTrue, Socko will perform all the necessary handshaking. If false, the default value, Socko will reject the handshake and web sockets processing will be aborted.isAllowedhas been added as a security measure to make sure that upgrade to web sockets is only performed at explicit routes.Channel by which the request entered and response will be written
HTTP request associated with the upgrade to web sockets connection