This file is indexed.

/usr/share/mozart/doc/apptut/node12.html is in mozart-doc 1.4.0-8ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

1
2
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>9 Introduction</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node11.html">- Up -</A></TD><TD><A href="node13.html#chapter.client.server.db">Next &gt;&gt;</A></TD></TR></TABLE><DIV id="chapter.client.server.intro"><H1><A name="chapter.client.server.intro">9 Introduction</A></H1><P>A large fraction of client/server applications fall in the same simple pattern: there is a basic service encapsulated as an object and we wish to allow remote clients to send requests to this object, to be processed at the server host.</P><P>The basic idea is to make available to clients a procedure that forwards a client's request to the live server object. This forwarding is effected by means of a port. The forwarding procedure itself is made available indirectly through a ticket. This ticket is placed in a file that is accessible through a URL.</P><H2><A name="label35">9.1 A Generic Server <CODE>server.oz</CODE></A></H2><P>It is straightforward to write a generic server module that exports a <CODE><I>Start</I></CODE> procedure. The latter takes 2 arguments: <CODE><I>Proc</I></CODE> the object or procedure implementing the service and <CODE><I>File</I></CODE> the name of the file where the ticket should be saved. <CODE><I>Proc</I></CODE> is intended to be applied to messages forwarded by clients.</P><P>The forwarding procedure <CODE><I>Proxy</I></CODE> takes the clients message <CODE><I>Msg</I></CODE> and sends <CODE>request(</CODE><CODE><I>Msg</I></CODE><CODE>&nbsp;</CODE><CODE><I>OK</I></CODE><CODE>)</CODE> to the server's port. The server binds <CODE><I>OK</I></CODE> to true or false depending on whether the <CODE><I>Msg</I></CODE> is processed successfully or an exception is raised. </P><BLOCKQUOTE><PRE><SPAN class="keyword">functor</SPAN>&nbsp;<BR><SPAN class="keyword">import</SPAN>&nbsp;Connection&nbsp;Pickle<BR><SPAN class="keyword">export</SPAN>&nbsp;Start<BR><SPAN class="keyword">define</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">Start</SPAN>&nbsp;Proc&nbsp;File}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Requests&nbsp;P&nbsp;=&nbsp;{NewPort&nbsp;Requests}&nbsp;Ticket<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">Proxy</SPAN>&nbsp;Msg}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">if</SPAN>&nbsp;{Port<SPAN class="keyword">.</SPAN>send&nbsp;P&nbsp;request(Msg&nbsp;$)}&nbsp;<SPAN class="keyword">then</SPAN>&nbsp;<SPAN class="keyword">skip</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">else</SPAN>&nbsp;<SPAN class="keyword">raise</SPAN>&nbsp;remoteError&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">in</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{New&nbsp;Connection<SPAN class="keyword">.</SPAN>gate&nbsp;init(Proxy&nbsp;Ticket)&nbsp;_}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Pickle<SPAN class="keyword">.</SPAN>save&nbsp;Ticket&nbsp;File}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ForAll&nbsp;Requests<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;R}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">case</SPAN>&nbsp;R&nbsp;<SPAN class="keyword">of</SPAN>&nbsp;request(Msg&nbsp;OK)&nbsp;<SPAN class="keyword">then</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">try</SPAN>&nbsp;{Proc&nbsp;Msg}&nbsp;OK=<SPAN class="keyword">true</SPAN>&nbsp;<SPAN class="keyword">catch</SPAN>&nbsp;_&nbsp;<SPAN class="keyword">then</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">try</SPAN>&nbsp;OK=<SPAN class="keyword">false</SPAN>&nbsp;<SPAN class="keyword">catch</SPAN>&nbsp;_&nbsp;<SPAN class="keyword">then</SPAN>&nbsp;<SPAN class="keyword">skip</SPAN>&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">else</SPAN>&nbsp;<SPAN class="keyword">skip</SPAN>&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>}<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR><SPAN class="keyword">end</SPAN>&nbsp;<BR></PRE></BLOCKQUOTE><P> The server functor will be used as an import in subsequent examples and can be compiled as follows: </P><BLOCKQUOTE class="code"><CODE>ozc&nbsp;-c&nbsp;server.oz</CODE></BLOCKQUOTE><P></P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node11.html">- Up -</A></TD><TD><A href="node13.html#chapter.client.server.db">Next &gt;&gt;</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~duchier/">Denys&nbsp;Duchier</A>, <A href="http://www.ps.uni-sb.de/~kornstae/">Leif&nbsp;Kornstaedt</A> and&nbsp;<A href="http://www.ps.uni-sb.de/~schulte/">Christian&nbsp;Schulte</A><BR><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>