X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fdolda%2Fjsvc%2Fj2ee%2FJ2eeRequest.java;h=685eeeb99e2267b0d8e235a106ff87d10a752ee6;hb=c5364ae271ec11fea2e3d1225846f51ee5d5bc30;hp=1e7d789de80d0bbc25f9995c2cb0b06dbefa1fd1;hpb=6f1acdb2f8879097cdd8c6cedfc0d6752f2b29ef;p=jsvc.git diff --git a/src/dolda/jsvc/j2ee/J2eeRequest.java b/src/dolda/jsvc/j2ee/J2eeRequest.java index 1e7d789..685eeeb 100644 --- a/src/dolda/jsvc/j2ee/J2eeRequest.java +++ b/src/dolda/jsvc/j2ee/J2eeRequest.java @@ -52,6 +52,26 @@ public class J2eeRequest extends ResponseBuffer { return(new J2eeContext(cfg, req, resp)); } + public SocketAddress remoteaddr() { + try { + return(new InetSocketAddress(InetAddress.getByName(req.getRemoteAddr()), req.getRemotePort())); + } catch(UnknownHostException e) { + /* req.getRemoteAddr should always be a valid IP address, + * so this should never happen. */ + throw(new Error(e)); + } + } + + public SocketAddress localaddr() { + try { + return(new InetSocketAddress(InetAddress.getByName(req.getLocalAddr()), req.getLocalPort())); + } catch(UnknownHostException e) { + /* req.getRemoteAddr should always be a valid IP address, + * so this should never happen. */ + throw(new Error(e)); + } + } + public URL url() { return(url); } @@ -98,6 +118,7 @@ public class J2eeRequest extends ResponseBuffer { } protected void backflush() { + resp.setStatus(respcode); for(String key : outheaders().keySet()) { boolean first = true; for(String val : outheaders().values(key)) {