<s1 title="Caucho Servlet Engine on O'Reilly WebSite Pro">

<summarylist/>

<p>Resin provides a fast servlet runner for 
<a href="http://website.oreilly.com/" target="aux">O'Reilly WebSite Pro</a>, 
allowing it to run servlets and JSP files.</p>

<figure src='website_srun.gif'/>

<p>To configure Resin with O'Reilly WebSite Pro, you must follow the following steps:</p>
<ol>
<li>Configure WebSite Pro via its property sheet
<li>Configure resin.conf with a text editor
<li>Start httpd. You may want to run httpd as an NT service.
</ol>

<s2 title='Configuring Resin and WebSite Pro'>

<p><b>You should use resin1.x/bin/setup.exe to setup your configuration</b>.
If you use setup.exe, you can just skip to the next section.</p>

<s3 title='WebSite Pro'>

<p>If you don't use the supplied setup.exe program, here are the steps needed to
setup WebSite Pro to run Resin:</p>

<ol>
<li>Make sure Resin works via it's httpd.exe!
<li>Stop WebSite Pro.
<li>Copy isapi_srun.dll to the WebSite root directory, <var/C:\WebSite/>.
<li>Using the WebSite property sheet, Mapping tab, Associations list, associate .jsp, 
.xml and .xtp with the above extension <var/C:\WebSite\isapi_srun.dl/>.
<li>Using the WebSite property sheet, Mapping tab, Content types list, set the content 
type for .jsp, .xml, and .xtp to <var/wwwserver/isapi/>.
<li>Add isapi_srun.dll to WebSite's API pre-load list. Use the registry editor and add 
the full pathname of isapi_srun.dll, typically <var/C:\WebSite\isapi_srun.dll/>, to the 
LoadLibrary string. This is located under 
HKEY_LOCAL_MACHINE\Software\Denny\WebServer\CurrentVersion. The variable name is 
LoadLibrary, and  it is a semicolon-delimited string. Simply add 
<var/;C:\WebSite\isapi_srun.dll/> to the end of the LoadLibrary string.
</ol>

</s3>

<s3 title='Resin Virtual Server'>

<p>In order to browse the supplied documents and samples, we <em>strongly</em> recommend
creating a virtual server and mapping its root to the Resin <var/doc/> directory. When creating
this virtual server with WebSite's New Identity Wizard, you can uncheck both CGI options in the 
New Identity Wizard. Then after it's finished, change the / mapping from <var/htdocs/> to 
<var/doc/>. To set the virtual server up:</p>

<ol>

<li>On WebSite's property sheet, Identity Tab, click New... and step through the New 
Identity Wizard. For this example, we'll assume that you used <var/res/> as the URL prefix.

<li>Create the following document mappings using the property sheet, Mapping tab, Document list.
We'll assume the identity hostname is resin.foo.com and the URL prefix is <var/res/>.

<ol type="a">
	<li>Map <var//res//> to the Resin <var/doc/> subdirectory
	<li>Map <var//res/caucho-status//> to <var/C:\WebSite\isapi_srun.dll\caucho-status\/>
	<li>Map <var//res/servlet//> to <var/C:\WebSite\isapi_srun.dll\servlet\/>
	<li>Map <var//res/snoop//> to <var/C:\WebSite\isapi_srun.dll\snoop\/>
</ol>
</ol>

<p>Make sure WebSite Pro is running, then:</p>

<ol>
<li>Browse http://resin.foo.com/servlet/Hello and /foo.jsp.
You should see a "cannot connect" error.
<li>Start httpd.exe
<li>Browse http://resin.foo.com//servlet/Hello and /foo.jsp.  
You should now see the servlet.
</ol>

</s3>

<s3 title='Adjusting resin.conf'>

<p>resin.conf should mirror the configuration of WebSite Pro.  In other words, you 
need to configure the document root and any directory aliases.
</p>

<p>For many users, you only need to change the <var/app-dir/>
attribute from 'doc' to something like 'c:\website\htdocs'.  For more
complicated configurations, you'll need to add
<a href='app-config.xtp'>path-mapping</a> attributes.</p>

<example title='resin.conf'>
&lt;caucho.com>
  &lt;http-server
      app-dir='c:\website\htdocs'>
    &lt;servlet-mapping url-pattern='/servlet/*'
              servlet-name='invoker'/>

    &lt;servlet-mapping url-pattern='*.xtp'
                        servlet-name='com.caucho.jsp.XtpServlet'/>
    &lt;servlet-mapping url-pattern='*.jsp'
                        servlet-name='com.caucho.jsp.JspServlet'/>
  &lt;/http-server>
&lt;/caucho.com>
</example>

</s3>

<s3 title='Testing the servlet engine'>

<p>From the Resin bin folder, you need to start httpd.exe to start the
servlet runner.</p>

<p>Now browse http://localhost/test.jsp.  You should get a 'file not
found' message.</p>

<p>Create a test file 'C:\WebSite\htdocs\test.jsp'</p>

<example>
&lt;%@ page language=javascript %>
2 + 2 = &lt;%= 2 + 2 %>
</example>

<p>Browse http://localhost/test.jsp again.  You should now get</p>

<results>
2 + 2 = 4
</results>

<p>As a final test, change language to 'java' and refresh the page.
Nothing should change.</p>
</s3>


<s3 title='Troubleshooting'>

<ol>
<li>First, check your configuration with the standalone httpd.sh.
<li>Check <var/http://localhost/caucho-status/>.  That will tell if
the ISAPI extension is properly installed. 
<li>Each srun host should be green and the mappings should
match your resin.conf.
<li>If caucho-status fails entirely, the problem is in the <var/isapi_srun/>
installation.
<li>Check that isapi_srun.dll is in <var/C:\WebSite./>
<li>If caucho-status shows the wrong mappings, there's something wrong
with the resin.conf.
<li>If caucho-status shows a red servlet runner, then httpd.exe hasn't
properly started.
<li>If you get a "cannot connect to servlet engine", caucho-status
will show red, and httpd.exe hasn't started properly.
<li>If httpd.exe doesn't start properly, you should look at the logs
in resin1.x/log.  You should start <var/httpd.exe -verbose/> to get
more information.
<li>If you get Resin's file not found, the WebSite configuration
is good but the resin.conf probably points to the wrong directories.
</ol>

</s3>
</s2>

<s2 title='Command line arguments'>

<p>The following configuration line arguments are recognized by httpd.exe and
httpd.exe.  When installed as a service, these argument will be used when
the service starts.</p>

<deftable>
<tr><td>-verbose<td>Write more verbose information to the log file
<tr><td>-resin_home &lt;path><td>Sets the location of Resin
<tr><td>-java_home &lt;path><td>Specify the JDK location
<tr><td>-msjava<td>Use Microsoft's JVM
<tr><td>-nojit<td>Disable JIT compilation to help debugging
<tr><td>-classpath &lt;cp><td>Add to the classpath
<tr><td>-J&lt;arg><td>Set a Java command line argument, e.g. -J-nojit.
<tr><td>-D&lt;foo=bar><td>Set a Java variable, e.g. -Dresin.home=here.
<tr><td>-install<td>Install as an NT service
<tr><td>-install-as &lt;name><td>Install as an NT service with the specific name.
<tr><td>-remove<td>Remove as an NT service
<tr><td>-remove-as &lt;name><td>Remove as an NT service with the specific name.
</deftable>

</s2>
</s1>
