From: markt Date: Wed, 8 Dec 2010 14:19:23 +0000 (+0000) Subject: Re-factoring in support of https://issues.apache.org/bugzilla/show_bug.cgi?id=50360 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=d1f28eb46befec2bd77422422bdd2b1902ee3c11;p=tomcat7.0 Re-factoring in support of https://issues.apache.org/bugzilla/show_bug.cgi?id=50360 Pull up init() git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1043429 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/coyote/AbstractProtocolHandler.java b/java/org/apache/coyote/AbstractProtocolHandler.java index e730e564d..9ed9b015b 100644 --- a/java/org/apache/coyote/AbstractProtocolHandler.java +++ b/java/org/apache/coyote/AbstractProtocolHandler.java @@ -337,13 +337,32 @@ public abstract class AbstractProtocolHandler implements ProtocolHandler, // ------------------------------------------------------- Lifecycle methods - // TODO Keep current state and check for invalid transitions + /* + * NOTE: There is no maintenance of state or checking for valid transitions + * within this class. It is expected that the connector will maintain state + * and prevent invalid state transitions. + */ @Override - public abstract void init() throws Exception; + public void init() throws Exception { + if (getLog().isInfoEnabled()) + getLog().info(sm.getString("abstractProtocolHandler.init", + getName())); + + endpoint.setName(getName()); + + try { + endpoint.init(); + } catch (Exception ex) { + getLog().error(sm.getString("abstractProtocolHandler.initError", + getName()), ex); + throw ex; + } + } + @Override - public final void pause() throws Exception { + public void pause() throws Exception { if(getLog().isInfoEnabled()) getLog().info(sm.getString("abstractProtocolHandler.pause", getName())); @@ -357,7 +376,7 @@ public abstract class AbstractProtocolHandler implements ProtocolHandler, } @Override - public final void resume() throws Exception { + public void resume() throws Exception { if(getLog().isInfoEnabled()) getLog().info(sm.getString("abstractProtocolHandler.resume", getName())); @@ -372,7 +391,7 @@ public abstract class AbstractProtocolHandler implements ProtocolHandler, @Override - public final void stop() throws Exception { + public void stop() throws Exception { try { endpoint.stop(); } catch (Exception ex) { @@ -387,7 +406,7 @@ public abstract class AbstractProtocolHandler implements ProtocolHandler, @Override - public final void destroy() { + public void destroy() { if(getLog().isInfoEnabled()) { getLog().info(sm.getString("abstractProtocolHandler.destroy", getName())); diff --git a/java/org/apache/coyote/LocalStrings.properties b/java/org/apache/coyote/LocalStrings.properties index 3e376cfa9..8fc5c81ae 100644 --- a/java/org/apache/coyote/LocalStrings.properties +++ b/java/org/apache/coyote/LocalStrings.properties @@ -15,6 +15,8 @@ abstractProtocolHandler.getAttribute=Get attribute [{0}] with value [{1}] abstractProtocolHandler.setAttribute=Set attribute [{0}] with value [{1}] +abstractProtocolHandler.pause=Initializing ProtocolHandler [{0}] +abstractProtocolHandler.pauseError=Failed to initialize end point associated with ProtocolHandler [{0}] abstractProtocolHandler.pause=Pausing ProtocolHandler [{0}] abstractProtocolHandler.pauseError=Failed to pause end point associated with ProtocolHandler [{0}] abstractProtocolHandler.resume=Resuming ProtocolHandler [{0}] diff --git a/java/org/apache/coyote/ajp/AjpAprProtocol.java b/java/org/apache/coyote/ajp/AjpAprProtocol.java index 1ff933bc8..d3dca6e3d 100644 --- a/java/org/apache/coyote/ajp/AjpAprProtocol.java +++ b/java/org/apache/coyote/ajp/AjpAprProtocol.java @@ -86,24 +86,6 @@ public class AjpAprProtocol extends AbstractAjpProtocol { // --------------------------------------------------------- Public Methods - /** Start the protocol - */ - @Override - public void init() throws Exception { - endpoint.setName(getName()); - - try { - endpoint.init(); - } catch (Exception ex) { - log.error(sm.getString("ajpprotocol.endpoint.initerror"), ex); - throw ex; - } - if (log.isInfoEnabled()) { - log.info(sm.getString("ajpprotocol.init", getName())); - } - } - - @Override public void start() throws Exception { if (this.domain != null ) { diff --git a/java/org/apache/coyote/ajp/AjpProtocol.java b/java/org/apache/coyote/ajp/AjpProtocol.java index 3c1332600..04d21c5ed 100644 --- a/java/org/apache/coyote/ajp/AjpProtocol.java +++ b/java/org/apache/coyote/ajp/AjpProtocol.java @@ -86,24 +86,6 @@ public class AjpProtocol extends AbstractAjpProtocol { // --------------------------------------------------------- Public Methods - /** Start the protocol - */ - @Override - public void init() throws Exception { - endpoint.setName(getName()); - - try { - endpoint.init(); - } catch (Exception ex) { - log.error(sm.getString("ajpprotocol.endpoint.initerror"), ex); - throw ex; - } - if (log.isInfoEnabled()) { - log.info(sm.getString("ajpprotocol.init", getName())); - } - } - - @Override public void start() throws Exception { if (this.domain != null ) { diff --git a/java/org/apache/coyote/ajp/LocalStrings.properties b/java/org/apache/coyote/ajp/LocalStrings.properties index f7559cb51..b19bc7159 100644 --- a/java/org/apache/coyote/ajp/LocalStrings.properties +++ b/java/org/apache/coyote/ajp/LocalStrings.properties @@ -23,9 +23,7 @@ # AjpAprProtocol # -ajpprotocol.endpoint.initerror=Error initializing endpoint ajpprotocol.endpoint.starterror=Error starting endpoint -ajpprotocol.endpoint.stoperror=Error stopping endpoint ajpprotocol.init=Initializing Coyote AJP/1.3 on {0} ajpprotocol.proto.error=Error reading request, ignored ajpprotocol.start=Starting Coyote AJP/1.3 on {0} diff --git a/java/org/apache/coyote/ajp/LocalStrings_es.properties b/java/org/apache/coyote/ajp/LocalStrings_es.properties index 9695d669a..a32037a2c 100644 --- a/java/org/apache/coyote/ajp/LocalStrings_es.properties +++ b/java/org/apache/coyote/ajp/LocalStrings_es.properties @@ -13,9 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -ajpprotocol.endpoint.initerror = Error inicializando punto final ajpprotocol.endpoint.starterror = Error arrancando punto final -ajpprotocol.init = Inicializando Coyote AJP/1.3 en {0} ajpprotocol.proto.error = Error leyendo requerimiento, ignorado ajpprotocol.start = Arrancando Coyote AJP/1.3 en {0} ajpprotocol.failedread = Fallo en lectura de Conector diff --git a/java/org/apache/coyote/http11/AbstractHttp11JsseProtocol.java b/java/org/apache/coyote/http11/AbstractHttp11JsseProtocol.java index 42a3a1273..8786fb434 100644 --- a/java/org/apache/coyote/http11/AbstractHttp11JsseProtocol.java +++ b/java/org/apache/coyote/http11/AbstractHttp11JsseProtocol.java @@ -17,6 +17,7 @@ package org.apache.coyote.http11; import org.apache.tomcat.util.net.SSLImplementation; +import org.apache.tomcat.util.net.jsse.JSSEImplementation; public abstract class AbstractHttp11JsseProtocol extends AbstractHttp11Protocol { @@ -102,4 +103,13 @@ public abstract class AbstractHttp11JsseProtocol public String getAllowUnsafeLegacyRenegotiation() { return endpoint.getAllowUnsafeLegacyRenegotiation(); } + + + // ------------------------------------------------------- Lifecycle methods + + @Override + public void init() throws Exception { + super.init(); + sslImplementation = new JSSEImplementation(); + } } diff --git a/java/org/apache/coyote/http11/Http11AprProtocol.java b/java/org/apache/coyote/http11/Http11AprProtocol.java index 8a5b1d4af..7f5072eea 100644 --- a/java/org/apache/coyote/http11/Http11AprProtocol.java +++ b/java/org/apache/coyote/http11/Http11AprProtocol.java @@ -79,23 +79,6 @@ public class Http11AprProtocol extends AbstractHttp11Protocol { setProcessorCache(-1); } - /** Start the protocol - */ - @Override - public void init() throws Exception { - endpoint.setName(getName()); - - try { - endpoint.init(); - } catch (Exception ex) { - log.error(sm.getString("http11protocol.endpoint.initerror"), ex); - throw ex; - } - if(log.isInfoEnabled()) - log.info(sm.getString("http11protocol.init", getName())); - - } - @Override public void start() throws Exception { if( this.domain != null ) { diff --git a/java/org/apache/coyote/http11/Http11NioProtocol.java b/java/org/apache/coyote/http11/Http11NioProtocol.java index 06ce6e15c..7ff52e624 100644 --- a/java/org/apache/coyote/http11/Http11NioProtocol.java +++ b/java/org/apache/coyote/http11/Http11NioProtocol.java @@ -39,7 +39,6 @@ import org.apache.tomcat.util.net.NioEndpoint; import org.apache.tomcat.util.net.NioEndpoint.Handler; import org.apache.tomcat.util.net.SecureNioChannel; import org.apache.tomcat.util.net.SocketStatus; -import org.apache.tomcat.util.net.jsse.JSSEImplementation; /** @@ -82,24 +81,6 @@ public class Http11NioProtocol extends AbstractHttp11JsseProtocol { } - /** Start the protocol - */ - @Override - public void init() throws Exception { - endpoint.setName(getName()); - - try { - endpoint.init(); - sslImplementation = new JSSEImplementation(); - } catch (Exception ex) { - log.error(sm.getString("http11protocol.endpoint.initerror"), ex); - throw ex; - } - if(log.isInfoEnabled()) - log.info(sm.getString("http11protocol.init", getName())); - - } - @Override public void start() throws Exception { if( this.domain != null ) { diff --git a/java/org/apache/coyote/http11/Http11Protocol.java b/java/org/apache/coyote/http11/Http11Protocol.java index ef99f06c2..f9024556c 100644 --- a/java/org/apache/coyote/http11/Http11Protocol.java +++ b/java/org/apache/coyote/http11/Http11Protocol.java @@ -37,7 +37,6 @@ import org.apache.tomcat.util.net.JIoEndpoint; import org.apache.tomcat.util.net.JIoEndpoint.Handler; import org.apache.tomcat.util.net.SocketStatus; import org.apache.tomcat.util.net.SocketWrapper; -import org.apache.tomcat.util.net.jsse.JSSEImplementation; /** @@ -86,22 +85,6 @@ public class Http11Protocol extends AbstractHttp11JsseProtocol { // ----------------------------------------- ProtocolHandler Implementation @Override - public void init() throws Exception { - endpoint.setName(getName()); - - try { - endpoint.init(); - sslImplementation = new JSSEImplementation(); - } catch (Exception ex) { - log.error(sm.getString("http11protocol.endpoint.initerror"), ex); - throw ex; - } - if (log.isInfoEnabled()) - log.info(sm.getString("http11protocol.init", getName())); - - } - - @Override public void start() throws Exception { if (this.domain != null) { try { diff --git a/java/org/apache/coyote/http11/LocalStrings.properties b/java/org/apache/coyote/http11/LocalStrings.properties index 17b330fe9..c0c27fc36 100644 --- a/java/org/apache/coyote/http11/LocalStrings.properties +++ b/java/org/apache/coyote/http11/LocalStrings.properties @@ -13,17 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -http11protocol.destroy=Destroying Coyote HTTP/1.1 on {0} -http11protocol.endpoint.initerror=Error initializing endpoint http11protocol.endpoint.starterror=Error starting endpoint -http11protocol.endpoint.stoperror=Error stopping endpoint -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 http11protocol.proto.socketexception.debug=SocketException reading request http11protocol.proto.socketexception.info=SocketException reading request, ignored -http11protocol.socketfactory.initerror=Error initializing socket factory http11protocol.start=Starting Coyote HTTP/1.1 on {0} http11processor.regexp.error=Error parsing regular expression {0} diff --git a/java/org/apache/coyote/http11/LocalStrings_es.properties b/java/org/apache/coyote/http11/LocalStrings_es.properties index 4e3218ca9..3c9d80530 100644 --- a/java/org/apache/coyote/http11/LocalStrings_es.properties +++ b/java/org/apache/coyote/http11/LocalStrings_es.properties @@ -13,15 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -http11protocol.endpoint.initerror = Error inicializando punto final (endpoint) http11protocol.endpoint.starterror = Error arrancando punto final (endpoint) -http11protocol.init = Inicializando Coyote HTTP/1.1 en puerto {0} http11protocol.proto.error = Error leyendo requerimiento, ignorado http11protocol.proto.ioexception.debug = IOException leyendo requerimiento http11protocol.proto.ioexception.info = IOException leyendo requerimiento, ignorada http11protocol.proto.socketexception.debug = SocketException leyendo requerimiento http11protocol.proto.socketexception.info = SocketException leyendo requerimiento, ignorada -http11protocol.socketfactory.initerror = Error inicializando f\u00E1brica de enchufes (sockets) http11protocol.start = Arrancando Coyote HTTP/1.1 en puerto {0} http11processor.regexp.error = Error al analizar expresi\u00F3n regular {0} diff --git a/java/org/apache/coyote/http11/LocalStrings_fr.properties b/java/org/apache/coyote/http11/LocalStrings_fr.properties index a451d43c9..cb4e2b3cc 100644 --- a/java/org/apache/coyote/http11/LocalStrings_fr.properties +++ b/java/org/apache/coyote/http11/LocalStrings_fr.properties @@ -13,15 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -http11protocol.endpoint.initerror=Erreur \u00e0 l'initialisation du point de contact http11protocol.endpoint.starterror=Erreur au d\u00e9marrage du point de contact -http11protocol.init=Initialisation de Coyote HTTP/1.1 sur {0} http11protocol.proto.error=Erreur \u00e0 la lecture de la requ\u00eate, ignor\u00e9 http11protocol.proto.ioexception.debug=Exception d'entr\u00e9e/sortie (IOException) \u00e0 la lecture de la requ\u00eate http11protocol.proto.ioexception.info=Exception d'entr\u00e9e/sortie \u00e0 la lecture de la requ\u00eate, ignor\u00e9 http11protocol.proto.socketexception.debug=Exception "Socket" (SocketException) \u00e0 la lecture de la requ\u00eate http11protocol.proto.socketexception.info=Exception "Socket" (SocketException) \u00e0 la lecture de la requ\u00eate, ignor\u00e9 -http11protocol.socketfactory.initerror=Erreur \u00e0 l'initialisation du cr\u00e9ateur de socket (socket factory) http11protocol.start=D\u00e9marrage de Coyote HTTP/1.1 sur {0} iib.eof.error=Fin de flux (EOF) inattendue \u00e0 la lecture sur la socket diff --git a/java/org/apache/coyote/http11/LocalStrings_ja.properties b/java/org/apache/coyote/http11/LocalStrings_ja.properties index cc71e2e59..d79a78cce 100644 --- a/java/org/apache/coyote/http11/LocalStrings_ja.properties +++ b/java/org/apache/coyote/http11/LocalStrings_ja.properties @@ -13,15 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -http11protocol.endpoint.initerror=\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u521d\u671f\u5316\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059 http11protocol.endpoint.starterror=\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u8d77\u52d5\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059 -http11protocol.init=Coyote HTTP/1.1\u3092 {0} \u3067\u521d\u671f\u5316\u3057\u307e\u3059 http11protocol.proto.error=\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059\u304c\u3001\u7121\u8996\u3055\u308c\u307e\u3057\u305f http11protocol.proto.ioexception.debug=\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306eIOException\u3067\u3059 http11protocol.proto.ioexception.info=\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306eIOException\u3067\u3059\u304c\u3001\u7121\u8996\u3055\u308c\u307e\u3057\u305f http11protocol.proto.socketexception.debug=\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306eSocketException\u3067\u3059 http11protocol.proto.socketexception.info=\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306eSocketException\u3067\u3059\u304c\u3001\u7121\u8996\u3055\u308c\u307e\u3057\u305f -http11protocol.socketfactory.initerror=\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30af\u30c8\u30ea\u3092\u521d\u671f\u5316\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059 http11protocol.start=Coyote HTTP/1.1\u3092 {0} \u3067\u8d77\u52d5\u3057\u307e\u3059 iib.eof.error=\u30bd\u30b1\u30c3\u30c8\u304b\u3089\u4e88\u671f\u3057\u306a\u3044EOF\u3092\u8aad\u307f\u8fbc\u307f\u307e\u3057\u305f