remm 2004/02/20 03:03:28 Modified: http11/src/java/org/apache/coyote/http11 Http11Protocol.java LocalStrings.properties Log: - Add some i18n strings. - Encode the address in the protocol name, to fix bug 27033. Revision Changes Path 1.51 +25 -13 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java Index: Http11Protocol.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- Http11Protocol.java 5 Feb 2004 16:22:40 -0000 1.50 +++ Http11Protocol.java 20 Feb 2004 11:03:28 -0000 1.51 @@ -63,6 +63,7 @@ import java.io.OutputStream; import java.net.InetAddress; import java.net.Socket; +import java.net.URLEncoder; import java.util.Enumeration; import java.util.Hashtable; @@ -186,7 +187,7 @@ log.error(sm.getString("http11protocol.endpoint.initerror"), ex); throw ex; } - log.info(sm.getString("http11protocol.init", "" + ep.getPort())); + log.info(sm.getString("http11protocol.init", getName())); } @@ -198,18 +199,18 @@ try { // XXX We should be able to configure it separately // XXX It should be possible to use a single TP - tpOname=new ObjectName(domain + ":" + "type=ThreadPool,name=http" + ep.getPort()); + tpOname=new ObjectName + (domain + ":" + "type=ThreadPool,name=" + getName()); Registry.getRegistry(null, null) .registerComponent(tp, tpOname, null ); - tp.setName("http" + ep.getPort()); + tp.setName(getName()); tp.setDaemon(false); tp.addThreadPoolListener(new MXPoolListener(this, tp)); } catch (Exception e) { log.error("Can't register threadpool" ); } - rgOname=new ObjectName( domain + - ":type=GlobalRequestProcessor,name=http" + - ep.getPort()); + rgOname=new ObjectName + (domain + ":type=GlobalRequestProcessor,name=" + getName()); Registry.getRegistry(null, null).registerComponent ( cHandler.global, rgOname, null ); } @@ -220,7 +221,7 @@ log.error(sm.getString("http11protocol.endpoint.starterror"), ex); throw ex; } - log.info(sm.getString("http11protocol.start", "" + ep.getPort())); + log.info(sm.getString("http11protocol.start", getName())); } public void pause() throws Exception { @@ -230,7 +231,7 @@ log.error(sm.getString("http11protocol.endpoint.pauseerror"), ex); throw ex; } - log.info(sm.getString("http11protocol.pause", "" + ep.getPort())); + log.info(sm.getString("http11protocol.pause", getName())); } public void resume() throws Exception { @@ -240,11 +241,11 @@ log.error(sm.getString("http11protocol.endpoint.resumeerror"), ex); throw ex; } - log.info(sm.getString("http11protocol.resume", "" + ep.getPort())); + log.info(sm.getString("http11protocol.resume", getName())); } public void destroy() throws Exception { - log.info("Stoping http11 protocol on " + ep.getPort() + " " + tpOname); + log.info(sm.getString("http11protocol.stop", getName())); ep.stopEndpoint(); if( tpOname!=null ) Registry.getRegistry(null, null).unregisterComponent(tpOname); @@ -352,6 +353,17 @@ setAttribute("address", "" + ia); } + public String getName() { + String encodedAddr = ""; + if (getAddress() != null) { + encodedAddr = "" + getAddress(); + if (encodedAddr.startsWith("/")) + encodedAddr = encodedAddr.substring(1); + encodedAddr = URLEncoder.encode(encodedAddr) + "-"; + } + return ("http-" + encodedAddr + ep.getPort()); + } + // commenting out for now since it's not doing anything //public void setHostName( String name ) { // ??? Doesn't seem to be used in existing or prev code @@ -691,9 +703,9 @@ try { RequestInfo rp=processor.getRequest().getRequestProcessor(); rp.setGlobalProcessor(global); - ObjectName rpName=new ObjectName(proto.getDomain() + - ":type=RequestProcessor,worker=http" + - proto.ep.getPort() +",name=HttpRequest" + count++ ); + ObjectName rpName=new ObjectName + (proto.getDomain() + ":type=RequestProcessor,worker=" + + proto.getName() +",name=HttpRequest" + count++ ); Registry.getRegistry(null, null).registerComponent( rp, rpName, null); thData[Http11Protocol.THREAD_DATA_OBJECT_NAME]=rpName; } catch( Exception ex ) { 1.7 +6 -3 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/LocalStrings.properties Index: LocalStrings.properties =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/LocalStrings.properties,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- LocalStrings.properties 29 Aug 2003 02:34:47 -0000 1.6 +++ LocalStrings.properties 20 Feb 2004 11:03:28 -0000 1.7 @@ -10,7 +10,7 @@ http11protocol.endpoint.initerror=Error initializing endpoint http11protocol.endpoint.starterror=Error starting endpoint -http11protocol.init=Initializing Coyote HTTP/1.1 on port {0} +http11protocol.init=Initializing Coyote HTTP/1.1 on {0} http11protocol.proto.error=Error reading request, ignored http11protocol.proto.ioexception.debug=IOException reading request http11protocol.proto.ioexception.info=IOException reading request, ignored @@ -19,7 +19,10 @@ http11protocol.getattribute=Attribute {0} http11protocol.setattribute=Attribute {0}: {1} http11protocol.socketfactory.initerror=Error initializing socket factory -http11protocol.start=Starting Coyote HTTP/1.1 on port {0} +http11protocol.start=Starting Coyote HTTP/1.1 on {0} +http11protocol.stop=Stopping Coyote HTTP/1.1 on {0} +http11protocol.pause=Pausing Coyote HTTP/1.1 on {0} +http11protocol.resume=Resuming Coyote HTTP/1.1 on {0} # # Http11Processor
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]