Class StaticFileHandler
java.lang.Object
io.fluxzero.sdk.web.StaticFileHandler
- All Implemented Interfaces:
Closeable, AutoCloseable
Serves static resources with streamed bodies and content-based validators for the selected representation.
ETags are SHA-256 digests. Digests of immutable resources in JAR files opened by this handler are reused for
that open archive's lifetime, separately for each encoded representation. Other sources, including filesystem
overrides, exploded classpaths and externally resolved nested JARs, are read with bounded memory on every
request. This detects changed files even when size and modification time are preserved. Keep archives immutable
while open and other files stable until pending responses finish; prefer immutable, versioned asset paths.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final recordprotected static enum -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionStaticFileHandler(@NonNull String webRoot, Path fsBaseDirectory, URI resourceBaseUri, String fallbackFile, Set<String> ignorePaths, Set<String> immutableCandidateExtensions, long maxAgeSeconds) StaticFileHandler(@NonNull String webRoot, Path fsBaseDirectory, URI resourceBaseUri, String fallbackFile, Set<String> ignorePaths, Set<String> immutableCandidateExtensions, long maxAgeSeconds, boolean cleanUrls) StaticFileHandler(String webRoot) StaticFileHandler(String webRoot, String resourceBasePath) StaticFileHandler(String webRoot, String resourceBasePath, String fallbackFile) StaticFileHandler(String webRoot, String resourceBasePath, String fallbackFile, Set<String> immutableCandidateExtensions) StaticFileHandler(String webRoot, String resourceBasePath, String fallbackFile, Set<String> ignorePaths, Set<String> immutableCandidateExtensions, long maxAgeSeconds) StaticFileHandler(String webRoot, String resourceBasePath, String fallbackFile, Set<String> ignorePaths, Set<String> immutableCandidateExtensions, long maxAgeSeconds, boolean cleanUrls) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static List<StaticFileHandler> forTargetClass(Class<?> targetClass) static booleanprotected WebResponseserveStaticFile(String filePath, WebRequest request)
-
Field Details
-
classpathPrefix
- See Also:
-
filePrefix
- See Also:
-
-
Constructor Details
-
StaticFileHandler
public StaticFileHandler() -
StaticFileHandler
-
StaticFileHandler
-
StaticFileHandler
-
StaticFileHandler
-
StaticFileHandler
-
StaticFileHandler
-
StaticFileHandler
-
StaticFileHandler
-
-
Method Details
-
forTargetClass
-
isHandler
-
serveStaticFile
@HandleGet({"/{filePath:.+}*","","/"}) protected WebResponse serveStaticFile(String filePath, WebRequest request) -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-