Skip to main content

 Advanced

Advanced topics

Servlets

In the layout, servlets can be used to generate the content for the different user interface components such as pages, blocks, and dialogs.

These servlets can be used by:

  • The layout manager (deprecated) to generate the user interface, or more precisely, to generate part of the content of a UI component.
  • An external API which might be invoked by another app or Ant Tasks in the publish engine.

The Servlets are gradually being deprecated, instead, the recommended mechanism to access PageSeeder’s functionality is to use Services.

Usage

PageSeeder servlets can be invoked on the Web as:

/ps/servlet/{servlet}

Where servlet is the full class name of the Servlet.

See the documentation for each Servlet to know which parameter can or needs to be specified, the HTTP method and other permission requirements.

Layout

Servlets can be referenced in the layout configuration file using the <servlet> element. The @class attribute must be specified and refer to a existing servlet.

See example for a fictional page:

<!-- A sample servlet used for a page -->
<page id="group-acme-test" scope="group" title="Test">
  <url pattern="/acme/test"/>
  <servlet class="com.pageseeder.DoSomething">
    <parameter name="uri"     value="{@uri.id}"/>
    <parameter name="xformat" value="xml"/>
  </servlet>
</page>

To ensure that the servlet returns XML, generally include the xformat parameter. Check the API documentation for the servlet intended to be used.

Support

Some Servlets have been designed for the layout and shouldn't be used as an API (it might be because their API is not stable or because they rely on a specific state of the system). Other Servlets are more API friendly.

Each Servlet documentation shows clearly in which context it is supported and the level of support.

LevelDescription
Not SupportedThe Servlet MUST NOT BE USED and is likely to fail
ExperimentalThe Servlet might work, but has not been tested, or its API might change in future releases, PageSeeder SHOULD NOT BE USED
SupportedThe Servlet has a stable API and has been successfully tested in this context, so go ahead!
DeprecatedThe Servlet has reached its end of life. It has been scheduled to be removed from the API in subsequent releases of PageSeeder and marked as obsolete. PageSeeder generally provides a replacement.
ObsoleteThe Servlet is no longer functional and MUST NOT BE USED
Created on , last edited on