<s1 title="Servlet Library">

<s2 title="Admin Servlet">

<p>Resin 2.0.5 provides a primitive status servlet /resin-status.  It's
disabled by default to avoid any security issues.  The servlet must
be enabled explicitly, like:</p>

<example>
&lt;web-app id='/admin'>
  &lt;allow-admin>true&lt;/allow-admin>
  &lt;servlet-mapping url-pattern='/resin-status'
                   servlet-name='com.caucho.http.servlet.ResinStatusServlet'>
    &lt;init-param enable='read'/>
  &lt;/servlet-mapping>

  &lt;!-- only allow the localhost to use the admin --> 
  &lt;security-constraint>
    &lt;ip-constraint>127.0.0.1/32&lt;/ip-constraint>

    &lt;web-resource-collection>
      &lt;url-pattern>/*&lt;/url-pattern>
    &lt;/web-resource-collection>
  &lt;/security-constraint>
&lt;/web-app>
</example>

<p>The allow-admin also puts a com.caucho.http.admin.ApplicationAdmin
object in the servlet context as caucho.admin.</p>
</s2>

<s2 title='LoadBalanceServlet'>

<p>Configures a front-end Resin instance to load-balance requests to
backend Resin instances.  Each LoadBalanceServlet instance will
distribute the requests to a configured srun-group.</p>

<p>The backend Resin instances will need to have separate
resin.conf files so they will handle the request instead of
forwarding the requests back to themselves.</p>

<p>If the request already has a session, the backend server maching that
session will be used, i.e. LoadBalanceServlet supports sticky-sessions.
Otherwise, the least busy backend server will be used as counted by
number of active requests.  If several backend servers are
equally busy, the selection uses a round-robin to distribute the load.
</p>

<example>
&lt;caucho.com>
&lt;http-server>

  &lt;http id='front' port='8080'/>

  &lt;srun id='a' srun-group='backend'
        host='192.168.0.1' port='6802'/>
  &lt;srun id='b' srun-group='backend'
        host='192.168.0.2' port='6802'/>

  &lt;web-app>
    &lt;servlet servlet-name='com.caucho.http.servlet.LoadBalanceServlet'>
      &lt;init-param srun-group='backend'/>

    &lt;servlet-mapping url-pattern='*.jsp'
                    servlet-name='backend'/>

    &lt;servlet-mapping url-pattern='/remote/*'
                    servlet-name='backend'/>
  &lt;/web-app>

&lt;/http-server>
&lt;/caucho.com>
</example>

</s2>

<s2 title="CGIServlet">

<p>Implements CGI calls.</p>

<example>
&lt;web-app>
  &lt;servlet-mapping url-pattern='*.cgi'
                  servlet-name='com.caucho.http.servlet.CGIServlet'/>
&lt;/web-app>
</example>

</s2>
<s2 title='FastCGIServlet'>

<p>Implements the FastCGI protocol.  FastCGI allows some CGI clients
like PHP to run quicker and more efficiently.</p>

<example>
&lt;web-app>
  &lt;servlet-mapping url-pattern='*.php'
                  servlet-name='com.caucho.http.servlet.FastCGIServlet'>
      &lt;init-param server-address='localhost:6666'/>
  &lt;/servlet-mapping>
&lt;/web-app>
</example>

<p>Assuming PHP has been compiled with -fastcgi enabled, you might
start PHP like:</p>

<example>
unix> /opt/resin/bin/fastcgirunner.pl -port 6666 php
</example>

</s2>
</s1>
