X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fdolda%2Fjsvc%2Fj2ee%2FJ2eeRequest.java;h=9811591e19f6cdde54122f31d0ef31b58b19f761;hb=b606e86e005c98e6b4039bf8e4541ed76273a0da;hp=a5e7518876cab5509554b0a3492205601d9adca2;hpb=78f5d1201f8d3aecb660b7877b08d9bfbe650911;p=jsvc.git diff --git a/src/dolda/jsvc/j2ee/J2eeRequest.java b/src/dolda/jsvc/j2ee/J2eeRequest.java index a5e7518..9811591 100644 --- a/src/dolda/jsvc/j2ee/J2eeRequest.java +++ b/src/dolda/jsvc/j2ee/J2eeRequest.java @@ -20,12 +20,6 @@ public class J2eeRequest extends ResponseBuffer { this.cfg = cfg; this.req = req; this.resp = resp; - try { - req.setCharacterEncoding("UTF-8"); - resp.setCharacterEncoding("UTF-8"); - } catch(UnsupportedEncodingException e) { - throw(new AssertionError(e)); - } { String host = req.getHeader("Host"); if((host == null) || (host.length() < 1)) @@ -54,6 +48,30 @@ public class J2eeRequest extends ResponseBuffer { return(props); } + public ServerContext ctx() { + 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); }