Servlet action


IPluginServletAction

Position of form variable evaluation plugins in Xima® Formcycle's program flow. They are run when the servlet is requested by a client.

Use cases

This type of plugin allows you to return custom content in response to an HTTP request.

Accessing the servlet uses the following URL:

http://<domain>/<formcycleDirectory>/plugin/?name=<Name of the IPluginServletAction implementation>&client-id=<clientId>

It is also possible to use the parameter project-id instead of the client-id, which will use the client to which the provided form project belongs.

Method signatures

IPluginServletActionRetVal execute(IPluginServletActionParams params) throws FCPluginException

Return value

An object of type IPluginServletActionParams is passed to the execute method, providing access to the following properties:

  • Request type, ie. POST, GET, etc (getAction())
  • Request headers (getHeaderMap())
  • Request parameter, excluding uploads (getRequestParameters())
  • Files from the request (getUploadFiles())
  • Session attributes (getSessionAttributes)
  • Current locale (getLocale)

Return value

The execute method must return an object implementing IPluginServletActionRetVal.

The class PluginServletActionRetVal provides a reference implementation. Its constructor takes the response to the request as an object of type IServletResponse, which can return either a string or binary data as the response.

The EResponseType controls how the system will interpret the string or binary returned by the IServletResponse.

EResponseTypeDescription
HTMLThe string returned by getValue() will be interpreted as HTML and sent to the client's browser.
SHOW_FILEA file will be returned with the strings returned by getValue as its name and the data returned by getBinValue() as its content.
TEMPLATEA new HTML document will be created, with the string returned by getValue() as the content of its body element.
TEMPLATE_SYSTEMCurrently the same as TEMPLATE.
WEITERLEITUNGThe string returned by getValue() will be interpreted as an URL and the client will be redirected to that URL.

An exception of type FCPluginException will be thrown when any error occurred in the plugin.