Magnolia 5.3 reached end of life on June 30, 2017. This branch is no longer supported, see End-of-life policy.

Page tree
Skip to end of metadata
Go to start of metadata

This page is about Magnolia 5.3+ / DAM 2.0+. The way assets are registered and used has changed. If you work with Magnolia 5.2.x or earlier, see Digital Asset Management module 1.x .

The Dam Core module provides core functionality for the DAM.

The module is configured in /modules/dam. The DamCoreConfiguration class creates a configuration bean to register asset providers and renderers, and configure the download servlet.

Asset providers and renderers

Asset providers and renderers are typically provided by other modules and registered in the DAM Core module configuration in /modules/dam/config/providers and /renderers.

Node nameValue

 modules

 

 dam

 

 config

 

 contentDisposition

 

 providers

 

 jcrProvider

 

 class

info.magnolia.dam.jcr.JcrAssetProvider

 identifier

 jcr

 renderers

 

 stkJcrRenderer

 

 class

info.magnolia.module.templatingkit.dam.STKAssetRenderer

 enforceDocumentMimeType

true

Nodes and properties:

  • providers:
    • jcrProvider:
      • class JcrAssetProvider delivers assets for the dam workspace. See JCR API for more.
      • identifier: jcr is the JCR asset provider identifier.
  • renderers:

Content disposition

You can configure the handling of content disposition headers in the DAM in /modules/dam/config/contentDisposition.

By default the DAM is configured to not serve the Content-Disposition header for flash and video files. All other content is served with the Content-Disposition header enabled by default. If you need to disable serving content with Content-Disposition header for other content types, add their MIME types to /dam/config/contentDisposition/contentType/rejected.

Node nameValue

 modules

 

 dam

 

 config

 

 contentDisposition

 

 contentType

 

 rejected

 

 1

application/x-shockwave-flash

 2

video/mp4 

 class

info.magnolia.voting.voters.ResponseContentTypeVoter

 class

info.magnolia.voting.voters.VoterSet

Nodes and properties:

  • contentDisposition: Defines content disposition header exceptions.
    • contentType: Arbitrary node name
      • rejected: Content map of MIME types for which content disposition headers are not served.
      • class: ResponseContentTypeVoter is a voter that checks the content type set on the response object against a list of allowed and/or rejected content types. It is typed to Object, as it can vote on both a passed HttpServletRequest, or the current MgnlContext.webContext, if any.
    • class VoterSet supports a set of voters. The voting can be set, as well the returned level. If the level is not set (0) the votings result is returned.

Disabling content disposition headers based on path

To disable serving Content-Disposition headers based on path follow these steps:

  1. Create a new node inline under contentDisposition.
  2. Under the new content node, create three property nodes:
    • class and set the value to info.magnolia.voting.voters.URIStartsWithVoter.
    • not and set the value to true.
    • pattern and set the value to /dam/inline.
  3. Under the contentDisposition node add an op property and set the value to and. This acts as an operator between voters and is only necessary if there you have more than one voter in the set.

This will configure all files in folder inline to be sent without content disposition headers. The new content node should look like this:

Node nameValue

 contentDisposition

 

 contentType

 

 inline

 

 class

info.magnolia.voting.voters.URIStartsWithVoter

 not

true

 pattern

/dam/inline

 class

info.magnolia.voting.voters.VoterSet

 op

and

Download servlet

DamDownloadServlet handles asset downloads. The main task is to retrieve an Asset Object based on the current URI:

  • If no Asset is found, an error is sent to the response.
  • If an Asset is found, the response header is set and the asset binary is put in the response.

The servlet is backwards compatible and maps static UUIDs to the new DAM format.

DamDownloadServlet is registered in the filter chain at /server/filters/servlets/DamDownloadServlet.

Node nameValue

 server

 

 filters

 

 context

 

 ...

 

 servlets

 

 ClasspathSpoolServlet

 

 log4j

 

 DamDownloadServlet

 

 mappings

 

 -dam--

 

 pattern

/dam/*

 -dam-static--

 

 pattern

/dam-static/*

 parameters

 

 class

info.magnolia.cms.filters.ServletDispatchingFilter

 comment

DAM download servlet 

 enabled

true

 servletClass

info.magnolia.dam.core.download.DamDownloadServlet 

 servletName

DamDownloadServlet

URI to repository mapping

The URI2RepositoryMapping mechanism determines which repository node should be served when a particular URI is requested.

The mapping for the dam workspace is configured in /server/URI2RepositoryMapping/mappings/dam.

Node nameValue

 server

 

 filters

 

 ...

 

 URI2RepositoryMapping

 

 mappings

 

 website

 

 dam

 

 URIPrefix

/dam/

 class

info.magnolia.dam.core.link.DamURI2RepositoryMapping 

 handlePrefix

-

 repository

dam

Properties:

  • class: DamURI2RepositoryMapping returns a link to the binary of the asset represented by the incoming link.