Resin Documentationapp server |
resin 4.0.4 release notes
Resin 4.0.x is the active development branch. Passing the Servlet 3.0 TCK in 4.0.4 is the first step for Resin to complete the JavaEE-6 Web Profile. The web profile is our primary focus for the next few months. It's the "good bits" of JavaEE-6: all the specifications aimed at developing web applications without the legacy enterprise requirements like CORBA that only specialized applications use. Our plan is to continue passing new TCKs for each of the next few 4.0.x releases until we are done with the web profile. The new embedded ResinContext lets you use Resin's CanDI and EJB environment in a non-Resin context like a JUnit test or even in a standalone application. The simplest use of Resin context scans for *.jar files with CanDI beans.xml or EJB ejb-jar.xml files and lets you start a CanDI request scope. Embedded Requestsimport com.caucho.resin.*; public class MyMain { static void main(String []argv) { ResinBeanContainer resinContext = new ResinBeanContainer(); // scan classpath and initialize @Startup beans resinContext.start(); // start a new request RequestContext cxt = resinContext.beginRequest(); try { MyBean bean = cxt.newInstance(MyBean.class); bean.doStuff(); } finally { cxt.close(); } } } Configuring beansYou can configure the beans XML using the same environment tags as are available to the resin.xml and resin-web.xml like <mypkg:MyBean> for CanDI, <database> for databases, and <resin:import> to include files. <beans xmlns="http://caucho.com/ns/resin" xmlns:lang="urn:java:java.lang" xmlns:ee="urn:java:ee"> <mypkg:MyBean xmlns="urn:java:com.mycom.mypkg"> <my-field>my-value</my-field> </mypkg:MyBean> <lang:String> <new>my-config-value</new> <ee:Named>my-config-name</ee:Named> </lang:String> <database name="my-db"> <driver type="..." url="..."/> </database> </beans> The ResinBeanContainer has an associated JUnit @RunWith runner, letting you create JUnit tests for your model code in Resin's CDI environment. package qa; import org.junit.*; import org.junit.runner.RunWith; import static org.junit.Assert.*; import com.caucho.junit.ResinBeanContainerRunner; import javax.inject.*; @RunWith(ResinBeanContainerRunner.class) @ResinBeanConfiguration(beansXml="test.xml") public class MyTest { @Inject MyBean _myBean; @Test public void simpleTest() { assertTrue(_myBean != null); } } Quercus in 4.0.4 has implemented the namespaces and closures capabilities of PHP 5.3. Namespaces finally give PHP the ability to isolate functions and classes with unique names. Closures add functional programming capabilities to PHP, giving power to more powerful event-driven frameworks. In addition to the major language changes, Quercus has completed its support for variable class methods and late static binding, both features are used in new-generation PHP frameworks to improve templating power and clarity.
|