| ||||||||||||||||||
Resin 3.1 Documentation Examples Changes Quercus Database Amber EJB SOA/ESB IoC JMS Servlet JMX Hessian Security JAXB IoC Basic Resource Injection Periodic Task JNDI appconfig |
Resin's configuration integrates JAXB-style bean configuration. With Resin, applications can use JAXB to configure its resources
directly from the resin.conf or resin-web.xml. A "JAXB Bean"
is just a Java class that follows a simple set of rules. Each configuration
parameter Files in this tutorial
ConfigurationThe <bean> configuration sets the movies and theater name. <web-app xmlns="http://caucho.com/ns/resin"> <bean jndi-name="beans/theater" type="example.Theater"> <init> <name>Balboa Theater</name> <movie> <title>Plan 9 from Outer Space</title> </movie> <movie> <title>Snakes on a Plane</title> <star>Samuel L Jackson</star> </movie> <movie> <title>The Maltese Falcon</title> <star>Humphrey Bogart</star> <star>Mary Astor</star> <star>Peter Lorre</star> <star>Sydney Greenstreet</star> </movie> </init> </bean> <servlet-mapping url-pattern="/test" servlet-class="example.TestServlet"/> </web-app> Theaterpackage example; import java.util.*; import javax.xml.bind.annotation.*; @XmlRootElement public class Theater { @XmlElement(name="name") private String _name; @XmlElement(name="movie") private ArrayList<Movie> _movieList = new ArrayList<Movie>(); } Moviepackage example; import java.util.*; import javax.xml.bind.annotation.*; @XmlRootElement public class Movie { @XmlElement(name="title") private String _title; @XmlElement(name="star") private ArrayList<String> _starList = new ArrayList<String>(); } TestServletpackage example; import javax.annotation.Resource; import javax.servlet.*; public class TestServlet extends GenericServlet { @Resource(name="beans/theater") private Theater _theater; ... }
|