You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2005/11/19 18:44:14 UTC
svn commit: r345659 - in /tomcat/sandbox/java/org/apache/tomcat/util/net:
AprEndpoint.java SSLImplementation.java TcpConnection.java
Author: costin
Date: Sat Nov 19 09:44:11 2005
New Revision: 345659
URL: http://svn.apache.org/viewcvs?rev=345659&view=rev
Log:
- remove the hardcoded dependency between SSLImplementation and jsse.
- add support for the native socket, in addition to Socket. A better solution may be to
add a AprSocket class - this will allow Apr to be used in more places.
- AprEndpoint extends PoolTcpConnection, use TcpConnectionHandler instead if Handler. This
will allow coyote.http11.Apr* to extend the http classes and remove most of the duplicated code.
Modified:
tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java
tomcat/sandbox/java/org/apache/tomcat/util/net/SSLImplementation.java
tomcat/sandbox/java/org/apache/tomcat/util/net/TcpConnection.java
Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=345659&r1=345658&r2=345659&view=diff
==============================================================================
--- tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java Sat Nov 19 09:44:11 2005
@@ -53,7 +53,7 @@
* @author Mladen Turk
* @author Remy Maucherat
*/
-public class AprEndpoint {
+public class AprEndpoint extends PoolTcpEndpoint {
// -------------------------------------------------------------- Constants
@@ -65,6 +65,7 @@
StringManager.getManager("org.apache.tomcat.util.net.res");
+ // where is this used ?
/**
* The Request attribute key for the cipher suite.
*/
@@ -239,6 +240,10 @@
public void setHandler(Handler handler ) { this.handler = handler; }
public Handler getHandler() { return handler; }
+ protected TcpConnectionHandler chandler = null;
+ public void setHandler(TcpConnectionHandler chandler ) { this.chandler = chandler; }
+ public TcpConnectionHandler getTcpConnectionHandler() { return chandler; }
+
/**
* Allows the server developer to specify the backlog that
@@ -1192,6 +1197,7 @@
public void run() {
// Process requests until we receive a shutdown signal
+ TcpConnection tcpCon=new TcpConnection();
while (running) {
// Wait for the next socket to be assigned
@@ -1200,12 +1206,20 @@
continue;
// Process the request from this socket
- if (!handler.process(socket)) {
+ if (handler != null && !handler.process(socket)) {
// Close socket and pool
Socket.destroy(socket);
socket = 0;
+ } else {
+ if (chandler != null ) {
+ tcpCon.setNativeSocket(socket);
+ chandler.processConnection(tcpCon, null);
+ // TODO: Close socket and pool - what would be the
+ // return false case ?
+ //Socket.destroy(socket);
+ //socket = 0;
+ }
}
-
// Finish up this request
recycleWorkerThread(this);
Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/SSLImplementation.java
URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/SSLImplementation.java?rev=345659&r1=345658&r2=345659&view=diff
==============================================================================
--- tomcat/sandbox/java/org/apache/tomcat/util/net/SSLImplementation.java (original)
+++ tomcat/sandbox/java/org/apache/tomcat/util/net/SSLImplementation.java Sat Nov 19 09:44:11 2005
@@ -65,10 +65,12 @@
try {
// Workaround for the J2SE 1.4.x classloading problem (under Solaris).
// Class.forName(..) fails without creating class using new.
- // This is an ugly workaround.
- if( JSSEImplementationClass.equals(className) ) {
- return new org.apache.tomcat.util.net.jsse.JSSEImplementation();
- }
+ // This is an ugly workaround.
+ // This also breaks compiling tomcat without SSL support, and is
+ // just wrong. Better fix - fix Class.forName.
+ //if( JSSEImplementationClass.equals(className) ) {
+ // return new org.apache.tomcat.util.net.jsse.JSSEImplementation();
+ //}
Class clazz=Class.forName(className);
return (SSLImplementation)clazz.newInstance();
} catch (Exception e){
Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/TcpConnection.java
URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/TcpConnection.java?rev=345659&r1=345658&r2=345659&view=diff
==============================================================================
--- tomcat/sandbox/java/org/apache/tomcat/util/net/TcpConnection.java (original)
+++ tomcat/sandbox/java/org/apache/tomcat/util/net/TcpConnection.java Sat Nov 19 09:44:11 2005
@@ -36,6 +36,16 @@
PoolTcpEndpoint endpoint;
Socket socket;
+ private long nativeSocket;
+ // SocketChannel for NIO
+
+ public long getNativeSocket() {
+ return nativeSocket;
+ }
+
+ public void setNativeSocket(long s) {
+ this.nativeSocket = s;
+ }
public static void setMaxShutdownTries(int mst) {
MAX_SHUTDOWN_TRIES = mst;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org