| |
This is a general summary of beta changes. Any or all of these may change
at any time. You have been warned.
The plugins for Apache and IIS now detect changes in the resin.conf
automatically. So you don't need to restart Apache or IIS each time
you change a servlet mapping.
System properties may now be set in resin.conf:
<caucho.com>
<system-property foo='bar'/>
...
|
Security provides can now be added in resin.conf:
<caucho.com>
<security-provider id='com.sun.net.ssl.internal.ssl.Provider'/>
...
|
SSL is now available with JSSE. You'll need to download JSSE from
java.sun.com.
To enable SSL, you'll just add some attributes to http.
key-store-file is the name of the server certificate you want to use.
key-store-password is its password.
<caucho.com>
<security-provider id='com.sun.net.ssl.internal.ssl.Provider'/>
<http-server>
<http port='8443'>
<ssl>true</ssl>
<key-store-type>pkcs12</key-store-type>
<key-store-file>keys/test.p12</key-store-file>
<key-store-password>changeit</key-store-password>
</http>
...
</http-server>
|
Sessions are now persistent across server restarts, including
application restarts when classes change. This is very convenient when
working with sections needing use login.
Persistent sessions are configured in the web-app.
File-based sessions use file-store
<web-app>
<session-config>
<file-store>sessions</file-store>
</session-config>
</web-app>
|
Sessions are stored as files in the file-store
directory. When the session changes, the updates will be written to
the file. After Resin loads an Application, it will load the stored
sessions.
Sessions can also be stored in a database. The database must be
specified using one of Resin's DBPool. The database store will automatically
create a session table.
<web-app>
<session-config>
<jdbc-store>test</jdbc-store>
</session-config>
</web-app>
|
data-source | data source name for the table
|
table-name | database table for the session data
|
blob-type | database type for a blob
|
timestamp-type | database type for a blob
|
session-timeout | cleanup time
|
CREATE TABLE session (
id VARCHAR(64) NOT NULL,
data BLOB,
mod_time TIMESTAMP,
PRIMARY KEY(id)
)
|
The always-load-session attribute forces sessions to check the store for
each request. By default, sessions are only loaded from persistent
store when they are created. In a configuration with multiple symmetric
web servers, sessions can be loaded on each request to ensure consistency.
A simple implementation of distributed sessions is now available.
The configuration is in the web-app
<web-app>
<session-config>
<distributed-ring/>
</session-config>
</web-app>
|
The <srun> and <srun-backup> hosts are treated as a ring. Each
host will use the following host as a backup. When the session changes,
the updates will be sent to the following host. When the host starts, it
looks up old sessions in the following host before using its own saved
state.
In conjunction with the reload flag, symmetric (non-sticky)
load-balanced servers can now use the distributed-ring.
InitialContext is now available and configures the java:comp
as with EJB or the servlet spec. The DBPool can now be configured as a
DataSource.
<resource-ref res-ref-name='jdbc/bar' res-type='javax.sql.DataSource'>
<init-param driverName="org.gjt.mm.mysql.Driver"/>
<init-param URL="jdbc:mysql://localhost:3306/test"/>
<init-param user=""/>
<init-param password=""/>
<init-param pingTable="TEST"/>
<init-param pingOnReuse="true"/>
<init-param foo="bar"/>
</resource-ref>
|
Parameters are assigned using beans, so any 'setXXX' method can be
automatically set.
Also, any property not matching a 'setXXX' method will call
'setProperty', as in the foo='bar' example. In other words, you
can set arbitrary JDBC properties.
Also, you can configure any bean using the full bean class
as the res-type.
The Application (ServletContext) is available in JNDI as
java:comp/servlet/Application.
Most of the time, JNDI configuration will be per web-app. However, in
many cases, like a DB pool, it may be useful to share JNDI configuration
across the whole web server. Just put the same env-entry and resource-ref
inside the <caucho.com>
<caucho.com>
<resource-ref res-ref-name='jdbc/bar' res-type='javax.sql.DataSource'>
<init-param driverName="org.gjt.mm.mysql.Driver"/>
<init-param URL="jdbc:mysql://localhost:3306/test"/>
<init-param user=""/>
<init-param password=""/>
<init-param pingTable="TEST"/>
<init-param pingOnReuse="true"/>
<init-param foo="bar"/>
</resource-ref>
<http-server>
</http-server>
</caucho.com>
|
To use the data source, you'll use JNDI:
<%@ page import='javax.sql.*, java.sql.*, java.naming.*'>
<%
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("java:comp/jdbc/bar");
Connection conn = ds.getConnection();
try {
...
} finally {
if (conn != null) conn.close();
}
%>
...
|
EJB clients are created using a ClientFactory (com.caucho.ejb.ClientFactory).
A RmiClientFactory is already available. Just like the JDBC
configuration, you can set factory properties as a bean before
the object create is called.
Other, non-RMI, client factories for various EJB servers should be easy
to make.
<caucho.com>
<http-server>
<ejb-ref ejb-ref-name='ejb/test'
ejb-ref-factory='com.caucho.ejb.RmiClientFactory'>
<init-param url="//localhost/rmiTest"/>
</ejb-ref>
</http-server>
</caucho.com>
|
The ejb-ref is not restricted to EJB. You could use the RmiClientFactory
to obtain a reference to any RemoteObject. Other factories can create
any object they wish.
You can link a portion of the JNDI tree to another JNDI. For example, you
might have an external EJB client that expects its own JNDI space:
<web-app id='/'>
<jndi-link>
<jndi-name>java:comp/env/ejb/traderHome</jndi-name>
<jndi-factory>weblogic.jndi.WLInitialContextFactory</jndi-factory>
<init-param java.naming.provider.url="t3://localhost:7001"/>
<jndi-lookup>statelessSession.TraderHome</jndi-lookup>
</jndi-link>
</web-app>
|
In your servlet or JSP, you can then use:
<%@ page import='javax.naming.*' %>
<%@ page import='javax.rmi.*' %>
<%@ page import='examples.ejb.basic.statelessSession.*' %>
<%
Context context = new InitialContext();
Object homeObj = context.lookup("java:comp/env/ejb/traderHome");
TraderHome home;
home = (TraderHome) PortableRemoteObject.narrow(homeObj, TraderHome.class);
%>
|
UserTransaction is now supported in the DBPool driver. The UserTransaction
variable is in JNDI as java:comp/env/UserTransaction
UserTransaction trans;
trans = (UserTransaction) ic.lookup("java:comp/UserTransaction");
trans.begin();
Connection conn = dataSource.getConnection();
...
trans.commit();
conn.close();
|
The DBPool can now 'ping' the server to see if the connection is
still alive. setPingTable(), setPingOnReuse(), and setPingOnFree(),
determine when the connection is checked.
getParameter now handles multipart/form-data, just like normal forms.
Assuming browsers properly set the Content-Type charset, Resin will
read the form using the proper i18n encoding.
For file uploads, getParameter returns the filename where Resin has
stored the uploaded file. You must retrieve the file by the end of the
request before Resin automatically deletes it.
The access log can now
track cookies:
<access-log id='log/cookie.log'
format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{JSESSIONID}c"'/>
|
The XSL API has changed to make it more compatible with future XSL
standards. You can now transform directly to a stream as well as
transforming into a DOM node. See the
com.caucho.transform package for
more details.
StylesheetFactory factory = new Xsl();
Stylesheet stylesheet = factory.newStylesheet("test.xsl");
StreamTransformer transformer = stylesheet.newStreamTransformer();
WriteStream os = Vfs.openWrite("test.html");
transformer.transform("test.xml", os);
os.close();
|
"XSL-lite" has been renamed "StyleScript" (possibly to become
XStyleScript). To parse as StyleScript use com.caucho.xsl.StyleScript as the stylesheet factory.
StyleScript has been enhanced to support a scripting syntax:
$template(chapter) <<
$if(@title = 3) <<
Chapter 3: $apply-templates();
>>
$else <<
Other Chapter: $apply-templates();
>>
>>
|
For all the xsl:foo elements, $foo(a=>b) << ... >> expands into
<xsl:foo a="b">
...
</xsl:foo>
|
Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark,
and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc. | |
|