Class DefaultContentPathConstraintProcessor

  • All Implemented Interfaces:
    ContentPathConstraintProcessor

    public class DefaultContentPathConstraintProcessor
    extends Object
    implements ContentPathConstraintProcessor
    This class enforces constraints on content paths. At the minimum, content paths must adhere to the following constraints:
    • Cannot have a leading OR trailing /
    • Cannot contain the following filenames: '.', '..'
    • Cannot contain an empty filename
    • Windows only: Cannot contain a \

    Additional custom constraints may be applied as needed.

    • Constructor Detail

      • DefaultContentPathConstraintProcessor

        public DefaultContentPathConstraintProcessor​(PathConstraintProcessor storagePathConstraintProcessor,
                                                     PathConstraintProcessor contentPathConstraintProcessor)
        Constructs a new ContentPathConstraintProcessor. Alternatively, use DefaultContentPathConstraintProcessor.Builder.
        Parameters:
        storagePathConstraintProcessor - the constraints to apply to storage paths
        contentPathConstraintProcessor - the constraints to apply to content paths
    • Method Detail

      • apply

        public void apply​(String contentPath,
                          String storagePath)
        Applies the configured path constrains to the content path and storage path. If any constraints fail, a PathConstraintException is thrown.
        Specified by:
        apply in interface ContentPathConstraintProcessor
        Parameters:
        contentPath - the content path relative a version's content directory
        storagePath - the content path relative the OCFL repository root