avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r906610 - in /hadoop/avro/trunk: ./ doc/src/content/xdocs/ lang/java/src/java/org/apache/avro/ipc/
Date Thu, 04 Feb 2010 18:58:30 GMT
Author: cutting
Date: Thu Feb  4 18:58:29 2010
New Revision: 906610

URL: http://svn.apache.org/viewvc?rev=906610&view=rev
Log:
AVRO-340, AVRO-342: Define usage of HTTP as RPC transport in spec, and document that Java's
socket and datagram transports are non-standard.

Modified:
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/doc/src/content/xdocs/spec.xml
    hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/DatagramServer.java
    hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/DatagramTransceiver.java
    hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/HttpTransceiver.java
    hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/SocketServer.java
    hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/SocketTransceiver.java

Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=906610&r1=906609&r2=906610&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Thu Feb  4 18:58:29 2010
@@ -292,7 +292,13 @@
 
     AVRO-395. Add a cscope Makefile target (Eli Collins via massie)
 
-    AVRO-397. Whitespace change and comment clarification in datafile.py (hammer)
+    AVRO-397. Whitespace change and comment clarification in
+    datafile.py (hammer)
+
+    AVRO-340. Define usage of HTTP as RPC transport in spec.  (cutting)
+
+    AVRO-342. Document that Java's socket and datagram RPC transports
+    are non-standard.  (cutting)
 
   OPTIMIZATIONS
 

Modified: hadoop/avro/trunk/doc/src/content/xdocs/spec.xml
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/doc/src/content/xdocs/spec.xml?rev=906610&r1=906609&r2=906610&view=diff
==============================================================================
--- hadoop/avro/trunk/doc/src/content/xdocs/spec.xml (original)
+++ hadoop/avro/trunk/doc/src/content/xdocs/spec.xml Thu Feb  4 18:58:29 2010
@@ -750,11 +750,7 @@
       <section>
 	<title>Message Transport</title>
 	<p>Messages may be transmitted via
-	different <em>transport</em> mechanisms.  For example, one
-	might use the HTTP, raw sockets, or SSL, etc.  This document
-	specifies formats for request and response message data, but
-	it does not yet specify any details of how message data is
-	encapsulated in different transports.</p>
+	different <em>transport</em> mechanisms.</p>
 
 	<p>To the transport, a <em>message</em> is an opaque byte sequence.</p>
 
@@ -772,6 +768,23 @@
 	    messages with unique identifiers.</p>
 	  </li>
 	</ul>
+
+	<section>
+	  <title>HTTP as Transport</title>
+	  <p>When
+	    <a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">HTTP</a>
+	    is used as a transport, each Avro message exchange is an
+	    HTTP request/response pair.  All messages of an Avro
+	    protocol should share a single URL at an HTTP server.
+	    Other protocols may also use that URL.  Both normal and
+	    error Avro response messages should use the 200 (OK)
+	    response code.  The chunked encoding may be used for
+	    requests and responses, but, regardless the Avro request
+	    and response are the entire content of an HTTP request and
+	    response.  The HTTP Content-Type of requests and responses
+	    should be specified as "avro/binary".  Requests should be
+	    made using the POST method.</p>
+	</section>
       </section>
 
       <section>

Modified: hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/DatagramServer.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/DatagramServer.java?rev=906610&r1=906609&r2=906610&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/DatagramServer.java (original)
+++ hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/DatagramServer.java Thu Feb 
4 18:58:29 2010
@@ -27,7 +27,8 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/** A simple datagram-based server implementation. */
+/** A datagram-based server implementation. This uses a simple, non-standard
+ * wire protocol and is not intended for production services. */
 public class DatagramServer extends Thread implements Server {
   private static final Logger LOG =
     LoggerFactory.getLogger(DatagramServer.class);

Modified: hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/DatagramTransceiver.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/DatagramTransceiver.java?rev=906610&r1=906609&r2=906610&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/DatagramTransceiver.java (original)
+++ hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/DatagramTransceiver.java Thu
Feb  4 18:58:29 2010
@@ -28,7 +28,8 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/** A datagram-based {@link Transceiver} implementation. */
+/** A datagram-based {@link Transceiver} implementation. This uses a simple,
+ * non-standard wire protocol and is not intended for production services. */
 public class DatagramTransceiver extends Transceiver {
   private static final Logger LOG
     = LoggerFactory.getLogger(DatagramTransceiver.class);

Modified: hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/HttpTransceiver.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/HttpTransceiver.java?rev=906610&r1=906609&r2=906610&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/HttpTransceiver.java (original)
+++ hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/HttpTransceiver.java Thu Feb
 4 18:58:29 2010
@@ -26,14 +26,14 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.net.URL;
-import java.net.URLConnection;
+import java.net.HttpURLConnection;
 
 /** An HTTP-based {@link Transceiver} implementation. */
 public class HttpTransceiver extends Transceiver {
   static final String CONTENT_TYPE = "avro/binary"; 
 
   private URL url;
-  private URLConnection connection;
+  private HttpURLConnection connection;
   
   public HttpTransceiver(URL url) { this.url = url; }
 
@@ -42,7 +42,8 @@
   @Override
   public synchronized List<ByteBuffer> transceive(List<ByteBuffer> request)
     throws IOException {
-    this.connection = url.openConnection();
+    this.connection = (HttpURLConnection)url.openConnection();
+    connection.setRequestMethod("POST");
     connection.setRequestProperty("Content-Type", CONTENT_TYPE);
     connection.setRequestProperty("Content-Length",
                                   Integer.toString(getLength(request)));

Modified: hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/SocketServer.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/SocketServer.java?rev=906610&r1=906609&r2=906610&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/SocketServer.java (original)
+++ hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/SocketServer.java Thu Feb  4
18:58:29 2010
@@ -28,7 +28,8 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/** A simple socket-based server implementation. */
+/** A socket-based server implementation. This uses a simple, non-standard wire
+ * protocol and is not intended for production services. */
 public class SocketServer extends Thread implements Server {
   private static final Logger LOG = LoggerFactory.getLogger(SocketServer.class);
 

Modified: hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/SocketTransceiver.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/SocketTransceiver.java?rev=906610&r1=906609&r2=906610&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/SocketTransceiver.java (original)
+++ hadoop/avro/trunk/lang/java/src/java/org/apache/avro/ipc/SocketTransceiver.java Thu Feb
 4 18:58:29 2010
@@ -28,7 +28,8 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/** A simple socket-based {@link Transceiver} implementation. */
+/** A socket-based {@link Transceiver} implementation.  This uses a simple,
+ * non-standard wire protocol and is not intended for production services. */
 public class SocketTransceiver extends Transceiver {
   private static final Logger LOG
     = LoggerFactory.getLogger(SocketTransceiver.class);



Mime
View raw message