Add a few convenience env accessors.
authorFredrik Tolf <fredrik@dolda2000.com>
Fri, 10 Nov 2023 00:10:11 +0000 (01:10 +0100)
committerFredrik Tolf <fredrik@dolda2000.com>
Fri, 10 Nov 2023 00:10:11 +0000 (01:10 +0100)
src/jrw/Request.java

index 5065320..9ea621a 100644 (file)
@@ -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_");