Class Page

java.lang.Object
com.mastfrog.acteur.Page

public abstract class Page extends Object
Really an aggregation of Acteurs and a place to set header values; in recent versions of Acteur it is rarely necessary to implement this - instead, simply annotate your entry-point Acteur with @HttpCall and one will be generated for you under-the-hood, and use @Precursors and @Concluders to specify Acteurs that should run before/after that one.

This class was central to the Acteur 1.0 API, but at this point is mainly an implementation class. Page subclasses are still generated from annotations, but are rarely used in application code at this point; they are still useful in unit and integration tests where you may have multiple applications for different tests.

To implement, simply subclass and add zero or more Acteur classes or instances using the add() method. Each Acteur is called in succession and can do one or more of:

  • Abort responding to the request so that the next Page in the application can have a chance to respond
  • Leave whether or not to respond up to the next Acteur in the chain, but create some objects to inject into the next Acteur's constructor
  • Accept responsibility for this page responding to the request (other pages will not be tried)
  • Respond to the request, ending processing of it, by setting the response code and optionally adding a ChannelFutureListener which can start writing the response body once the headers are sent
The point is to break the logic of responding to requests into small, reusable chunks implemented as Acteurs.
Author:
Tim Boudreau
  • Constructor Details

    • Page

      protected Page()
  • Method Details

    • add

      public final void add(Acteur action)
    • getDescription

      protected String getDescription()
      Get a description used in the generated web API help.
      Returns:
      A description
    • add

      protected final void add(Class<? extends Acteur> action)