WebCommon module
This module contains functions used in both the Webapp and CGI programming models, mostly covering the processing of user-supplied data and file uploading. The following tutorials from the Kaya website may be useful:
Data types
- WebCommon::DataSource - Data sources for incoming data
- WebCommon::Uploaded - An uploaded file.
Exceptions
- InvalidCookie - The cookie was invalid
- NotIncoming - Specified key not in incoming data
- urlDecodeError - URL decoding error
- urlEncodeError - URL encoding error
Functions
- Void allowFileUploads() - Allow file uploads
- String contentType(Uploaded file) - Get the content type of the file
- [String] incomingData(String key,DataSource ds) - Returns all values for the specified key from user-supplied data
- Bool incomingExists(String key,DataSource ds) - Checks a key exists in user-supplied data
- Uploaded incomingFile(String key) - Return the first file uploaded with a particular key name
- Bool incomingFileExists(String key) - Check if any files are uploaded with a particular key name
- [String] incomingFileKeys() - Return keys for user-uploaded files
- [Uploaded] incomingFiles(String key) - Return all files uploaded with a particular key name
- [String] incomingKeys(DataSource ds) - Return keys for user-supplied data
- String incomingValue(String key,DataSource ds) - Returns the first value for the specified key from user-supplied data
- Void initWebApp(String queryString,String(String) env,Char() getbody,Bool() endbody) - Initialise the CGI or webapp.
- String originalName(Uploaded file) - Get the real name for the file
- Void removeTemporaryUploaded() - Remove uploaded files
- Pair<String, String> setCookie(String key,String value,Maybe<Time> expires=nothing,Maybe<String> path=nothing,Maybe<String> domain=nothing,Bool secure=false) - Create a cookie header
- Void setKayaMaxPost(Int newmax) - Sets the maximum size of POST data
- Void setKayaUploadDir(String newdir) - Set a temporary directory for Kaya file uploads.
- String tempPath(Uploaded file) - Get the temporary filesystem path of the file
- String urlDecode(String x) - URL decode a string
- String urlEncode(String x) - URL encode a string
- String webappName() - Return a local link URL to the current webapp or CGI