Class Serialization


  • @RequiredRole("admin")
    public class Serialization
    extends APIRequestHandler
    Servlet that manages installation/upgrade/uninstallation of formatters (serializers/deserializers).

    /api/admin/serialization

    Only the POST method is accepted. The protocol for installation of a serialization module is:

    1. Upload the formatter .jar file with a multipart POST request (the first file parameter encountered is taken, regardless of its name). The response is a JSON-encoded envelope with a "model" object with the following attributes:
      jar
      The name of the .jar file uploaded (this must be used in the subsequent request).
      name
      The human-readable name of the file format handled by the serialization module found in the .jar file.
      mimeType
      The MIME (Content) Type handled by the serialization module found in the .jar file.
      version
      The version of the serialization implementation.
      deserializer
      Whether or not the module can read files of the given format
      serializer
      Whether or not the module can produce files of the given format
      icon
      URL for the module's icon.
      installedVersion
      The version of the already-installed serialization implementation, if any.
    2. Make a POST request with the following application/x-www-form-urlencoded parameters:
      action
      Either install or cancel
      jar
      The name of the .jar file, as returned in the response to the previous request.
      If action was intsall, then the response is a JSON-encoded envelope with a "model" object with the following attributes:
      jar
      The name of the .jar file, as returned in the response to the previous request.
      name
      The human-readable name of the file format handled by the serialization module found in the .jar file.
      mimeType
      The MIME (Content) Type handled by the serialization module found in the .jar file.
      version
      The version of the serialization implementation.

    Serialization modules can be uninstalled by making a POST request with the following application/x-www-form-urlencoded parameters:

    action
    uninstall
    mimeType
    The MIME (Content) Type handled by the serialization.
    Author:
    Robert Fromont robert@fromont.net.nz
    • Constructor Detail

      • Serialization

        public Serialization​(File tempDir)
        Default constructor.
    • Method Detail

      • post

        public javax.json.JsonObject post​(RequestParameters parameters,
                                          Consumer<Integer> httpStatus,
                                          File annotatorDir)
        POST handler - receive an uploaded file or an installation confirmation.
        Parameters:
        parameters - Request parameter map.
        httpStatus - Receives the response status code, in case of error.
        annotatorDir - The directory in which annotator jars and their files are stored.
        Returns:
        JSON-encoded object representing the response