Class Service.StaticFiles
java.lang.Object
spark.Service.StaticFiles
- Enclosing class:
Service
Provides static files utility methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDisables the automatic setting of Content-Type header made from a guess based on extension.voidexpireTime(long seconds) Sets the expire-time for static resourcesvoidexternalLocation(String externalFolder) Sets the external folder serving static files.voidPuts custom header for static resources.voidPuts custom headers for static resources.voidSets the folder in classpath serving static files.voidregisterMimeType(String extension, String mimeType) Maps an extension to a mime-type.
-
Constructor Details
-
StaticFiles
public StaticFiles()
-
-
Method Details
-
location
Sets the folder in classpath serving static files. Observe: this method must be called before all other methods.- Parameters:
folder- the folder in classpath.
-
externalLocation
Sets the external folder serving static files. Observe: this method must be called before all other methods.- Parameters:
externalFolder- the external folder serving static files.
-
headers
-
header
-
expireTime
public void expireTime(long seconds) Sets the expire-time for static resources- Parameters:
seconds- the expire time in seconds
-
registerMimeType
-
disableMimeTypeGuessing
public void disableMimeTypeGuessing()Disables the automatic setting of Content-Type header made from a guess based on extension.
-