From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
(Enabling MyApplication with Resin's WebBeans)
Line 1: Line 1:
== Step by Step ==
== Step by Step ==
''[Verified with Resin 3.1.5 and Wicket 1.3.0]''

Revision as of 17:36, 27 January 2008

Step by Step

[Verified with Resin 3.1.5 and Wicket 1.3.0]

  1. Download Resin from http://caucho.com/download
  2. Untar Resin into /usr/local/share/resin
  3. Download Wicket from http://wicket.apache.org
  4. Unzip Wicket and copy the jars into resin/ext-webapp-lib
  5. Download Velocity from http://velocity.apache.org
  6. Unzip Velocity and copy the jars into resin/ext-webapp-lib
  7. Create a webapp in resin/webapps/wicket
  8. Start Resin with java -jar resin/lib/resin.jar
  9. Create the Hello, World application in resin/webapps/wicket, following http://wicket.apache.org/examples.html
  10. Browse http://localhost:8080/wicket (Resin will autocompile the classes for you)

Enabling MyApplication with Resin's WebBeans

Wicket's MyApplication application can be activated with Resin's WebBeans injection by changing the resin-web.xml configuration slightly. If you set the applicationFactoryClassName init-param to "com.caucho.wicket.ResinApplicationFactory" (and make sure resin-support.jar is in ext-webapp-lib), your MyApplication can use Resin-IoC or WebBeans injection or interception, avoiding any need to use JNDI at all.

<web-app xmlns="http://caucho.com/ns/resin">

    <filter filter-name="wicket"

    <filter-mapping url-pattern="/*" filter-name="wicket"/>


Your application can then inject any Resin service including DataSources, JMS queues, user-defined beans in the resin-web.xml, etc.

package demo;

import javax.webbeans.*;
import javax.sql.*;

public class MyApplication extends WebApplication {
  @In DataSource _database;

  public Class getHomePage()
    return HelloWorld.class;
Personal tools