File: zones.html

package info (click to toggle)
jserv 1.1.2-2
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 4,584 kB
  • ctags: 3,019
  • sloc: sh: 7,715; java: 6,635; ansic: 5,013; makefile: 814; perl: 39; xml: 32
file content (154 lines) | stat: -rw-r--r-- 7,476 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>

<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<meta NAME="Author" CONTENT="Stefano Mazzocchi">
<title>Servlet Zones</title>
</head>

<body BGCOLOR="#FFFFFF">

<p align="center"><a href="http://java.apache.org/" target="_top"><img SRC="images/java-apache-project.gif" BORDER="0" WIDTH="609"
HEIGHT="100" ALT="The Java Apache Project"></a></p>

<h1 align="center">Servlet Zones</h1>

<h2 align="left">Introduction</h2>

<blockquote>
  <p align="left">A good understanding of servlet zones and the design ideas behind them are
  a valuable resource for people willing to take advantage of the full power of Apache
  JServ. This page introduces you to this strange new world.</p>
</blockquote>

<h2 align="left">Definitions</h2>

<blockquote>
  <table border="0" cellspacing="0" cellpadding="3">
    <tr>
      <td width="16%" bgcolor="#b0b0b0"><strong>Entity</strong></td>
      <td width="58%" bgcolor="#b0b0b0"><strong>Definition</strong></td>
      <td width="26%" bgcolor="#b0b0b0"><strong>Web server equivalent</strong></td>
    </tr>
    <tr>
      <td width="16%" bgcolor="#f0f0f0"><em>Servlet</em></td>
      <td width="58%" bgcolor="#f0f0f0">a single Java class that implements <code>javax.servlet.Servlet</code></td>
      <td width="26%" bgcolor="#f0f0f0">file</td>
    </tr>
    <tr>
      <td width="16%" bgcolor="#e0e0e0"><p align="left"><em>Servlet repository</em></td>
      <td width="58%" bgcolor="#e0e0e0">a collection of servlets. It may be a directory, or a
      class archive (zip or jar files)</td>
      <td width="26%" bgcolor="#e0e0e0">directory</td>
    </tr>
    <tr>
      <td width="16%" bgcolor="#f0f0f0"><em>Servlet zone</em></td>
      <td width="58%" bgcolor="#f0f0f0">a collection of repositories.</td>
      <td width="26%" bgcolor="#f0f0f0">virtual host</td>
    </tr>
  </table>
</blockquote>

<blockquote>
  <p align="left">A servlet zone is the servlet engine equivalent of a web server virtual
  host in the sense that all servlet repositories contained by the servlet zone share a
  common logical context. This gives you the power of isolating servlets from one another
  both logically (belonging to different hosts or people) and, in the future, securely,
  mapping every servlet zone to a different security sandbox.</p>
</blockquote>

<h2 align="left">Creating a servlet zone</h2>

<blockquote>
  <p align="left">Servlet zones are very easy to create and configure since each zone has a
  separate configuration file.</p>
  <p align="left">The first step is to take the file /conf/zone.properties and add the
  servlet repositories that contain the servlets for that zone. Simple enough, to do this
  you just have to add a property that lists all of your servlet repositories and you're
  done.</p>
  <blockquote>
    <div align="left"><pre># The list of servlet repositories controlled by this servlet zone
# Syntax: repositories=&lt;repository&gt;,&lt;repository&gt;...
repositories=/usr/local/apache/servlets,/usr/local/java/servlets.jar    </pre>
    </div>
  </blockquote>
  <p align="left">Note: <a href="http://bugs.apache.org/index/full/3604">On NT systems</a>, 
  one should not include a trailing slash at the end of the repositories lines that end 
  with a directory. For example: 
  repositories=/usr/local/apache/servlets vs. repositories=/usr/local/apache/servlets/.</p>

  <p align="left">As good practice, rename the file to <code>[zone name].properties</code>
  (but a specific name is not required) and place it in a directory accessible by Apache
  JServ. Note that servlet initialization arguments and specific zone configurations (class
  autoreloading, session timeouts) are all stored in that file. For this reason you may want
  to make this file accessible to the owner of the servlet zone to allow him/her to
  configure their servlet zone transparently.</p>
</blockquote>

<h2 align="left">Including a servlet zone</h2>

<blockquote>
  <p align="left">Once you have created your servlet zones, you must tell Apache JServ about
  them. This is done by adding a few lines to your <code>jserv.properties</code> file.</p>
  <blockquote>
    <div align="left"><pre># List of servlet zones JServ manages
# Syntax: zones=&lt;servlet zone&gt;,&lt;servlet zone&gt;...
zones=bob,alice

# Configuration file for each servlet zone
# Syntax: &lt;zone name&gt;.properties=&lt;full path to configFile&gt;
bob.properties=/home/bob/servlets/servlets.properties
alice.properties=/home/alice/servlets/servlets.properties</pre>
    </div>
  </blockquote>
  <p align="left">At startup, Apache JServ will setup every servlet zone using the specified
  zone configuration files. For this reason, make sure your Apache JServ has the access
  privileges at least to read the zone configuration file and its repositories.</p>
</blockquote>

<h2 align="left">Mounting a servlet zone</h2>

<blockquote>
  <p align="left">Now that Apache JServ and its zones are configured, you need to
  &quot;mount&quot; these servlet zones into your web server file space. This is as easy as
  adding a configuration line to your web server configuration file. Let's suppose you have
  Apache JServ running on <code>jserv.yourDomain.com</code> listening on port 9009 handling
  the zones defined above.</p>
  <p align="left">You want to logically separate the two zones by &quot;mounting&quot; them
  to a particular web server URI like you would do for a disk on a UNIX file system. To do
  this you use the <code>ApJServMount</code> directive</p>
  <blockquote>
    <pre>ApJServMount /bob/servlets ajpv11://jserv.yourDomain.com:9009/bob
ApJServMount /alice/servlets ajpv11://jserv.yourDomain.com:9009/alice</pre>
  </blockquote>
  <p>Now, both Bob and his web clients connect to his servlets with the URL <code>http://www.yourDomain.com/bob/servlets</code>
  and the same is for Alice.</p>
  <p>The possibility to mount both local and remote servlet zones (note that <code>jserv.yourDomain.com</code>
  may reside on another machine as much as different zones may be hosted on different
  machines) is the real power of Apache JServ and its major difference compared to other
  servlet engines. In fact,&nbsp; the web server module acts as an &quot;AJP Browser&quot;
  rather then a glue between a native process and a Java process (like many other servlet
  engines do)</p>
  <p>This allows you to create a full three-tier network environment and gives a web server
  the power to concentrate on its URI space all its network resources if encapsulated with
  Apache JServ and with Java servlets. Specific JNI servlets may even be used to web-enable
  application and resources that were not designed to be network-aware (like fax machines,
  local databases and even toasters and microwaves ;-) </p>
</blockquote>

<h2>Future directions</h2>

<blockquote>
  <p>In future versions of Apache JServ, each servlet zone will have his own security
  manager and sandbox for servlets, like web browsers do with Java applets. This will allow
  complete logical separation between servlets executed by the same JVM and would eliminate
  the need for running multiple virtual machines with different UID/GID. </p>
</blockquote>

<p align="center"><font SIZE="-1">Copyright (c) 1997-99 <a HREF="http://java.apache.org/">The
Java Apache Project</a>.<br>
$Id: zones.html,v 1.8 1999/09/19 22:06:02 jonbolt Exp $<br>
All rights reserved.</font></p>
</body>
</html>