Options
All
  • Public
  • Public/Protected
  • All
Menu

Extends the functionality of an ExtensionBasedMapper to support identifiers containing subdomains. This is mostly only relevant in case you want to support multiple pods with subdomain identifiers in a single ResourceStore.

When converting to/from file paths, the subdomain is interpreted as a folder in the rootFilePath. The rest of the path is then interpreted relative to that folder. E.g. http://alice.test.com/foo results in the relative path /alice/foo.

In case there is no subdomain in the URL, the baseSubdomain parameter is used instead. E.g., if the baseSubdomain is "www", http://test.com/foo would result in the relative path /www/foo. This means that there is no identifier that maps to the rootFilePath itself. To prevent the possibility of 2 identifiers linking to the same file, identifiers containing the default subdomain are rejected. E.g., http://www.test.com/foo would result in a 403, even if http://test.com/foo exists.

Hierarchy

Index

Constructors

constructor

  • new SubdomainExtensionBasedMapper(base: string, rootFilepath: string, baseSubdomain?: string, overrideTypes?: { acl: string; meta: string }): SubdomainExtensionBasedMapper

Properties

Private Readonly baseParts

baseParts: { rest: string; scheme: string }

Type declaration

  • rest: string
  • scheme: string

Protected Readonly baseRequestURI

baseRequestURI: string

Private Readonly baseSubdomain

baseSubdomain: string

Protected Readonly logger

logger: Logger = ...

Private Readonly regex

regex: RegExp

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

mapFilePathToUrl

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

Protected mapUrlToContainerPath

Protected mapUrlToDocumentPath

mapUrlToFilePath

Protected relativeToUrl

  • relativeToUrl(relative: string): string

Protected stripExtension

  • stripExtension(path: string): string

Protected validateRelativePath