Server

Publisher

Updated: December 4, 2024

JSF UI Deprecation
This requires to have the JSF UI addon installed on your server that is deprecated since Nuxeo Platform LTS 2019.
Please refer to the Web UI documentation.

Functional Overview

Technical Overview

There are three ways to publish a document:

  • on local sections, i.e. the sections created in your Nuxeo DM instance,
  • on remote sections, i.e. the sections of a remote Nuxeo server,
  • on the filesystem.

Publication is configured using the Publisher Service.

About the Publisher Service

The PublisherService deals with three interfaces:

  • PublishedDocument: represents the published document. It can be created from a DocumentModel, a proxy or a file on the filesystem.
  • PublicationNode: represents a Node where you can publish a DocumentModel. It can be another DocumentModel (mainly Folder / Section) or a directory on the filesystem.
  • PublicationTree: the tree which is used to publish / unpublish documents, to approve / reject publication, list the already published documents in a PublicationNode, etc. See the Javadoc of the PublicationTree.

The PublisherService mainly works with three concepts:

  • factory: the class which is used to actually create the published document. It also manages the approval / rejection workflow on published documents.
  • tree: a PublicationTree instance associated to a name; for instance there is a SectionPublicationTree which will publish in Sections.
  • tree instance: an actual publication tree where one defines the factory to use, the underlying tree to use, its name / title, and some parameters described below.

Configuring Local Sections Publishing

Publishing in local Sections is the default way to publish documents.

Here is the default contribution you can find in rendition-publisher-contrib.xml located in the nuxeo-platform-rendition-publisher project:

<extension target="org.nuxeo.ecm.platform.publisher.impl.service.PublisherServiceImpl"
    point="treeInstance">
  <publicationTreeConfig name="DefaultSectionsTree" tree="RenditionPublicationCoreTree"
      factory="RenditionPublication" localSectionTree="true"
      title="label.publication.tree.local.sections">
    <parameters>
      <!-- <parameter name="RootPath">/default-domain/sections</parameter> -->
      <parameter name="RelativeRootPath">/sections</parameter>
      <parameter name="enableSnapshot">true</parameter>
      <parameter name="iconExpanded">/icons/folder_open.gif</parameter>
      <parameter name="iconCollapsed">/icons/folder.gif</parameter>
    </parameters>
  </publicationTreeConfig>
</extension>

In this contribution, we define an instance using the RenditionPublicationCoreTree tree and the RenditionPublication factory. We give it a name, a title and configure it to be a localSectionTree (which means we will publish the documents in the Sections of the Nuxeo application the documents are created in).

The available parameters are:

  • RootPath: used when you want to define the root publication node of your PublicationTree. You can't use both RootPath and RelativeRoothPath parameters.
  • RelativeRootPath: used when you just want to define a relative path (without specifying the domain path). A PublicationTree instance will be created automatically for each domain, appending the RelativeRootPath value to each domain. For instance, let's assume we have two domains, domain-1 and domain-2, and the RelativeRootPath is set to "/sections". Then, two PublicationTree instances will be created: the first one with a RootPath set to "/domain-1/sections", and the second one with a RootPath set to "/domain-2/sections", In the UI, when publishing, you can chose the PublicationTree you want. The list of trees will automatically be updated when creating and deleting domains.
  • iconExpanded and iconCollapsed: specify which icons to use when displaying the PublicationTree in the user interface.

Configuring Remote Sections Publishing

To make the remote publication work, both the Nuxeo server instance and Nuxeo client instance need to be configured.

Server Configuration

You should create a new configuration file, publisher-server-config.xml for instance, in the nxserver/config folder of your Nuxeo acting as a server (i.e., the Nuxeo application on which the documents will be published). The best way is to create a custom template with your configuration, see Configuration Templates.

