Fluent Configuration
The FluentConfigurator uses a the Fluent Interface style as described by Martin Fowler.
To wire up the configuration programmatically rather than having to use dwr.xml, you'll need to:
- Create a concrete implementation of
org.directwebremoting.fluent.FluentConfiguratorwhich implements theconfigure()method. - Add an init param '
customConfigurator' to the DWR servlet inweb.xmlto point at your new class.
The implementation of configure() will look something like this:
public void configure() {
withConverterType("dog", "com.yourcompany.beans.Dog");
withCreatorType("ejb", "com.yourcompany.dwr.creator.EJBCreator");
withCreator("new", "ApartmentDAO")
.addParam("scope", "session")
.addParam("class", "com.yourcompany.dao.ApartmentDAO")
.exclude("saveApartment")
.withAuth("method", "role");
withCreator("struts", "DogDAO")
.addParam("clas", "com.yourcompany.dao.DogDAO")
.include("getDog")
.include("getColor");
withConverter("dog", "*.Dog")
.addParam("name", "value");
withSignature()
.addLine("import java.util.List;")
.addLine("import com.example.Check;")
.addLine("Check.setLotteryResults(List nos);");
}
For more information see the JavaDoc for FluentConfigurator
DWR's fluent configurator was originally contributed by Aaron Johnson.
