Diff for /books/www/chapters/ch12.html between versions 1.1 and 1.2

version 1.1, 2002/09/17 21:10:35 version 1.2, 2002/09/23 15:23:31
Line 164 Line 164
   
 <P>In <A HREF="#77034">Example 12-5</A>, the MIME type must be specified as part of the first line in the CGI script after the <I>shebang line</I>, and rest of the script is the XUL code used by Mozilla. Although this example does not display real dynamic content (such as the kind you get from CGI forms or other user-supplied data), it shows how you can interpolate dynamic data into a simple CGI application model.  <P>In <A HREF="#77034">Example 12-5</A>, the MIME type must be specified as part of the first line in the CGI script after the <I>shebang line</I>, and rest of the script is the XUL code used by Mozilla. Although this example does not display real dynamic content (such as the kind you get from CGI forms or other user-supplied data), it shows how you can interpolate dynamic data into a simple CGI application model.
 <H4><A NAME="77076"></A> Python</H4>  <H4><A NAME="77076"></A> Python</H4>
<P>Like <!--INDEX Python:remote applications -->  <!--INDEX remote applications:dynamic content:Python -->  <!--INDEX scripting:remote applications:Python -->  Perl, Python provides modules that make it easy to create CGI applications that generate content dynamically. Python is already an important language in the Mozilla environment because of the <I>PyXPCOM</I> bindings discussed in <A HREF="ch08.htm#77048">Chapter 8</A>.<P>Like <!--INDEX Python:remote applications -->  <!--INDEX remote applications:dynamic content:Python -->  <!--INDEX scripting:remote 
 applications:Python -->  Perl, Python provides modules that make it easy to create CGI applications that generate content dynamically. Python is already an important language in the Mozilla environment because of the <I>PyXPCOM</I> bindings discussed in <A HREF="ch08.html#77048">Chapter 8</A>.
 <P>If Python is a language that you like to code in, using it in a remote XUL environment would also make sense. Python combines the features of a lower-level language like object-oriented class and function design with the flexibility and simplicity of a scripting language. The latter feature (ease of use) is relative to a language like C++. <A HREF="#77036">Example 12-6</A> shows how to use Python to create a simple form consisting of three checkboxes.  <P>If Python is a language that you like to code in, using it in a remote XUL environment would also make sense. Python combines the features of a lower-level language like object-oriented class and function design with the flexibility and simplicity of a scripting language. The latter feature (ease of use) is relative to a language like C++. <A HREF="#77036">Example 12-6</A> shows how to use Python to create a simple form consisting of three checkboxes.
   
 <P><I>Example 12-6: <A NAME="77036"></A></I>  <P><I>Example 12-6: <A NAME="77036"></A></I>
Line 262 Line 263
  &lt;/window&gt;</PRE>   &lt;/window&gt;</PRE>
   
 <P>The PHP header method is placed at the top of the file to properly format the output as XUL. The PHP MySQL APIs prepare the code for connection to a MySQL database. Finally, a loop is used to print out the stored data's <TT>treerows</TT> and <TT>treecells</TT>.  <P>The PHP header method is placed at the top of the file to properly format the output as XUL. The PHP MySQL APIs prepare the code for connection to a MySQL database. Finally, a loop is used to print out the stored data's <TT>treerows</TT> and <TT>treecells</TT>.
