This method contains the actual (suspendable) computation.
This method contains the actual (suspendable) computation.
The given talk
parameter contains the methods to access the request and
session data, as well as the method to send the response to the client.
This method is called asynchronously (hence the name aact
)
Is directory listing allowed.
Is directory listing allowed. By default, false
.
Buffer size.
Buffer size. By default 4096
.
Answers with an 404 error message.
Answers with an 404 error message.
Answers with an error response with the given code.
Answers with an error response with the given code.
Answers with an error response with the given code and message.
Answers with an error response with the given code and message.
Index files if no file if given.
Index files if no file if given. By default, none.
When this HLet
accepts multipart requests, this method must return
a parts acceptor that will process the different parts.
When this HLet
accepts multipart requests, this method must return
a parts acceptor that will process the different parts.
An example of part acceptor is:
class ImageUpload extends HSimpleLet { class ImagePartsAcceptor(reqInfo: HReqHeaderData) extends HPartsAcceptor(reqInfo) { // the parts are stored in a byte array output stream private var input: ByteArrayOutputStream = _ // accept only uploaded image files def open(desc: HPartDescriptor) = reqInfo.header("Content-Type") match { case Some(mime) if mime.startsWith("image/") => input = new ByteArrayOutputStream true case _ => false } def accept(bytes: Array[Byte]) = { // write part into the buffer input.write(bytes) // accept more parts true } def close { // save the bytes containing the image image = Some(input.toByteArray) // close the output stream input.close input = null } def declineAll { input = null } } private var image: Option[Array[Byte]] = None def act(talk: HTalk) = { val response = image match { case Some(img) => "Image uploaded" case None => "Not uploaded Image" } talk.setContentLength(response.length).write(response) } }
Indicates whether the default mime type is text/plain
if none could be
recognized by the server (from the file extension).
Indicates whether the default mime type is text/plain
if none could be
recognized by the server (from the file extension).
If this is false
, the default mime type will be application/octet-stream
.
By default, false
.
Redirects the client to the given URI.
Redirects the client to the given URI.
Redirects the client to the given URI and adds the sessions ID to the URI parameters.
Redirects the client to the given URI and adds the sessions ID to the URI parameters.
The root URI.
The root URI.
Simply serve static content from the file system.