5. GenticsContentPortlet

5.1. Introduction

The GenticsContentPortlet basically is a variation of the “GenticsContentModule” (Section 4) with some deprecated features removed and some new features added. The following sections will just describe the differences, for additional information see the documentation of the GenticsContentModule.

5.2. Removed Features

The following list of features has been removed from the GenticsContentPortlet

  • <plist> in the content (can be replaced by Velocity)

  • <pxnl> in the content (can be replaced by Velocity)

  • <insert> in the content (can be replaced by Velocity)

  • <pobject> in the content (can be replaced by Velocity)

5.3. Parameters

Additionally to the Parameters of the GenticsContentModule, the GenticsContentPortlet supports the following pnode parameters.

Table 5.11.  Portlet parameters for GenticsContentPortlet

NameTypeDefaultDescription
backendurlStringNULL URL to the Gentics Content.Node 5 Backend for support of rendering content which was fetched from the backend. This is also needed for the support of frontend editing in conjunction with Gentics Content.Node 5. The backend URL must be reachable from the Portal Server, NOT the client.
backendcookieStringNULL Comma separated list of names of cookies which need to be forwarded to the request to the backend to fetch the content.
backendmodeBooleanfalse

This setting switches the source for fetching the rendered content: When set to false (which is the default), the content is fetched from the configured Content Repository. When set to true , the content is fetched from the linked backend (Gentics Content.Node 5) via the configured backendurl .

proxyprefixString/GCN5_Portal/GCN/

Prefix for requests which are directed to the backend. The prefix must direct the request to a Proxy Servlet, that proxies the request to the backend (since the backend itself normally is not available via the same hostname).

nodeidinpathlinksRuletrue

This parameter is only interpreted, when the parameter pathlinks is set to a rule (can also be just true/false). The rule will have portal, portlet and object (current link target) available. Per default this is always true . By setting this to a rule evaluating to false , inclusion of the node_id into the generated “PLinks” (Section 4.6) can be disabled. Note that when the node_id is not used to identify the linked content object, the link may not unique, when content objects from multiple nodes are all contained in the same content repository.

max-ageExpression5184000

This parameter controls the value of the response header Cache-Control:max-age=[value] when returning binary data. The value must be an Expression, that evaluates to an Integer (in Seconds). In the expression, all attributes of the content object are available.

Examples:

  1. 86400 for statically caching one day.
  2. if(mimetype LIKE 'image/%', 3600, 86400) for caching images for an hour, everything else for a day.

Since fetching content from Gentics Content.Node 5 requires a valid Gentics Content.Node 5 Session, this will only work, when the Portal User has logged in and was authenticated via a “GCNAuthenticationManager” (Section 8.3.7) .

5.4. Additional Events of the GenticsContentPortlet

Additionally to the Events described for the GenticsContentModule, the GenticsContentPortlet will throw the following events:

Table 5.12. Events of the GenticsContentPortlet

NameDescriptionEvent properties
onContentLoadErrorThis event is triggered when a content cannot be loaded (either from the datasource or from the backend) due to an error in the underlying system.
NameDescription
contentidThe contentid of the content which could not be loaded

5.5. Setting a specific channel ID

The GenticsContentPortlet can handle “PLinks” (Section 4.6) with the channelid attribute. It will render an action URL with the channelid parameter, which will in turn trigger an onSelect event. The channel for the datasource has be set in the coresponding reaction.

Example 5.3. Example onSelect reaction

	do (
		portal.modules.contentportlet.parameters.contentid = event.properties.contentid,
		if (!isempty(event.properties.channelid), portal.datasources.mccrds.channel = event.properties.channelid)
	)
				

The onSelect event triggered by the GenticsContentPortlet will look like this:

Table 5.13. Events of the GenticsContentPortlet

NameDescriptionEvent properties
onSelectThis event is triggered every time a contentlink is requested.
NameDescription
contentid The contentid if the linktarget, which was requested. May also be accessed using the portal property event.properties.contentid.
channelid The channel id of the linktarget. May also be accessed using the portal property event.properties.channelid. (Optional)