Mesh plugins

The Gentics Portal | java provides handlers for the available Mesh plugins.

Mesh plugins usually register API endpoints of the form [projectName]/plugins/[pluginName]/…​, and the BasicPluginHandler can be used to easily create proxy handlers for any custom plugins.

Basic plugin handler

The BasicPluginHandler can be used to easily create proxy handlers to forward requests from /api/[pluginName]/* to the Mesh endpoint /api/v2/[projectName]/plugins/[pluginName]/*.

Example for creating a BasicPluginHandler instance
// ...

private final PluginHandler customPluginHandler;

@Inject
public CustomBootstrapInitializer(
        PortalConfig config,
        Vertx vertx,
        Provider<PortalHttpVerticle> verticleProvider,
        MeshRestClient meshClient,
        HandlerProvider handlerProvider) {
    super(config, vertx, verticleProvider, meshClient);

    this.customPluginHandler = new BasicPluginHandler(
        "customPlugin",(1)
        config,
        true,(2)
        handlerProvider);
}

@Override
public void start() {
    // Other initializations.

    deployHttpVerticles(router -> {
        customPluginHandler.addRoutes(router);
    });
}
1 The name of the plugin (needed to create the proxy URLs)
2 The boolean parameter controls whether the plugin handler may use the admin token when the current request is not authenticated. When this argument is false, the request will be forwarded as anonymous.

When more fine grained control over the created proxy handler is needed, the BasicPluginHandler constructor can also be provided with an initialized proxy via new BasicPluginHandler("customPlugin", customProxy).

Available Mesh plugins

Gentics Portal | java already comes with handlers for the following commercial Gentics Mesh plugins, which just need to be added in the BootstrapInitializer.

Comment plugin

The CommentsHandler will forward all requests for /api/comment/* to the Mesh endpoints /api/v1/[projectName]/plugins/comment/*. Additional information can be found in the plugins documentation.

Favorite plugin

The BasicPluginHandler can be used to forward all requests for /api/favorite/* to the Mesh endpoints /api/v1/[projectName]/plugins/favorite/*. Additional information can be found in the plugins documentation.

Forms plugin

configuration

When using poll forms add this configuration to the server.yml.

mesh:
  proxyHeaderWhitelist:
    - Referer

FormsHandler

The FormsHandler will forward all requests necessary to render forms, or submit data to forms to the Mesh forms plugin. Endpoints for creating new forms are considered a backend functionality and will not be forwarded by the portal.

The forms handler will also make sure, that the forms-data and forms-voted cookies are properly forwarded to the plugin.

The handler will also make the renderForm handlebars helper available:

Usage of renderForm
{{ renderForm form-uuid [language] [templateContext] [showResults] }}
Table 1. Parameters for renderForm
Parameter Type Default value Description

form-uuid

String

Mandatory

The Mesh UUID of the form to be rendered

language

String

(empty)

The desired language to render the given form

templateContext

String

(empty)

An additional template context which is appended to the base template path by the plugin when searching templates for rendering

showResults

Boolean

false

Only used by poll forms. When set to true the results of the poll will be rendered no matter whether the user has already participated in the poll or not.

Like plugin

The LikesHandler will forward all requests for /api/like/* to the Mesh endpoints /api/v1/[projectName]/plugins/like/*. Additional information can be found in the plugins documentation.

Search plugin

The BasicPluginHandler can be used to forward all requests for /api/search/* to the Mesh endpoints /api/v1/[projectName]/plugins/search/*. Additional information can be found in the plugins documentation.