comparison doc/manual.tex @ 1198:b52929351402

Forward reference to URI convention
author Adam Chlipala <adamc@hcoop.net>
date Sat, 17 Apr 2010 13:57:10 -0400
parents 601a77af0477
children 41484478a32d
comparison
equal deleted inserted replaced
1197:6d8e3dcb9713 1198:b52929351402
164 164
165 To compile project \texttt{P.urp}, simply run 165 To compile project \texttt{P.urp}, simply run
166 \begin{verbatim} 166 \begin{verbatim}
167 urweb P 167 urweb P
168 \end{verbatim} 168 \end{verbatim}
169 The output executable is a standalone web server. Run it with the command-line argument \texttt{-h} to see which options it takes. If the project file lists a database, the web server will attempt to connect to that database on startup. 169 The output executable is a standalone web server. Run it with the command-line argument \texttt{-h} to see which options it takes. If the project file lists a database, the web server will attempt to connect to that database on startup. See Section \ref{structure} for an explanation of the URI mapping convention, which determines how each page of your application may be accessed via URLs.
170 170
171 To time how long the different compiler phases run, without generating an executable, run 171 To time how long the different compiler phases run, without generating an executable, run
172 \begin{verbatim} 172 \begin{verbatim}
173 urweb -timing P 173 urweb -timing P
174 \end{verbatim} 174 \end{verbatim}
2030 \textrm{Attribute value} & v &::=& \ell & \textrm{literal value} \\ 2030 \textrm{Attribute value} & v &::=& \ell & \textrm{literal value} \\
2031 &&& \{e\} & \textrm{computed value} \\ 2031 &&& \{e\} & \textrm{computed value} \\
2032 \end{array}$$ 2032 \end{array}$$
2033 2033
2034 2034
2035 \section{The Structure of Web Applications} 2035 \section{\label{structure}The Structure of Web Applications}
2036 2036
2037 A web application is built from a series of modules, with one module, the last one appearing in the \texttt{.urp} file, designated as the main module. The signature of the main module determines the URL entry points to the application. Such an entry point should have type $\mt{t1} \to \ldots \to \mt{tn} \to \mt{transaction} \; \mt{page}$, for any integer $n \geq 0$, where $\mt{page}$ is a type synonym for top-level HTML pages, defined in $\mt{Basis}$. If such a function is at the top level of main module $M$, with $n = 0$, it will be accessible at URI \texttt{/M/f}, and so on for more deeply-nested functions, as described in Section \ref{tag} below. Arguments to an entry-point function are deserialized from the part of the URI following \texttt{f}. 2037 A web application is built from a series of modules, with one module, the last one appearing in the \texttt{.urp} file, designated as the main module. The signature of the main module determines the URL entry points to the application. Such an entry point should have type $\mt{t1} \to \ldots \to \mt{tn} \to \mt{transaction} \; \mt{page}$, for any integer $n \geq 0$, where $\mt{page}$ is a type synonym for top-level HTML pages, defined in $\mt{Basis}$. If such a function is at the top level of main module $M$, with $n = 0$, it will be accessible at URI \texttt{/M/f}, and so on for more deeply-nested functions, as described in Section \ref{tag} below. Arguments to an entry-point function are deserialized from the part of the URI following \texttt{f}.
2038 2038
2039 When the standalone web server receives a request for a known page, it calls the function for that page, ``running'' the resulting transaction to produce the page to return to the client. Pages link to other pages with the \texttt{link} attribute of the \texttt{a} HTML tag. A link has type $\mt{transaction} \; \mt{page}$, and the semantics of a link are that this transaction should be run to compute the result page, when the link is followed. Link targets are assigned URL names in the same way as top-level entry points. 2039 When the standalone web server receives a request for a known page, it calls the function for that page, ``running'' the resulting transaction to produce the page to return to the client. Pages link to other pages with the \texttt{link} attribute of the \texttt{a} HTML tag. A link has type $\mt{transaction} \; \mt{page}$, and the semantics of a link are that this transaction should be run to compute the result page, when the link is followed. Link targets are assigned URL names in the same way as top-level entry points.
2040 2040