<P>This kind of operation provides insight into the possibilities of using remote XUL when you have information stored in a database. Many web applications already do this via HTML forms and other mechanisms, but Mozilla's XPFE toolkit provides a richer widget set than HTML to display and retrieve information (see the section <A HREF="ch03.htm#77114">"Form Controls" in Chapter 3</A>).<P>This kind of operation provides insight into the possibilities of using remote XUL when you have information stored in a database. Many web 
 applications already do this via HTML forms and other mechanisms, but Mozilla's XPFE toolkit provides a richer widget set than HTML to display and retrieve information (see the section <A HREF="ch03.html#77114">"Form Controls" in Chapter 3</A>).
 <P>Some XUL widgets are created specifically to display complex tabular data such as <TT>&lt;tree&gt;</TT>, and some widgets provide user selection such as <TT>&lt;checkbox&gt;</TT>, <TT>&lt;radio&gt;</TT>, and <TT>&lt;textbox&gt;</TT>, plus the CSS used for controlling presentation. All of these widgets can be generated on the fly from the database and used to accept user-inputted information.  <P>Some XUL widgets are created specifically to display complex tabular data such as <TT>&lt;tree&gt;</TT>, and some widgets provide user selection such as <TT>&lt;checkbox&gt;</TT>, <TT>&lt;radio&gt;</TT>, and <TT>&lt;textbox&gt;</TT>, plus the CSS used for controlling presentation. All of these widgets can be generated on the fly from the database and used to accept user-inputted information.
 <H3><A NAME="77078"></A> Localizing Remote Applications</H3>  <H3><A NAME="77078"></A> Localizing Remote Applications</H3>
 <P>Unfortunately,  <!--INDEX remote applications:localizing -->  <!--INDEX localizing remote applications --> localizing remote applications is a not as straightforward since there is no http: protocol equivalent for chrome:-included locales. You could use <I>HTTP/1.1</I> content negotiation to serve the users-preferred language, but Mozilla 1.0 does not read DTD files over the wire. To overcome this problem, use server-side page processing. For example, this code includes the DTD by using PHP:  <P>Unfortunately,  <!--INDEX remote applications:localizing -->  <!--INDEX localizing remote applications --> localizing remote applications is a not as straightforward since there is no http: protocol equivalent for chrome:-included locales. You could use <I>HTTP/1.1</I> content negotiation to serve the users-preferred language, but Mozilla 1.0 does not read DTD files over the wire. To overcome this problem, use server-side page processing. For example, this code includes the DTD by using PHP:
Line 510  Example 12-11<A NAME="77046"></A> Line 512  Example 12-11<A NAME="77046"></A>
 <H2><A NAME="77088"></A> Creating Signed Remote Applications</H2>  <H2><A NAME="77088"></A> Creating Signed Remote Applications</H2>
 <P>Security in Mozilla's  <!--INDEX remote applications:signed -->  <!--INDEX security:remote applications:signed --> web browser is designed to meet today's advanced scripting needs in a secure manner. Mozilla is a much more secure browser than past Netscape 4.x and Internet Explorer releases because it has a better sense of what remote scripts can and cannot do.  <P>Security in Mozilla's  <!--INDEX remote applications:signed -->  <!--INDEX security:remote applications:signed --> web browser is designed to meet today's advanced scripting needs in a secure manner. Mozilla is a much more secure browser than past Netscape 4.x and Internet Explorer releases because it has a better sense of what remote scripts can and cannot do.
 <P>Because of Mozilla's approach toward potentially insecure applications, if you decide to serve up your own application remotely, remember that you will not have automatic access to the chrome in the way you do when you have a registered, locally installed Mozilla application. Unless you sign your application or have the user turn on a special preference (see <A HREF="#77070">"Setting Up XPFE for Remote Applications</A>"), services like XPConnect will not be available.  <P>Because of Mozilla's approach toward potentially insecure applications, if you decide to serve up your own application remotely, remember that you will not have automatic access to the chrome in the way you do when you have a registered, locally installed Mozilla application. Unless you sign your application or have the user turn on a special preference (see <A HREF="#77070">"Setting Up XPFE for Remote Applications</A>"), services like XPConnect will not be available.
