<document>
  <header>
    <product>resin</product>
    <title>Resin 3.0.8 Release Notes</title>
  </header>

<body>

<summary objsummary='localtoc'/>

<section title="Dependency Injection/Inversion of Control">

<p>Resin's buzzword compliance has been enhanced in 3.0.8.  Instead of
the old, boring "bean-style init" phrase, parts of the documentation have
been upgraded to use the snazzier "dependency injection" buzzword.
Since Resin's configuration is based on setters, the proper buzzword
is "setter based dependency injection."</p>

<p><figure src="assembler-eg1.gif"/></p>

<p>The upgraded, buzzword-compliant documentation includes:</p>

<ul>
<li><a href="resource|tutorial/injection/index.xtp">Dependency Injection for the MovieFinder example</a>
<li><a href="db|tutorial/jdbc-basic/index.xtp">Dependency Injection for a servlet's DataSource</a>
<li><a href="webapp|tutorial/periodictask/index.xtp">Dependency Injection for a PeriodicTask resource</a>
<li><a href="jmx|tutorial/listener/index.xtp">Dependency Injection for a JMX client emitter/listener</a>
<li><a href="protocols|hessian.xtp">Dependency Injection for Hessian Service configuration</a>
</ul>

<p>The main documentation on Resin's <a href="config|init.xtp">bean-style
init</a> has not yet been upgraded to the new buzzwords, but
provides more information on the configuration patterns.</p>

</section>

<section title="MBean JNDI - MBean Dependency Injection">

<p>MBeans now have a JNDI URL, "mbean:", which allows them to the used
for bean-style init (Dependency Injection.)</p>

<p>The JNDI lookup will return the MBean's proxy interface
if one is available.</p>

<p>If a MBean domain is included in the name, e.g. "mbean:foo:type=Bar",
Resin will use the full MBean name.  If only the attributes are used,
e.g. "mbean:type=Bar", Resin will add the local JMX context name.  In other
words, Resin will add the web-app's properties.  This allows the
configuration to be independent of the web-app or host configuration block.</p>

<p>So "mbean:type=Bar", might be converted
to the full MBean name "resin:Host=foo.bar,WebApp=/dir,type=Bar".</p>

<p>Since jndi:lookup can be used for dependency injection (bean-style init),
you can use it to configure mbeans.</p>

<example>
&lt;web-app xmlns="http://caucho.com/ns/resin">
  &lt;resource mbean-name="type=Test" type="qa.Test"/>

  &lt;resource jndi-name="t1" type="qa.T1">
    &lt;init>
      &lt;test>\${jndi:lookup("mbean:type=Test")}&lt;/test>
    &lt;/init>
  &lt;/resource>
&lt;/web-app>
</example>

<p>In the preceeding example, T1 has a <code>setTest(TestMBean)</code>
method.</p>

</section>

<section title="Persistent/Distributed sessions">

<p>The persistent/distributed sessions have been changed because the
old configuration had caused much confusion.  (The old configuration
still works for backward compatibility.)</p>

<p><a href="config|resin.xtp#persistent-store">&lt;persistent-store></a>
configures the persistent/distributed store in the &lt;server> level for
all persistent store types: jdbc, cluster (tcp), and file.  The
&lt;server> level is required because the persistent-store needs to
communicate with other servers in the cluster to notify about
updates.</p>

<p>Each &lt;web-app> needs to enable persistent store for its
session-config individually.  The <a
href="config|webapp.xtp#session-config">use-persistent-store</a>
attribute of the &lt;session-config> enables the persistent-store.</p>

<p>As usual, you can use <a
href="config|webapp.xtp#web-app-default">&lt;web-app-default></a> to
enable configuration for all web-apps.</p>

<example>
&lt;resin xmlns="http://caucho.com/ns/resin">

&lt;server>
  &lt;cluster>
    &lt;srun server-id="a" port="6810" index="1"/>
    &lt;srun server-id="b" port="6811" index="2"/>
  &lt;/cluster>

  &lt;persistent-store type="jdbc">
    &lt;init data-source="jdbc/session"/>
  &lt;/persistent-store>

  &lt;web-app-default>
    &lt;session-config use-persistent-store="true"/>
  &lt;/web-app-default>

  &lt;host id=''>
    &lt;web-app id='/'/>
  &lt;/host>
