This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Resin-IoC integration
Skip to end of metadata
Go to start of metadata

Resin 3.1.5 includes Wicket plugins to support full WebBeans (JSR-299) integration for the Wicket application object, and dependency injection for component objects.

The Application object can use the following capabilities:

  • Injection using @In, @Named, and custom @BindingType injection for both application services and components and app-server resources (databases, jms, ejb, etc)
  • Predefined aspects such as EJB's @TransactionAttribute and @RolesAllowed
  • Both WebBeans and EJB interception using @Interceptors or @InterceptionType
  • WebBeans @Observes for listening for application events

The components get @In and @Named injection, but not the other capabilities, since interception conflicts with the Wicket style of allowing components to use "new" for easy instantiation.

The three plugin classes are

  • com.caucho.wicket.ResinApplicationFactory - for creating applications
  • com.caucho.wicket.ResinComponentInjector - for injecting component resources
  • com.caucho.wicket.ResinWebApplication - as a convenience for injecting resources

The application factory is configured in Wicket's <filter> definition as the applicationFactoryClassName. The sample WEB-INF/resin-web.xml might look like the following:

  <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>

The component injector is registered with your Application object and looks like the following:

import com.caucho.wicket.*;

public MyApplication extends WebApplication {
  public MyApplication()
  {
    addComponentInstantiationListener(new ResinComponentInjector());
  }

  ...
}

The Resin wiki page at http://wiki.caucho.com/Wicket also provides an up-to-date documentation of the integration.

Resin 3.1.5 includes Wicket plugins to support full WebBeans (JSR-299) integration for the Wicket application object, and dependency injection for component objects.

The Application object can use the following capabilities:

  • Injection using @In, @Named, and custom @BindingType injection for both application services and components and app-server resources (databases, jms, ejb, etc)
  • Predefined aspects such as EJB's @TransactionAttribute and @RolesAllowed
  • Both WebBeans and EJB interception using @Interceptors or @InterceptionType
  • WebBeans @Observes for listening for application events

The components get @In and @Named injection, but not the other capabilities, since interception conflicts with the Wicket style of allowing components to use "new" for easy instantiation.

The three plugin classes are

  • com.caucho.wicket.ResinApplicationFactory - for creating applications
  • com.caucho.wicket.ResinComponentInjector - for injecting component resources
  • com.caucho.wicket.ResinWebApplication - as a convenience for injecting resources

The application factory is configured in Wicket's <filter> definition as the applicationFactoryClassName. The sample WEB-INF/resin-web.xml might look like the following:

  <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>

The component injector is registered with your Application object and looks like the following:

import com.caucho.wicket.*;

public MyApplication extends WebApplication {
  public MyApplication()
  {
    addComponentInstantiationListener(new ResinComponentInjector());
  }

  ...
}

The Resin wiki page at http://wiki.caucho.com/Wicket also provides an up-to-date documentation of the integration.

(I'd meant to put this under the integration guides section, not a top-level page, but I don't seem to have the permissions to move it.)

  • No labels