Purpose of the page factory

A page based processor uses a page factory to check whether the page it should deliver (mostly influenced by the request) exists and to get an instance of the page class. Stubbles delivers the net::stubbles::websites::stubPageXJConfFactory which can be used in conjunction with the net::stubbles::websites::xml::stubXMLProcessor and the net::stubbles::websites::memphis::stubMemphisProcessor. (Information how to use them with the page factory will be added in the documentation of both processors soon.)

Create your own page factory

If you created your own processor you can create your own page factory, too. To do this you need to implement the net::stubbles::websites::stubPageFactory interface which has three methods:

  • getPageName(stubRequest $request) calculated the name of the current page from the request.
  • hasPage($configSource) checks if the page named $configSource exists and can be created.
  • getPage($configSource) returns an instance of net::stubbles::websites::stubPage that contains all informations about the page named $configSource.

The net::stubbles::websites::stubPage container

A page contains properties and elements. Properties could be the name of the page, or a time to live information for caching or any other information that fits into a simple type, while elements are concrete classes of instance net::stubbles::websites::stubPageElement that access the business logic of your application and deliver the required information to the response.

Page elements

Page elements are the connector between the controlling and the model part of the MVC component in Stubbles. They access the business logic, and perform operations on it influenced by values from the request and the session. Because net::stubbles::websites::stubPageElement is an interface you must create your own class implementing this interface. However depending on the processor their may be interfaces extending net::stubbles::websites::stubPageElement which should be used. Please check the documentation of the appropriate processor.