&lt;/server>
&lt;/resin>
</example>
</section>

<section title="cluster client configuration">

<p>The client configuration for the cluster is now configurable
(e.g. for load balancing and distributed sessions).</p>

<example title="resin.conf">
&lt;resin xmlns="http://caucho.com/ns/resin">
 &lt;server>
   &lt;cluster>
     &lt;client-live-time>60s&lt;/client-live-time>
     &lt;client-dead-time>15s&lt;/client-dead-time>
     &lt;client-read-timeout>10s&lt;/client-read-timeout>
     &lt;client-write-timeout>15s&lt;/client-write-timeout>

     &lt;srun .../>
   &lt;/cluster>

   ...
 &lt;/server>
 
&lt;/resin>
</example>

</section>

<section title="http/srun timeout configuration">

<p>Added
read-timeout and write-timeout for <a href="config|resin.xtp#http">http</a>
and <a href="config|resin.xtp#srun">srun</a>
.</p>

<example>
&lt;http host="localhost" port="8080">
  &lt;read-timeout>120s&lt;/read-timeout>
  &lt;write-timeout>60s&lt;/write-timeout>
&lt;/http>
</example>

</section>

<section title="web-app-deploy Enchancements">

<p>web-apps configured with <a href="config|webapp.xtp#web-app-deploy">web-app-deploy</a> can now be custom configured
in the resin-conf using &lt;web-app> inside the web-app-deploy.
In particular, the &lt;web-app> can define a &lt;context-path> different
from the default value given by the .war name.</p>

<p>The web-apps are matched using the &lt;document-directory> as a unique
identifier.</p>

<example title="resin.conf">
...
&lt;web-app-deploy path="webapps">
  &lt;web-app context-path="/foo" document-directory="bar"/>
&lt;/web-app-deploy>
...
</example>

</section>

<section title="startup-mode, redeploy-mode, and WebAppMBean.restart()">

<p>Application redeployment is now controllable through the <a
href="config|webapp.xtp#web-app">web-app</a> web.xml
and through JMX.</p>

<p>The startup-mode has three values: "automatic", "lazy", and "manual".
<ul>
<li>automatic - starts the web-app on server start (default)
<li>lazy - starts the web-app on the first request
<li>manual - waits for JMX to start the web-app.
</ul>

<p>The redeploy-mode has two values: "automatic", and "manual".
<ul>
<li>automatic - restarts the web-app when modified (web.xml, *.class, *.war, etc).
<li>manual - waits for JMX to restart the web-app when changes occur.
</ul>

<p>The WebAppMBean has three new methods:
<ul>
<li>start() - starts the application
<li>stop() - stops the application
<li>restart() - restarts the application
</ul>

</section>

<section title="log rotation and compression">

<p>If the archive-name for log rotation ends in ".gz", then Resin will
use GZip to compress the log when it's rotated.  See the <a
href="config|log.xtp#Compression">log configuration</a>.
</p>

<example>
  &lt;log name="" level="warning" path='log/error.log'
       archive-format="%Y-%m-%d.error.log.gz"
       rollover-period="1D"/>

  &lt;access-log path="log/access.log"
              archive-format="access-%Y%m%d.log.gz"
              rollover-period="1D"/>
</example>

</section>

<section title="Ping Enchancements: Deadlock detection with JDK 1.5">

<p>With JDK 1.5, the &lt;ping> resource will check the JDK to detect deadlocks
and will automatically log the deadlocked threads and restart the JDK when
deadlocks are detected.</p>

</section>

<section title="Cache invalidation">

<p>The ServletServerMBean adds clearCache() and clearCacheByPattern().
</section>

<section title="Portlet Support">

<p>Resin's <a href="portlet|index">Portlet support</a> provides
a generic library package for application to use the portal/portlet
design pattern.</p>

<p>The portlet support is currently in Beta.</p>

</section>

<section title="Groovy Support">

<p>Resin can use <a href="thirdparty|groovy.xtp">Groovy
scripts as Java classes</a> or even as servlets</p>.

<p>Full Groovy support is waiting for an important bug fixes from Groovy.
See the <a href="http://jira.codehaus.org/secure/ViewIssue.jspa?key=GROOVY-375">Groovy Bug Report 375</a> and vote on it.</p>

