Servlet action
IPluginServletAction
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:
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
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.
EResponseType | Description |
---|---|
HTML | The string returned by getValue() will be interpreted as HTML and sent to the client's browser. |
SHOW_FILE | A file will be returned with the strings returned by getValue as its name and the data returned by getBinValue() as its content. |
TEMPLATE | A new HTML document will be created, with the string returned by getValue() as the content of its body element. |
TEMPLATE_SYSTEM | Currently the same as TEMPLATE. |
WEITERLEITUNG | The 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.