X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fdolda%2Fjsvc%2Fj2ee%2FJ2eeRequest.java;h=9056e77c98d78d5bf32c2a37d423f706396add18;hb=2bacd22079557f2efcceb41ce542a61663c2b6da;hp=574355fddd0043064d2f5bcbdf071c40c0f3dc98;hpb=4b8346e1aad3c58196f8d4dadf9da6726f66f5f4;p=jsvc.git diff --git a/src/dolda/jsvc/j2ee/J2eeRequest.java b/src/dolda/jsvc/j2ee/J2eeRequest.java index 574355f..9056e77 100644 --- a/src/dolda/jsvc/j2ee/J2eeRequest.java +++ b/src/dolda/jsvc/j2ee/J2eeRequest.java @@ -15,7 +15,6 @@ public class J2eeRequest extends ResponseBuffer { private String method, path; private URL url, context; private MultiMap params = null; - private Map props = new HashMap(); public J2eeRequest(ServletConfig cfg, HttpServletRequest req, HttpServletResponse resp) { this.cfg = cfg; @@ -60,7 +59,7 @@ public class J2eeRequest extends ResponseBuffer { q = ""; try { url = new URL(scheme, host, port, req.getContextPath() + req.getServletPath() + pi + q); - context = new URL(scheme, host, port, req.getContextPath()); + context = new URL(scheme, host, port, req.getContextPath() + "/"); } catch(MalformedURLException e) { throw(new Error(e)); } @@ -71,13 +70,13 @@ public class J2eeRequest extends ResponseBuffer { path = path.substring(1); } - public Map props() { - return(props); - } - public SocketAddress remoteaddr() { try { - return(new InetSocketAddress(InetAddress.getByName(req.getRemoteAddr()), req.getRemotePort())); + /* Apparently getRemotePort returns -1 when running on Tomcat over AJP. */ + int port = req.getRemotePort(); + if(port < 0) + port = 0; + return(new InetSocketAddress(InetAddress.getByName(req.getRemoteAddr()), port)); } catch(UnknownHostException e) { /* req.getRemoteAddr should always be a valid IP address, * so this should never happen. */ @@ -145,14 +144,8 @@ public class J2eeRequest extends ResponseBuffer { } public MultiMap params() { - if(params == null) { - params = Params.urlparams(this); - if(method == "POST") { - MultiMap pp = Params.postparams(this); - if(pp != null) - params.putAll(pp); - } - } + if(params == null) + params = Params.stdparams(this); return(params); }