You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2005/04/02 20:11:36 UTC
svn commit: r159783 -
jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl
jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io
Author: olegk
Date: Sat Apr 2 10:11:35 2005
New Revision: 159783
URL: http://svn.apache.org/viewcvs?view=rev&rev=159783
Log:
Added HttpDataReceiverFactory and HttpDataTransmitterFactory interfaces and their default impls
Added:
jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpDataReceiverFactory.java (with props)
jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpDataTransmitterFactory.java (with props)
jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io/HttpDataReceiverFactory.java (with props)
jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io/HttpDataTransmitterFactory.java (with props)
Added: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpDataReceiverFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpDataReceiverFactory.java?view=auto&rev=159783
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpDataReceiverFactory.java (added)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpDataReceiverFactory.java Sat Apr 2 10:11:35 2005
@@ -0,0 +1,71 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.impl;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import javax.net.ssl.SSLSocket;
+
+import org.apache.http.HttpRuntime;
+import org.apache.http.io.HttpDataReceiver;
+import org.apache.http.io.HttpDataReceiverFactory;
+
+/**
+ * <p>
+ * </p>
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ *
+ * @version $Revision$
+ *
+ * @since 4.0
+ */
+public class DefaultHttpDataReceiverFactory implements HttpDataReceiverFactory {
+
+ public HttpDataReceiver create(final Socket socket) throws IOException {
+ if (socket == null) {
+ throw new IllegalArgumentException("Socket may not be null");
+ }
+ if (socket instanceof SSLSocket) {
+ if (HttpRuntime.isSSLNIOCapable()) {
+ return new NIOSocketHttpDataReceiver(socket);
+ } else {
+ return new OldIOSocketHttpDataReceiver(socket);
+ }
+ } else {
+ if (HttpRuntime.isNIOCapable()) {
+ return new NIOSocketHttpDataReceiver(socket);
+ } else {
+ return new OldIOSocketHttpDataReceiver(socket);
+ }
+ }
+ }
+
+}
Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpDataReceiverFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpDataReceiverFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpDataReceiverFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpDataTransmitterFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpDataTransmitterFactory.java?view=auto&rev=159783
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpDataTransmitterFactory.java (added)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpDataTransmitterFactory.java Sat Apr 2 10:11:35 2005
@@ -0,0 +1,71 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.impl;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import javax.net.ssl.SSLSocket;
+
+import org.apache.http.HttpRuntime;
+import org.apache.http.io.HttpDataTransmitter;
+import org.apache.http.io.HttpDataTransmitterFactory;
+
+/**
+ * <p>
+ * </p>
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ *
+ * @version $Revision$
+ *
+ * @since 4.0
+ */
+public class DefaultHttpDataTransmitterFactory implements HttpDataTransmitterFactory {
+
+ public HttpDataTransmitter create(final Socket socket) throws IOException {
+ if (socket == null) {
+ throw new IllegalArgumentException("Socket may not be null");
+ }
+ if (socket instanceof SSLSocket) {
+ if (HttpRuntime.isSSLNIOCapable()) {
+ return new NIOSocketHttpDataTransmitter(socket);
+ } else {
+ return new OldIOSocketHttpDataTransmitter(socket);
+ }
+ } else {
+ if (HttpRuntime.isNIOCapable()) {
+ return new NIOSocketHttpDataTransmitter(socket);
+ } else {
+ return new OldIOSocketHttpDataTransmitter(socket);
+ }
+ }
+ }
+
+}
Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpDataTransmitterFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpDataTransmitterFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/DefaultHttpDataTransmitterFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io/HttpDataReceiverFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io/HttpDataReceiverFactory.java?view=auto&rev=159783
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io/HttpDataReceiverFactory.java (added)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io/HttpDataReceiverFactory.java Sat Apr 2 10:11:35 2005
@@ -0,0 +1,48 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.io;
+
+import java.io.IOException;
+import java.net.Socket;
+
+/**
+ * <p>
+ * </p>
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ *
+ * @version $Revision$
+ *
+ * @since 4.0
+ */
+public interface HttpDataReceiverFactory {
+
+ HttpDataReceiver create(Socket socket) throws IOException;
+
+}
Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io/HttpDataReceiverFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io/HttpDataReceiverFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io/HttpDataReceiverFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io/HttpDataTransmitterFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io/HttpDataTransmitterFactory.java?view=auto&rev=159783
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io/HttpDataTransmitterFactory.java (added)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io/HttpDataTransmitterFactory.java Sat Apr 2 10:11:35 2005
@@ -0,0 +1,48 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.io;
+
+import java.io.IOException;
+import java.net.Socket;
+
+/**
+ * <p>
+ * </p>
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ *
+ * @version $Revision$
+ *
+ * @since 4.0
+ */
+public interface HttpDataTransmitterFactory {
+
+ HttpDataTransmitter create(Socket socket) throws IOException;
+
+}
Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io/HttpDataTransmitterFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io/HttpDataTransmitterFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/io/HttpDataTransmitterFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain