1 19 20 package com.sslexplorer.server.jetty; 21 22 import java.io.InputStream ; 23 import java.util.Enumeration ; 24 import java.util.Map ; 25 26 import javax.servlet.http.Cookie ; 27 28 import org.apache.commons.logging.Log; 29 import org.apache.commons.logging.LogFactory; 30 import org.mortbay.http.HttpRequest; 31 32 import com.sslexplorer.boot.RequestHandlerRequest; 33 import com.sslexplorer.boot.RequestHandlerTunnel; 34 35 public class RequestAdapter implements RequestHandlerRequest { 36 37 final static Log log = LogFactory.getLog(RequestAdapter.class); 38 39 private HttpRequest request; 40 41 public RequestAdapter(HttpRequest request) { 42 this.request = request; 43 } 44 45 public HttpRequest getHttpRequest() { 46 return request; 47 } 48 49 public String getURIEncoded() { 50 return request.getURI().toString(); 51 } 52 53 public boolean isSecure() { 54 return request.isConfidential(); 55 } 56 57 public Cookie [] getCookies() { 58 return request.getCookies(); 59 } 60 61 public String getRemoteAddr() { 62 return request.getRemoteAddr(); 63 } 64 65 public String getRemoteHost() { 66 return request.getRemoteHost(); 67 } 68 69 public String getField(String name) { 70 return request.getField(name); 71 } 72 73 public Enumeration getFieldValues(String name) { 74 return request.getFieldValues(name); 75 } 76 77 public String getMethod() { 78 return request.getMethod(); 79 } 80 81 public Enumeration getFieldNames() { 82 return request.getFieldNames(); 83 } 84 85 public String getPath() { 86 return request.getPath(); 87 } 88 89 public Map getParameters() { 90 return request.getParameters(); 91 } 92 93 public String getHost() { 94 return request.getHost(); 95 } 96 97 public InputStream getInputStream() { 98 return request.getInputStream(); 99 } 100 101 public int getPort() { 102 return request.getPort(); 103 } 104 105 public void setTunnel(RequestHandlerTunnel tunnel) { 106 request.getHttpConnection().setHttpTunnel(new TunnelAdapter(tunnel)); 107 } 108 109 public void setTunnel(RequestHandlerTunnel tunnel, int timeoutMs) { 110 request.getHttpConnection().setHttpTunnel(new TunnelAdapter(tunnel, timeoutMs)); 111 } 112 113 public void setAttribute(String name, Object value) { 114 request.setAttribute(name, value); 115 } 116 117 public Object getAttribute(String name) { 118 return request.getAttribute(name); 119 } 120 121 public void setCharacterEncoding(String charset) { 122 request.setCharacterEncoding(charset, false); 123 } 124 125 126 public int getContentLength() { 127 return request.getContentLength(); 128 } 129 130 public String getContentType() { 131 return request.getContentType(); 132 } 133 134 } 135 | Popular Tags |