Here is a sample configuration:

  <extension target="org.nuxeo.ecm.platform.publisher.impl.service.PublisherServiceImpl"
      point="treeInstance">
    <publicationTreeConfig name="ServerRemoteTree" tree="CoreTreeWithExternalDocs"
        factory="RemoteDocModel" >
      <parameters>
        <parameter name="RootPath">/default-domain/sections</parameter>
      </parameters>
    </publicationTreeConfig>
  </extension>

The available parameters are:

  • RootPath: its value must be the path to the document which is the root of your PublicationTree. In the above example it will be the document /default-domain/sections, the default Sections root in Nuxeo. This parameter can be modified to suit your needs; don't forget to include the whole path to the document.

Client Configuration

You should create a new configuration file, publisher-client-config.xml for instance, in the nxserver/config folder of your Nuxeo acting as a client (i.e., the Nuxeo application from which documents are published). The best way is to create a custom template with your configuration, see Configuration Templates.

Here is a sample configuration:

  <extension target="org.nuxeo.ecm.platform.publisher.impl.service.PublisherServiceImpl"
      point="treeInstance">
    <publicationTreeConfig name="ClientRemoteTree" tree="ClientForRemoteTree"
        factory="ClientProxyFactory">
      <parameters>
        <parameter name="title">label.publication.tree.remote.sections</parameter>
        <parameter name="userName">Administrator</parameter>
        <parameter name="password">Administrator</parameter>
        <parameter name="baseURL">http://myserver:8080/nuxeo/site/remotepublisher/</parameter>
        <parameter name="targetTree">ServerRemoteTree</parameter>
        <parameter name="originalServer">localserver</parameter>
        <parameter name="enableSnapshot">true</parameter>
      </parameters>
    </publicationTreeConfig>
  </extension>

The available parameters:

  • targetTree: this parameter corresponds to the name of the tree defined on the server Nuxeo application, here ServerRemoteTree.
  • username, password: the user account defined by those parameters will be the one used to connect to the remote Nuxeo and so to create documents in the PublicationTree. This account MUST exist on the server.
  • baseURL: the URL used by the PublisherService on the client side to communicate with the server Nuxeo application.
  • originalServer: identifies the Nuxeo application used as client.

Configuring Filesystem Publishing

To publish on the filesystem, you just need to define a new TreeInstance using the LocalFSTree and the RootPath of your tree.

Here is a sample configuration:

<extension  target="org.nuxeo.ecm.platform.publisher.impl.service.PublisherServiceImpl"
    point="treeInstance">
  <publicationTreeConfig name="FSTree" tree="LocalFSTree"
      factory="LocalFile" localSectionTree="false"
      title="label.publication.tree.fileSystem">
    <parameters>
      <parameter name="RootPath">/opt/publishing-folder</parameter>
      <parameter name="enableSnapshot">true</parameter>
      <parameter name="iconExpanded">/icons/folder_open.gif</parameter>
      <parameter name="iconCollapsed">/icons/folder.gif</parameter>
    </parameters>
  </publicationTreeConfig>
</extension>

The available parameters are:

  • RootPath: the root folder on the filesystem to be used as the root of the publication tree.
  • iconExpanded and iconCollapsed: specify which icons to use when displaying the PublicationTree on the user interface.
  • enableSnapshot: defines if a new version of the document is created when the document is published.

Enabling Duplication of Relations upon Publication

By default, the relations on the document in the workspace are not duplicated on the published document. But it is possible to have them duplicated.

To enable this duplication of relations, you need to add the following contribution to the Platform:

<extension target="org.nuxeo.ecm.core.event.EventServiceComponent"
    point="listener">
  <listener name="publishRelationsListener" async="false" postCommit="false"
    class="org.nuxeo.ecm.platform.relations.core.listener.PublishRelationsListener"
    priority="-50">
    <event>documentProxyPublished</event>
  </listener>
</extension>

See the HOWTO: Contribute to an Extension page to add the contribution in Nuxeo Studio.