Wicket
From Resin 3.0
(Difference between revisions)
(New page: == Step by Step == <ol> <li>Download Resin from http://caucho.com/download <li>Untar Resin into /usr/local/share/resin <li>Download Wicket from http://wicket.apache.org <li>Unzip Wicket a...) |
(→Enabling MyApplication with Resin's WebBeans) |
||
Line 17: | Line 17: | ||
Wicket's <code>MyApplication</code> application can be activated with Resin's WebBeans injection by changing the resin-web.xml configuration slightly. If you set the <em>applicationFactoryClassName</em> init-param to "com.caucho.wicket.ResinApplicationFactory" (and make sure resin-support.jar is in ext-webapp-lib), your <code>MyApplication</code> can use | Wicket's <code>MyApplication</code> application can be activated with Resin's WebBeans injection by changing the resin-web.xml configuration slightly. If you set the <em>applicationFactoryClassName</em> init-param to "com.caucho.wicket.ResinApplicationFactory" (and make sure resin-support.jar is in ext-webapp-lib), your <code>MyApplication</code> can use | ||
− | + | [http://caucho.com/resin/doc/resin-ioc.xtp Resin-IoC or WebBeans] injection or interception, avoiding any need to use JNDI at all. | |
<code><pre> | <code><pre> | ||
Line 50: | Line 50: | ||
} | } | ||
} | } | ||
− | |||
− | |||
− | |||
</pre></code> | </pre></code> |
Revision as of 23:38, 27 January 2008
Step by Step
- Download Resin from http://caucho.com/download
- Untar Resin into /usr/local/share/resin
- Download Wicket from http://wicket.apache.org
- Unzip Wicket and copy the jars into resin/ext-webapp-lib
- Download Velocity from http://velocity.apache.org
- Unzip Velocity and copy the jars into resin/ext-webapp-lib
- Create a webapp in resin/webapps/wicket
- Start Resin with java -jar resin/lib/resin.jar
- Create the Hello, World application in resin/webapps/wicket, following http://wicket.apache.org/examples.html
- 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-class="org.apache.wicket.protocol.http.WicketFilter">
<init-param
applicationClassName="demo.HelloWorldApplication"
applicationFactoryClassName="com.caucho.wicket.ResinApplicationFactory"/>
</filter>
<filter-mapping url-pattern="/*" filter-name="wicket"/>
</web-app>
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;
}
}