pier 00/12/13 19:36:37 Modified: catalina/src/share/org/apache/catalina/connector/warp WarpHost.java Log: Added "port" property in WarpHost. The invoke() method in WarpHost now takes care of setting the host name and port in the request. Revision Changes Path 1.5 +34 -1 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpHost.java Index: WarpHost.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpHost.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- WarpHost.java 2000/12/14 01:25:57 1.4 +++ WarpHost.java 2000/12/14 03:36:37 1.5 @@ -73,7 +73,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Pier Fumagalli</a> * @author Copyright © 1999, 2000 <a href="http://www.apache.org">The * Apache Software Foundation. - * @version CVS $Id: WarpHost.java,v 1.4 2000/12/14 01:25:57 pier Exp $ + * @version CVS $Id: WarpHost.java,v 1.5 2000/12/14 03:36:37 pier Exp $ */ public class WarpHost extends StandardHost { @@ -88,6 +88,8 @@ /** The Warp Host ID of this Host. */ private int id=-1; + /** The port of this Host. */ + private int port=-1; /** The ID to use for the next dynamically configured application. */ private int applid=0; @@ -108,6 +110,23 @@ public void invoke(Request req, Response res) throws ServletException, IOException { if (DEBUG) this.debug("Invoked"); + String host=this.getName(); + int port=this.getPort(); + String hp=((WarpRequest)req).getHeader("Host"); + if (hp!=null) { + int ptr=hp.lastIndexOf(':'); + if (ptr==-1) host=hp; + else { + host=hp.substring(0,ptr); + try { + port=Integer.parseInt(hp.substring(ptr+1)); + } catch (NumberFormatException e) { + this.debug(e); + } + } + } + req.setServerName(host); + req.setServerPort(port); super.invoke(req,res); } @@ -169,6 +188,20 @@ */ public boolean isStarted() { return(super.started); + } + + /** + * Set the port number of this host. + */ + public void setPort(int port) { + this.port=port; + } + + /** + * Return the port associated with this host. + */ + public int getPort() { + return(this.port); } // ------------------------------------------------------ DEBUGGING METHODS