Name | webserver web request |
Event Lines | webserver web request |
Triggers | when a webserver opened by webserver receives a connection request. |
Example |
|
Example |
|
Example |
|
Switches | port:<#> to only handle requests to a specific port.
path:<path> to only handle requests that match the given advanced-matcher for the path. method:<method> to only handle requests with the specific method (such as GET or POST). has_response:<true/false> to only handle requests that do or don't have a response already. |
Contexts | <context.method> returns the method that was used (such as GET or POST).
<context.path> returns the path requested (such as "/index.html").
<context.port> returns the port connected to.
<context.remote_address> returns the IP address that connected.
<context.query> returns a MapTag of the query data (if no query, returns empty map).
<context.raw_query> returns the raw query input (if no query, returns null).
<context.raw_user_info> returns the raw user info input (if any) (this is a historical HTTP system that allows sending username/password over query).
<context.headers> returns a MapTag of all input headers, where the key is the header name and the value is a ListTag of header values for that name.
<context.body> returns the text content of the body that was sent, if any. Particularly for POST requests.
<context.body_binary> returns the raw binary content body that was sent, if any. Particularly for POST requests.
<context.has_response> returns true if a response body determination (raw_text_content, file, or cached_file) was applied, or false if not.
|
Determine | "CODE:<Element(Number)>" to set a standard web response code, such as 'code:200' for 'OK', or 'code:404' for 'File Not Found'
"HEADERS": + MapTag to set a map of headers, where map keys are the header name and map values are the text of the value, for example headers:[Content-Type=text/html] ... note that header are sometimes case-sensitive. "RAW_TEXT_CONTENT:<ElementTag>" to set a raw text content body in response. You may determine only one response - raw text, raw binary, a file, or a cached file. You cannot use multiple. "RAW_BINARY_CONTENT:<BinaryTag>" to set a raw binary content body in response. "FILE:<ElementTag>" to set a path to a file to send in response. File path must be within the web-root path configured in Denizen/config.yml. Files will be read async. "CACHED_FILE:<ElementTag>" to set a path to a file to send in response. The content of the file will be cached in RAM until the server restarts. This is useful for files that definitely won't change. First file read will be sync, all others are instant. "PARSED_FILE:<ElementTag>" - like "FILE:", but this file will be parsed for tags using syntax like "<{util.pi}>" to separate tags from HTML entries. "CACHED_PARSED_FILE:<ElementTag>" - like "PARSED_FILE" and "CACHED_FILE" combined. Note that the file will be cached, but the results of tags will be handled at runtime still. |
Group | Core |
Source | https://github.com/DenizenScript/Denizen-Core/blob/master/src/main/java/com/denizenscript/denizencore/events/core/WebserverWebRequestScriptEvent.java#L29 |