Incubator > Beehive
 

Servlet Container Adapters

Writing a Servlet Container Adapter

Certain Page Flow features (like the default behavior for FlowController.login()) depend on container-specific capabilities. Page Flows use "Servlet Container Adapters" to take advantage of container-specific functionality.

To write an adapter:

  1. Write a class that implements org.apache.beehive.netui.pageflow.ServletContainerAdapter. You can extend org.apache.beehive.netui.pageflow.DefaultServletContainerAdapter.
  2. Package the class in a JAR file which also contains a text file called "META-INF/services/org.apache.beehive.netui.pageflow.ServletContainerAdapter". The text file should have a single line that is your ServletContainerAdapter class name.
  3. Drop the JAR into the WEB-INF/lib directory of your web application. The Page Flow runtime will automatically pick up the first "discovered" adapter that answers true when its accept method is called.
Note
Note: the default ServletContainerAdapter defines "production mode" as the state where assertions are disabled. (See Development and Production Modes for details.) Even if you do not want to use existing adapters for container-specific features, you may want to write your own adapter that defines production mode (ServletContainerAdapter.isInProductionMode()) according to your own requirements.