<p>To enable Groovy support, put the groovy*.jar and the asm-*.jar in resin/lib.  Then add a &lt;compiling-loader> entry to the &lt;class-loader> configuration.</p>

<example title="WEB-INF/web.xml configuration for groovy">
&lt;web-app xmlns="http://caucho.com/ns/resin">
  &lt;class-loader>
    &lt;compiling-loader path="WEB-INF/groovy"
                      compiler="groovyc"
                      source-extension=".groovy"/>
  &lt;/class-loader>
&lt;/web-app>
</example>

<p>Once you've done that, you can drop in groovy source files
in WEB-INF/groovy and use them like Java beans from your Java classes.
</p>

<example title="WEB-INF/groovy/test/MyBean.groovy">
package test;

public class MyBean {
  public String toString() return { "groovy[]"; }
}
</example>

</section>

<section title="PHP">

<p>PHP support has been fixed in 3.0.8.  The full configuration
doc is in  <a href="../thirdparty/php.xtp">thirdparty/php</a>.</p>

<example title="web.xml">
&lt;web-xml>
  &lt;servlet servlet-name="php"
           servlet-class="com.caucho.servlets.FastCGIServlet">
    &lt;init>
      &lt;server-address>localhost:8002&lt;/server-address>
    &lt;/init>
  &lt;/servlet>

  &lt;servlet-mapping url-pattern="*.php" servlet-name="php"/>
&lt;/web-xml>
</example>

</section>

<section title="Hessian">

<p><a href="../protocols/hessian-1.0-spec.xtp">Hessian 1.0.1</a> has
been released. Hessian 1.0.1 clarifies the non-normative
naming conventions for the meta-info protocol and the object names.</p>

<p>The new object name uses query string of "?id=XXX" to avoid dependency
on EJB.</p>

<p>The new meta-info attributes for <code>_hessian_getAttribute(attrName)</code> are:</p>
<deftable>
<tr><td>attribute<td>description.
<tr><td>java.api.class<td>Returns the java API interface for this URL.
<tr><td>java.home.class<td>Returns the java API interface for the factory/home URL, i.e. stripped of the "?id=XXX".
<tr><td>java.object.class<td>Returns the java API interface for the object instances URL, i.e. those which have query string "?id=XXX".
</deftable>

<p>Hessian now supports a JNDI "hessian:" URL.</p>

<example>
Context ic = new InitialContext();
Bean bean = (Bean) ic.lookup("hessian://localhost:8080/hessian/bean");
</example>

</section>

<section title="jndi-link">

<p><a href="config|env.xtp#jndi-link">jndi-link</a> no longer
requires the &lt;factory>.  Now it can be used
as a symbolic link to another JNDI name.</p>

<example>
&lt;web-app xmlns="http://caucho.com/ns/resin">
  &lt;jndi-link jndi-name="java:comp/env/stock-service"
             foreign-name="hessian://foo.com:8080/service/stock"/>
&lt;/web-app>
</example>

</section>

<section title="ThrottleFilter">

<p>A new standard <a href="servlet|filter-library.xtp#ThrottleFilter">ThrottleFilter</a> has been added.  The filter restricts
the number of requests from the same IP, defaulting to 2 (the HTTP spec limit.)
The ThrottleFilter is useful to limit some parallel download programs
that can use more threads than they should.
</p>

<example>
&lt;filter filter-name="throttle"
        filter-class="com.caucho.filters.ThrottleFilter">
  &lt;init>
    &lt;max-concurrent-requests>2&lt;/max-concurrent-requests>
  &lt;/init>
&lt;/filter>

&lt;filter-mapping url-pattern="/*" filter-name="throttle"/>
</example>

</section>

<section title="64-bit JNI">

<p>The JNI has been updated to support 64-bit compilation on Solaris.
The <a href="install|httpd.xtp">configuration</a> looks like:</p>

<example>
unix> ./configure --enable-64bit
unix> make
unix> make install
unix> bin/httpd.sh -J-d64
</example>

</section>

<section title="Bugs">

<p>
<ul>
<li>See the changelog for more details.
<li>Important bug fix for JNI keepalives on Win32.
<li>Important misc memory and reload fixes
</ul>
<p>

</section>

</body>
</document>
