Options
All
  • Public
  • Public/Protected
  • All
Menu

Supports the behaviour described in https://www.w3.org/DesignIssues/HTTPFilenameMapping.html Determines content-type based on the file extension. In case an identifier does not end on an extension matching its content-type, the corresponding file will be appended with the correct extension, preceded by $.

Hierarchy

Index

Constructors

constructor

  • new ExtensionBasedMapper(base: string, rootFilepath: string, customTypes?: Record<string, string>): ExtensionBasedMapper

Properties

Protected Readonly baseRequestURI

baseRequestURI: string

Private Readonly customExtensions

customExtensions: Record<string, string>

Private Readonly customTypes

customTypes: Record<string, string>

Protected Readonly logger

logger: Logger = ...

Protected Readonly rootFilepath

rootFilepath: string

Methods

Protected getAbsolutePath

  • getAbsolutePath(path: string): string

Protected getContainerUrl

  • getContainerUrl(relative: string): Promise<string>

Protected getContentTypeFromPath

  • getContentTypeFromPath(filePath: string): Promise<string>

Protected getContentTypeFromUrl

  • getContentTypeFromUrl(identifier: ResourceIdentifier, contentType?: string): Promise<string>

Protected getDocumentUrl

  • getDocumentUrl(relative: string): Promise<string>

Protected getRelativePath

Protected isMetadataPath

  • isMetadataPath(path: string): boolean

mapFilePathToUrl

  • mapFilePathToUrl(filePath: string, isContainer: boolean): Promise<ResourceLink>

Protected mapUrlToContainerPath

Protected mapUrlToDocumentPath

mapUrlToFilePath

Protected stripExtension

  • stripExtension(path: string): string
  • Helper function that removes the internal extension, one starting with $., from the given path. Nothing happens if no such extension is present.

    Parameters

    • path: string

    Returns string

Protected validateRelativePath