1 16 package org.mortbay.http; 17 18 import java.net.Socket ; 19 20 import org.mortbay.util.InetAddrPort; 21 22 29 public class HostSocketListener extends SocketListener 30 { 31 String _host; 32 33 public HostSocketListener() 34 { 35 super(); 36 } 37 38 public HostSocketListener(InetAddrPort address) 39 { 40 super(address); 41 } 42 43 46 public String getForcedHost() 47 { 48 return _host; 49 } 50 51 54 public void setForcedHost(String host) 55 { 56 _host = host; 57 } 58 59 62 protected void customizeRequest(Socket socket, HttpRequest request) 63 { 64 request.setState(HttpMessage.__MSG_EDITABLE); 65 if (_host==null) 66 request.removeField(HttpFields.__Host); 67 else 68 request.setField(HttpFields.__Host, _host); 69 request.setState(HttpMessage.__MSG_RECEIVED); 70 super.customizeRequest(socket, request); 71 } 72 } 73 | Popular Tags |