Interface IAppDirectory
- All Known Implementing Classes:
AppDirectory
/app/<appID>/ of one application, as the server builds it and AppDirectoryHandler serves it (work order CC-PWA-V5A-APPDIR-ROUTE, design CC-DESIGN-APP-URL-V2 section 2.4): the generated application page per language, with the stamp of the directory and the time the stamp was first built.An instance is immutable. The server holds one per application factory, built at the first request, so a hot deploy - which builds a new factory - discards it by construction; the handler never caches one. The pages are the generator's output, complete but for the three substitutions the handler makes per response: the client gate's appID marker, the Web Analytics line, and the registration of the application's Service Worker.
Beside the pages, the directory holds its generated files (work order CC-PWA-V5E-APPDIR-PWA, design section 2.2): the Service Worker sw.js and the offline page offline.html of every application, and the manifest per language (manifest-<lang>.webmanifest, or manifest.webmanifest without a language), the icons - any, maskable and monochrome in 192 and 512 px and the Apple touch icon - and the screenshots (screenshots/<name>) of an installable one (CC-PUSH-PWA-PAGES Set I). They are generated with the pages, so the stamp covers them, and the handler serves them as they are.
- Author:
- Christopher Mindus
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordA generated file of the directory: its media type, its bytes, and itsmax-age, zero forno-cache.Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThemax-ageof an icon in seconds, one day (design 2.4): every other file of the directory isno-cache.Method Summary
Modifier and TypeMethodDescriptiongetAppID()Gets the canonical application ID of the directory: the ID the application was registered under, never an alias.default IAppDirectory.GeneratedFileGets a generated file of the directory by its name directly under the directory.Gets the application page for a language.getStamp()Gets the stampvof the directory: the first 16 hexadecimal digits of SHA-256 over the generated bytes of every file of the directory and the server's version and build.longGets the time the stamp was first built, theLast-Modifiedof every file of the directory.
Field Details
ICON_MAX_AGE
static final int ICON_MAX_AGEThemax-ageof an icon in seconds, one day (design 2.4): every other file of the directory isno-cache.- See Also:
Method Details
getAppID
String getAppID()Gets the canonical application ID of the directory: the ID the application was registered under, never an alias. The handler redirects an alias to it.- Returns:
- The application ID, never null nor empty.
getStamp
String getStamp()Gets the stampvof the directory: the first 16 hexadecimal digits of SHA-256 over the generated bytes of every file of the directory and the server's version and build. Two directories with the same pages on the same build have the same stamp; one byte of difference gives another. It is the first half of every ETag the handler sends.- Returns:
- The stamp, 16 lower-case hexadecimal digits.
getVersionTime
long getVersionTime()Gets the time the stamp was first built, theLast-Modifiedof every file of the directory.- Returns:
- The time in milliseconds since the Epoch, whole seconds.
getPage
getFile
Gets a generated file of the directory by its name directly under the directory.- Parameters:
name- The name:sw.js,offline.html,manifest-<lang>.webmanifest(ormanifest.webmanifest), one of the icon names, orscreenshots/<file>.lang- The language code from thelangentry parameter, null or empty for the default language: it selects the language of a file that is served in several languages under one name - the offline page, whose answer for a language the application does not have is the default language's - and is ignored for the others.- Returns:
- The file, or null when the directory holds none of that name: the manifest and the icons of an application without
.iiziPWA, a manifest of another language, or a directory without generated files, which is what this default answers.