⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 burlap-draft-spec.xtp

📁 RESIN 3.2 最新源码
💻 XTP
📖 第 1 页 / 共 2 页
字号:
<document>  <header>    <product>resin-ee</product>    <resin-2.0>$ee/ejb-ref/burlap-draft-spec.xtp</resin-2.0>    <title>Burlap Draft Spec</title>    <date>March 15, 2002</date>  </header>  <body>    <summary/><s1 title="Design Goals"><p>The Burlap protocol was created to solve a specific problem:</p><blockquote>AllowJava Enterprise Java Beans (EJB) services to interoperate with non-Javaservers and clients using an XML-based protocol.</blockquote><p>The <a href="http://www.caucho.com/burlap">Burlap home page</a>contains the latest information about Burlap.</p><p>The name "Burlap" was chosed for a simple reason: it's boring.The wire protocol for web services should be invisibleto application writers.  Wire protocols should not requireexternal schema or IDL.</p><p>Given the EJB environment, the Burlap protocol has thefollowing requirements:</p><ul><li>It must use the simplest possible subset of XML.</li><li>It must not require external IDL or schema definitions; it should beinvisible to application writers.</li><li>It must have sufficient power to serialize Java.</li><li>It must have sufficient power to support EJB.</li><li>It must allow non-Java clients to use web services.</li><li>It must allow web services to deployed as a Servlet.</li><li>It must be simple so it can be effectively tested.</li><li>It must be as fast as possible.</li><li>It should support transaction contexts.</li></ul><p>The <a href="burlap-notes.xtp">design notes</a> explain someof the design decision in creating the Burlap protocol.</p><p>The leading XML-based RPC protocols do not meet theserequirements.  UserLand's <a href="http://www.xmlrpc.com">XML-RPC</a>is insufficiently powerful tosupport Java serialization or EJB.  Microsoft's<a href="http://www.w3.org/TR/SOAP">SOAP</a> is overlycomplicated and underdefined.  In particular, it requires XMLnamespaces, attributes, overly complicated typing, and external schema.</p></s1><s1 title="SML"><p>Burlap uses SML (Simple Markup Language), a restricted subset of XML:</p><ul><li>Only elements and character data are allowed.</li><li>No namespaces, no attributes, no processing instructions, nocomments, no DTDs, no CDATA sections.</li><li>No mixed content: an element may contain eitherelements or character data, but not both.</li><li>Only UTF-8 encoding is allowed.</li><li>Only numbered character entities, e.g. &amp;#60;, and the standardXML entities (&amp;lt;, &amp;gt;, and &amp;amp;) are allowed asescapes.</li><li>All whitespace in character data is significant.</li></ul><p>The smallness of SML allows less room for bugs, simplifiestesting, and makes reasonably-fast implementations feasible.It forces conformance by eliminating ambiguities.</p><p>The SML grammar needs only six productions:</p><def><var>tag-list</var> ::= (<var>S</var> <var>tag</var>)* <var>S</var><var>tag</var>      ::= &lt;<var>name</var>&gt; <var>tag-list</var> &lt;/<var>name</var>&gt;         ::= &lt;<var>name</var>&gt; <var>cdata</var> &lt;/<var>name</var>&gt;<var>S</var>        ::= (' ' | '\t' | '\r' | '\n')*<var>cdata</var>    ::= ([^&lt;&amp;] | &amp;# [0-9]+ ; | &amp;lt; | &amp;gt; | &amp;amp;)*<var>name</var>     ::= [a-zA-Z:_] [a-zA-Z0-9.-_:]*</def><note>SML explicitly forbids XML short tags, e.g. &lt;tag/&gt;,and the XML header, e.g. &lt;?xml version='1.0'?&gt;</note></s1><s1 title="Serialization"><p>Burlap's object serialization has 9 primitive types:</p><ol><li><var>boolean</var></li><li>32-bit <var>int</var></li><li>64-bit <var>long</var></li><li>64-bit <var>double</var></li><li>ISO-8609 <var>date</var></li><li>16-bit UTF8-encoded <var>string</var></li><li>16-bit UTF8-encoded <var>xml</var></li><li><var>base64</var> binary data</li><li><var>remote</var> objects</li></ol><p>It has 2 combining constructs:</p><ol><li><var>list</var> for lists and arrays</li><li><var>map</var> for objects and hash tables.</li></ol><p>Finally, it has 2 special contructs:</p><ol><li><var>null</var> for null values</li><li><var>ref</var> for shared and circular object references.</li></ol><s2 title="null" type="defun"><p>Null represents a null pointer.The XML short form is forbidden, i.e. &lt;null&gt; must haveseparate open and close tags.</p><p>&lt;null&gt; values are allowed in place of any &lt;string&gt;, &lt;xml&gt;,&lt;base64&gt;, &lt;list&gt;, &lt;map&gt;, or &lt;remote&gt;.</p><results> &lt;null&gt;&lt;/null&gt;</results></s2><s2 title="boolean" type="defun"><p>A boolean value expressed as an integer, 0 or 1.</p><results> &lt;boolean&gt;0&lt;/boolean&gt;</results></s2><s2 title="int" type="defun"><p>A 32-bit signed integer.</p><results>&lt;int&gt;-32132&lt;/int&gt;</results></s2><s2 title="long" type="defun"><p>A 64-bit signed integer.</p><results>&lt;long&gt;1000000000&lt;/long&gt;</results></s2><s2 title="double" type="defun"><p>A 64-bit IEEE floating pointer number.</p><results>&lt;double&gt;1234.9431e12&lt;/double&gt;</results></s2><s2 title="string" type="defun"><p>A 16-bit unicode character string encoded in UTF-8.  TheUTF-8 encoding follows from the SML rules.  Similarly, the onlyescapes allowed are &amp;#xx;, &amp;lt;, &amp;gt;, and &amp;amp;.All whitespace is significant.</p><results>&lt;string&gt;Escape the less than symbol as &amp;lt; orusing the numeric escape &amp;#38;&lt;/string&gt;</results></s2><s2 title="xml" type="defun"><p>An XML document encoded as a 16-bit unicode characterstring encoded in UTF-8, following the rules for &lt;string&gt;.Special characters, like `&lt;' must be escaped.  The only escapes allowedare &amp;#xx;, &amp;lt;, &amp;gt;, and &amp;amp;. All whitespace issignificant.</p><results>&lt;xml&gt;&amp;lt;top&amp;gt;  &amp;lt;body test='foo'/&amp;gt;&amp;lt;/top&amp;gt;&lt;/xml&gt;</results><note>Because this document does not define the language mapping,implementations are free to return a string when reading an &lt;xml&gt;entity.</note></s2><s2 title="date" type="defun"><p>An ISO8609-encoded date.</p><results>&lt;date&gt;19880508T095231Z&lt;/date&gt;</results></s2><s2 title="base64" type="defun"><p>A base64-encoded binary stream.  The base64 string may havewhitespace after any triplet, but not within a triplet.</p><results> &lt;base64&gt;zxc9Z9m2z8==&lt;/base64&gt;</results></s2><s2 title="list" type="defun"><p>An ordered list, like an array.  The &lt;type&gt;element describes the type of the list and the &lt;length&gt; elementspecifies the number of values in the list.  Both &lt;type&gt; and&lt;length&gt; tags are required, but both may be empty.  If the &lt;length&gt;is empty, the receiver will determine the list length from theactual number of elements before the &lt;/list&gt;.</p><def>list = (type, length, (%object;)*)</def><p>Each &lt;list&gt; item is added to the reference list.  See the&lt;ref&gt; element.</p><p>A &lt;list&gt; might also be represented by a &lt;null&gt; or &lt;ref&gt;.Parsers must be prepared to recognize any of those three.</p><results title="serialization of a Java int[]">&lt;list&gt;  &lt;type&gt;[int&lt;/type&gt;  &lt;length&gt;3&lt;/length&gt;  &lt;int&gt;0&lt;/int&gt;  &lt;int&gt;1&lt;/int&gt;  &lt;int&gt;2&lt;/int&gt;&lt;/list&gt;</results><results title="serialization of a Java ArrayList">&lt;list&gt;  &lt;type&gt;&lt;/type&gt;  &lt;length&gt;3&lt;/length&gt;  &lt;int&gt;0&lt;/int&gt;  &lt;double&gt;1.3&lt;/double&gt;  &lt;string&gt;foobar&lt;/string&gt;&lt;/list&gt;</results><note>The valid values of &lt;type&gt; are not specified in thisdocument and may depend on the specific application.  For example, aJava EJB server which exposes an Burlap interface can use the &lt;type&gt;information to instantiate the specific array type.On the other hand, a Perl server would likely ignore the contents of &lt;type&gt;entirely and create a generic array.</note></s2><s2 title="map" type="defun"><p>Represents serialized objects and Hashtables.  The &lt;type&gt;element describes the type of the map.  Objects are represented by amap from field names to their values and &lt;type&gt; is the classof the object itself.</p><def>map ::= (type, ((%object;), (%object;))*)</def><p>The &lt;type&gt; element is mandatory, although its value may beempty.  For objects, unrecognized keys must be ignored.</p><p>Each &lt;map&gt; is added to the reference list.  A &lt;map&gt; mightalso be represented as &lt;null&gt; or &lt;ref&gt;.</p><example title="Serialization of a Java Object">public class Car implements Serializable {  String model = "Beetle";  String color = "aquamarine";  int mileage = 230431;}</example><results>&lt;map&gt;  &lt;type&gt;com.caucho.test.Car&lt;/type&gt;  &lt;string&gt;model&lt;string&gt;  &lt;string&gt;Beetle&lt;/string&gt;  &lt;string&gt;color&lt;string&gt;  &lt;string&gt;aquamarine&lt;/string&gt;  &lt;string&gt;mileage&lt;string&gt;  &lt;int&gt;230431&lt;/int&gt;&lt;/map&gt;</results><example title="A sparse array">map = new HashMap();map.put(new Integer(1), "fee");map.put(new Integer(75), "fie");map.put(new Integer(932), "foe");</example><results>&lt;map&gt;  &lt;type&gt;java.util.HashMap&lt;/type&gt;  &lt;int&gt;1&lt;int&gt;&lt;string&gt;fee&lt;/string&gt;  &lt;int&gt;75&lt;int&gt;&lt;string&gt;fie&lt;/string&gt;  &lt;int&gt;932&lt;int&gt;&lt;string&gt;foe&lt;/string&gt;&lt;/map&gt;</results><note>The &lt;type&gt; will depend on the specific protocol. EJB-basedprotocols will use Java classes.</note></s2><s2 title="ref" type="defun"><p>An integer referring to a previous &lt;list&gt; or &lt;map&gt;instance.  As each &lt;list&gt; or &lt;map&gt; is read from theinput stream, it is assigned an integer.  A later &lt;ref&gt; can then usethe previous object.</p><def>ref ::= #CDATA</def><p>&lt;ref&gt; can refer to incompletely-read items.  For example, acircular linked-list will refer to the first link before the entire listhas been read.</p><p>A possible implementation would add each &lt;map&gt; and &lt;list&gt; to anarray as its read.  The &lt;ref&gt; will return the corresponding object from thearray.  To support circular structures, the implementation would storethe &lt;map&gt; or &lt;list&gt; immediately, before filling in the object'scontents.</p><p>Each &lt;list&gt; or &lt;array&gt; is stored into an array as it isparsed.  &lt;ref&gt; selects one of the stored objects.  The firstobject is numbered '0'.</p><example title="circular list">list = new LinkedList();listhead = 1;list.tail = list;</example><results>&lt;map&gt;  &lt;type&gt;LinkedList&lt;/type&gt;  &lt;string&gt;head&lt;/string&gt;&lt;int&gt;1&lt;/int&gt;  &lt;string&gt;tail&lt;/string&gt;&lt;ref&gt;0&lt;/ref&gt;&lt;/map&gt;</results><note>&lt;ref&gt; only to &lt;list&gt; and &lt;map&gt; elements.  &lt;string&gt;and &lt;base64&gt;, in particular, can't share references.</note></s2><s2 title="remote" type="defun"><p>A reference to a remote object.  The &lt;type&gt; elementspecifies the object type and the &lt;string&gt; element specifies the remoteobject's URL.</p><def>remote ::= (type, string)</def><p>Remote support is optional.  Clients and servers don't needto support &lt;remote&gt; if the service doesn't need it.</p><results title="EJB Session Reference">&lt;remote&gt;  &lt;type&gt;test.TestObj&lt;/type&gt;  &lt;string&gt;http://localhost/ejbhome;ejbid=69Xm8-zW&lt;/string&gt;&lt;/remote&gt;</results><note>Needed to support EJB in a reasonably portable way.</note></s2></s1><s1 title="burlap:call"><p>A Burlap call invokes a method on an object with an argumentlist.  The object is uniquely named by its URL.  The arguments arespecified by Burlap serialization.</p><def>burlap:call ::= (%header;), method, (%object;)*</def><results title="obj.add2(2,3)">&lt;burlap:call&gt;  &lt;method&gt;add2&lt;/method&gt;  &lt;int&gt;2&lt;/int&gt;  &lt;int&gt;3&lt;/int&gt;&lt;/burlap:call&gt;&lt;burlap:reply&gt;  &lt;value&gt;    &lt;int&gt;5&lt;/int&gt;  &lt;/value&gt;&lt;/burlap:reply&gt;</results>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -