Ensembl .ENSEMBL_ROOT/perl/defaultENSEMBL_ROOT/perl/commonENSEMBL_ROOT/perl/multiEnsEMBL::Web::Document::WebPage object. This class of object is responsible for managing the process of building a new response (usually in HTML) which is returned to the user.
EnsEMBL::Web::Document::WebPage (or simply WebPage for brevity) is used by Ensembl to construct the web pages viewed by users. It is responsible for controlling the process of retrieving all required data from the Ensembl databases, formatting that data, generating images where necessary and collating all information together to be displayed to the user.Factory, Component, Configuration and Object families of classes) which WebPage manages and manipulates to create a reponse page. As such, a new web page can be created in Ensembl with a very simple script. For example, a new GeneView page is created with:
package geneview;
use EnsEMBL::Web::Document::WebPage;
simple_with_redirect( 'Gene' );
(simple_with_redirect create an object of type "Gene")
WebPage machinery:
WebPage renderers are of the EnsEMBL::Web::Document::Renderer family of classes and dictate the destination of any output generated by WebPage and its components. The default, EnsEMBL::Web::Document::Renderer::Apache, sends the output as a response to a request from a browser, via Apache. Renderers usually accept output via one or more print methods. (Other example EnsEMBL::Web::Document::Renderer::GZfile).
Renderer. The default is a particular flavour of HTML.
WebPage uses an object from the EnsEMBL::Web::Document family to setup and configure the content of the output. This is usually (but not necessarily) coupled with an output type. The default for dynamic pages is (unsurprisingly) EnsEMBL::Web::Document::Dynamic. Other examples include EnsEMBL::Web::Document::Pop-Up and EnsEMBL::Web::Document::Common. (Common has the components which are needed for the static, dynamic and pop-up pages and EnsEMBL::Web::Document::Dynamic inherits from this).
WebPage generate an HTML web page response to Apache. However, other response types are available.
WebPage's simple_with_redirect(). This starts a production pipeline made up of the following stages:
START
↓
Initialise output
↓
Setup common output components
↓
Retrieve data
↓
Setup data specific output components
↓
Collate and render
↓
Delivery
GeneView produces an HTML page, delivered to a user's browser via Apache. Using this as an example, let's look at each stage:
perl/default/geneview) to WebPage::simple_with_redirect(). A single parameter is provided which informs WebPage of the type of page to create. In effect, this parameter (Gene, in the case of GeneView) configures which data objects to create, and how they are to be configured and collated for the final deliverable content.
WebPage then initialises the various components necessary to produce output: the renderer (e.g. Apache), the output type (e.g. HTML) and the document type (e.g. Dynamic). In addition, a SpeciesDefs object is created. This object plays an important part in configuring Ensembl, and is made available to all other layout and data objects created by WebPage. It is discussed in more detail on the Configuration and sessions page. A timer is also set up for debugging and profiling.
WebPage::new calls EnsEMBL::Web::Document::Dynamic::_initialize_HTML which by default contains all these and more.
The templates for each section of the webpage are in an ordered array which is passed to the add_body_elements function. The common output components can be expanded, edited or removed using the Ensembl plugin system 1.
EnsEMBL::Web::Document::Dynamic document type object is attached to the WebPage's page parameter for easy access of other page components, and it is the WebPage that proceeds to retrieve data from the Ensembl databases.
WebPage is created, a new object of the Factory family is created. This Factory is responsible for creating the appropriate data objects for the page2, and is configured using the original page type provided at the start of the pipeline (for example, 'Gene'). The CGI object containing the parameters passed to the page in the URL is passed along to the Factory allowing it to retrieve and configure the necessary data objects for display.EnsEMBL::Web::Document::WebPage is something of a misnomer. Whilst a standard plain text HTML response is commonly used by Ensembl, EnsEMBL::Web::Document::WebPage can return data in a number of other formats by replacing the default renderer, output type and document type.
_initialize_HTML). Once a default set of components has been established, the installed plugins are queried for updates to that default set. Any plugins wishing to extend the default output components should implement one or both of:
MyPlugin::modules::EnsEMBL::MyPlugin::Document::Configure::common_page_elements()MyPlugin::modules::EnsEMBL::MyPlugin::Document::Configure::dynamic_page_elements()add_body_element(), add_body_element_after() and replace_body_element(). Check the e! doc for EnsEMBL::Web::Document::Page for more information.
↑Factory created is an EnsEMBL::Web::Proxy::Factory, which in turn creates the correct Factory type, determined by the original page type provided at the start of the pipeline. For example, in the case of GeneView, an EnsEMBL::Web::Factory::Gene would be created. This is also so the Factory can cope with the plug-in code looping through each Factory in the plug-ins directory. Factory then creates the appropriate EnsEMBL::Web::Object::Gene, EnsEMBL::Web::Configuration::Gene and EnsEMBL::Web::Component::Gene objects, which provide data, configuration and layout view information respectively.
↑© 2008 WTSI / EBI. Ensembl is available to download for public use - please see the code licence for details.