From 963aee0dbe4277f4af01b249d4e0eaebfa653f7a Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Fri, 10 Nov 2023 01:10:11 +0100 Subject: [PATCH] Add a few convenience env accessors. --- src/jrw/Request.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/jrw/Request.java b/src/jrw/Request.java index 5065320..9ea621a 100644 --- a/src/jrw/Request.java +++ b/src/jrw/Request.java @@ -12,6 +12,17 @@ public class Request { this.env = env; } + public String method() {return((String)env.get("REQUEST_METHOD"));} + public String remoteaddr() {return((String)env.get("REMOTE_ADDR"));} + public String serverport() {return((String)env.get("SERVER_PORT"));} + public String servername() {return((String)env.get("SERVER_NAME"));} + public String uri() {return((String)env.get("REQUEST_URI"));} + public String uriname() {return((String)env.get("SCRIPT_NAME"));} + public String filename() {return((String)env.get("SCRIPT_FILENAME"));} + public String pathinfo() {return((String)env.get("PATH_INFO"));} + public String query() {return((String)env.get("QUERY_STRING"));} + public boolean https() {return(env.containsKey("HTTPS"));} + public String ihead(String name, String def) { StringBuilder buf = new StringBuilder(); buf.append("HTTP_"); -- 2.11.0