Dolda2000 GitWeb
/
jsvc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git.dolda2000.com:/srv/git/r/jsvc
[jsvc.git]
/
src
/
dolda
/
jsvc
/
j2ee
/
J2eeRequest.java
diff --git
a/src/dolda/jsvc/j2ee/J2eeRequest.java
b/src/dolda/jsvc/j2ee/J2eeRequest.java
index
f394653
..
9056e77
100644
(file)
--- a/
src/dolda/jsvc/j2ee/J2eeRequest.java
+++ b/
src/dolda/jsvc/j2ee/J2eeRequest.java
@@
-13,8
+13,8
@@
public class J2eeRequest extends ResponseBuffer {
private HttpServletRequest req;
private HttpServletResponse resp;
private String method, path;
private HttpServletRequest req;
private HttpServletResponse resp;
private String method, path;
- private URL url;
- private M
ap<?, ?> props = new HashMap()
;
+ private URL url
, context
;
+ private M
ultiMap<String, String> params = null
;
public J2eeRequest(ServletConfig cfg, HttpServletRequest req, HttpServletResponse resp) {
this.cfg = cfg;
public J2eeRequest(ServletConfig cfg, HttpServletRequest req, HttpServletResponse resp) {
this.cfg = cfg;
@@
-59,6
+59,7
@@
public class J2eeRequest extends ResponseBuffer {
q = "";
try {
url = new URL(scheme, host, port, req.getContextPath() + req.getServletPath() + pi + q);
q = "";
try {
url = new URL(scheme, host, port, req.getContextPath() + req.getServletPath() + pi + q);
+ context = new URL(scheme, host, port, req.getContextPath() + "/");
} catch(MalformedURLException e) {
throw(new Error(e));
}
} catch(MalformedURLException e) {
throw(new Error(e));
}
@@
-69,17
+70,13
@@
public class J2eeRequest extends ResponseBuffer {
path = path.substring(1);
}
path = path.substring(1);
}
- public Map<?, ?> props() {
- return(props);
- }
-
- public ServerContext ctx() {
- return(new J2eeContext(cfg, req, resp));
- }
-
public SocketAddress remoteaddr() {
try {
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. */
} catch(UnknownHostException e) {
/* req.getRemoteAddr should always be a valid IP address,
* so this should never happen. */
@@
-101,6
+98,14
@@
public class J2eeRequest extends ResponseBuffer {
return(url);
}
return(url);
}
+ public URL rooturl() {
+ return(context);
+ }
+
+ public ServerContext ctx() {
+ return(ThreadContext.current().server());
+ }
+
public String method() {
return(method);
}
public String method() {
return(method);
}
@@
-139,7
+144,9
@@
public class J2eeRequest extends ResponseBuffer {
}
public MultiMap<String, String> params() {
}
public MultiMap<String, String> params() {
- return(null);
+ if(params == null)
+ params = Params.stdparams(this);
+ return(params);
}
protected void backflush() {
}
protected void backflush() {