You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/12/08 15:19:24 UTC

svn commit: r1043429 - in /tomcat/trunk/java/org/apache/coyote: ./ ajp/ http11/

Author: markt
Date: Wed Dec  8 14:19:23 2010
New Revision: 1043429

URL: http://svn.apache.org/viewvc?rev=1043429&view=rev
Log:
Re-factoring in support of https://issues.apache.org/bugzilla/show_bug.cgi?id=50360
Pull up init()

Modified:
    tomcat/trunk/java/org/apache/coyote/AbstractProtocolHandler.java
    tomcat/trunk/java/org/apache/coyote/LocalStrings.properties
    tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
    tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java
    tomcat/trunk/java/org/apache/coyote/ajp/LocalStrings.properties
    tomcat/trunk/java/org/apache/coyote/ajp/LocalStrings_es.properties
    tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11JsseProtocol.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java
    tomcat/trunk/java/org/apache/coyote/http11/LocalStrings.properties
    tomcat/trunk/java/org/apache/coyote/http11/LocalStrings_es.properties
    tomcat/trunk/java/org/apache/coyote/http11/LocalStrings_fr.properties
    tomcat/trunk/java/org/apache/coyote/http11/LocalStrings_ja.properties

Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocolHandler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocolHandler.java?rev=1043429&r1=1043428&r2=1043429&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/AbstractProtocolHandler.java (original)
+++ tomcat/trunk/java/org/apache/coyote/AbstractProtocolHandler.java Wed Dec  8 14:19:23 2010
@@ -337,13 +337,32 @@ public abstract class AbstractProtocolHa
 
     // ------------------------------------------------------- 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 AbstractProtocolHa
     }
 
     @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 AbstractProtocolHa
 
 
     @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 AbstractProtocolHa
 
 
     @Override
-    public final void destroy() {
+    public void destroy() {
         if(getLog().isInfoEnabled()) {
             getLog().info(sm.getString("abstractProtocolHandler.destroy",
                     getName()));

Modified: tomcat/trunk/java/org/apache/coyote/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/LocalStrings.properties?rev=1043429&r1=1043428&r2=1043429&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/coyote/LocalStrings.properties Wed Dec  8 14:19:23 2010
@@ -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}]

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java?rev=1043429&r1=1043428&r2=1043429&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java Wed Dec  8 14:19:23 2010
@@ -86,24 +86,6 @@ public class AjpAprProtocol extends Abst
     // --------------------------------------------------------- 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 ) {

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java?rev=1043429&r1=1043428&r2=1043429&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java Wed Dec  8 14:19:23 2010
@@ -86,24 +86,6 @@ public class AjpProtocol extends Abstrac
     // --------------------------------------------------------- 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 ) {

Modified: tomcat/trunk/java/org/apache/coyote/ajp/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/LocalStrings.properties?rev=1043429&r1=1043428&r2=1043429&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/LocalStrings.properties Wed Dec  8 14:19:23 2010
@@ -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}

Modified: tomcat/trunk/java/org/apache/coyote/ajp/LocalStrings_es.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/LocalStrings_es.properties?rev=1043429&r1=1043428&r2=1043429&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/LocalStrings_es.properties (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/LocalStrings_es.properties Wed Dec  8 14:19:23 2010
@@ -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

Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11JsseProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11JsseProtocol.java?rev=1043429&r1=1043428&r2=1043429&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11JsseProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11JsseProtocol.java Wed Dec  8 14:19:23 2010
@@ -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 AbstractHttp11Jsse
     public String getAllowUnsafeLegacyRenegotiation() {
         return endpoint.getAllowUnsafeLegacyRenegotiation();
     }
+
+
+    // ------------------------------------------------------- Lifecycle methods
+
+    @Override
+    public void init() throws Exception {
+        super.init();
+        sslImplementation = new JSSEImplementation();
+    }
 }

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java?rev=1043429&r1=1043428&r2=1043429&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java Wed Dec  8 14:19:23 2010
@@ -79,23 +79,6 @@ public class Http11AprProtocol extends A
         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 ) {

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=1043429&r1=1043428&r2=1043429&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Wed Dec  8 14:19:23 2010
@@ -39,7 +39,6 @@ import org.apache.tomcat.util.net.NioEnd
 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 A
     }
 
 
-    /** 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 ) {

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java?rev=1043429&r1=1043428&r2=1043429&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java Wed Dec  8 14:19:23 2010
@@ -37,7 +37,6 @@ import org.apache.tomcat.util.net.JIoEnd
 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 Abst
     // ----------------------------------------- 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 {

Modified: tomcat/trunk/java/org/apache/coyote/http11/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/LocalStrings.properties?rev=1043429&r1=1043428&r2=1043429&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/LocalStrings.properties Wed Dec  8 14:19:23 2010
@@ -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}

Modified: tomcat/trunk/java/org/apache/coyote/http11/LocalStrings_es.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/LocalStrings_es.properties?rev=1043429&r1=1043428&r2=1043429&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/LocalStrings_es.properties (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/LocalStrings_es.properties Wed Dec  8 14:19:23 2010
@@ -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}

Modified: tomcat/trunk/java/org/apache/coyote/http11/LocalStrings_fr.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/LocalStrings_fr.properties?rev=1043429&r1=1043428&r2=1043429&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/LocalStrings_fr.properties (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/LocalStrings_fr.properties Wed Dec  8 14:19:23 2010
@@ -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

Modified: tomcat/trunk/java/org/apache/coyote/http11/LocalStrings_ja.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/LocalStrings_ja.properties?rev=1043429&r1=1043428&r2=1043429&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/LocalStrings_ja.properties (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/LocalStrings_ja.properties Wed Dec  8 14:19:23 2010
@@ -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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org