<P>In Mozilla, you can bundle any number of files into a JAR archive (which, you'll recall from <A HREF="ch06.htm#77063">Chapter 6</A>, is just a zip file with a JAR suffix) and designate the archive as an object that can be signed. This designation makes it very easy to produce an entire signed and secure remote Mozilla application because it stores your application in a single file type that Mozilla already treats as a separate package.<P>In Mozilla, you can bundle any number of files into a JAR archive (which, you'll recall from <A HREF="ch06.html#77063">Chapter 6</A>, is just a 
 zip file with a JAR suffix) and designate the archive as an object that can be signed. This designation makes it very easy to produce an entire signed and secure remote Mozilla application because it stores your application in a single file type that Mozilla already treats as a separate package.
 <P>This section provides an overview of the signed script technology and shows you how to create signed applications that live on the server but take full advantage of the user's local chrome, including Mozilla components.  <P>This section provides an overview of the signed script technology and shows you how to create signed applications that live on the server but take full advantage of the user's local chrome, including Mozilla components.
 <H3><A NAME="77089"></A> certs.mozdev.org CA Certificate</H3>  <H3><A NAME="77089"></A> certs.mozdev.org CA Certificate</H3>
 <P>Before users <!--INDEX installation:certificates -->  <!--INDEX certificates:installing -->  <!--INDEX remote applications:certificates:installing -->  <!--INDEX security:remote applications:installing certificates -->  can load signed applications, a CA certificate must be installed into their installed copy of Mozilla. Once this certificate is installed in a browser, all MozDev-signed applications can work with this certificate. This setup makes things easier on users who access many of these signed applications because they do not have to install a new certificate for each one. Also, if the user wants to use applications from other certificate authorities, they need to install a distribution certificate from that certificate authority.  <P>Before users <!--INDEX installation:certificates -->  <!--INDEX certificates:installing -->  <!--INDEX remote applications:certificates:installing -->  <!--INDEX security:remote applications:installing certificates -->  can load signed applications, a CA certificate must be installed into their installed copy of Mozilla. Once this certificate is installed in a browser, all MozDev-signed applications can work with this certificate. This setup makes things easier on users who access many of these signed applications because they do not have to install a new certificate for each one. Also, if the user wants to use applications from other certificate authorities, they need to install a distribution certificate from that certificate authority.
Line 950  Figure 12-10<A NAME="77020"></A> Line 953  Figure 12-10<A NAME="77020"></A>
   
 <H2><A NAME="77106"></A> Looking Forward</H2>  <H2><A NAME="77106"></A> Looking Forward</H2>
 <P>This chapter focuses on just one of many new trends outside of the original project mandate that emerged in the Mozilla developer community. Now that Mozilla 1.0 is released, its future direction will be shaped by the community itself, and Mozilla will become whatever the community would like it to be.  <P>This chapter focuses on just one of many new trends outside of the original project mandate that emerged in the Mozilla developer community. Now that Mozilla 1.0 is released, its future direction will be shaped by the community itself, and Mozilla will become whatever the community would like it to be.
<P>Remote applications are definitely one area of Mozilla development that will get more attention as Mozilla matures. Other areas that will probably also be noticed include development tools (some existing development tools are discussed in <A HREF="appb.htm#78077">Appendix B</A>), embedding, SVG support, and XSLT support.<P>Remote applications are definitely one area of Mozilla development that will get more attention as Mozilla matures. Other areas that will 
 probably also be noticed include development tools (some existing development tools are discussed in <A HREF="appb.html#78077">Appendix B</A>), embedding, SVG support, and XSLT support.
 <P>Remember that Mozilla is open to new ideas and is always looking for contributions. If you can think of a way to improve Mozilla, or if you think of something that should be added, become a part of the community and help expand the possibilities of Mozilla and all Mozilla applications.  <P>Remember that Mozilla is open to new ideas and is always looking for contributions. If you can think of a way to improve Mozilla, or if you think of something that should be added, become a part of the community and help expand the possibilities of Mozilla and all Mozilla applications.
 <HR>  <HR>
 <HR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>  <HR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>

Removed from v.1.1  
changed lines
  Added in v.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>