Package spark.staticfiles
Class StaticFilesConfiguration
java.lang.Object
spark.staticfiles.StaticFilesConfiguration
Holds the static file configuration.
TODO: ETAG ?
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private final org.slf4j.Logger
static StaticFilesConfiguration
private List
<AbstractResourceHandler> private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears all static file configurationvoid
Configures location for static resourcesvoid
configureExternal
(String folder) Configures location for static resourcesboolean
consume
(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) Attempt consuming using either static resource handlers or jar resource handlersprivate boolean
consumeWithFileResourceHandlers
(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) static StaticFilesConfiguration
create()
boolean
boolean
void
putCustomHeader
(String key, String value) void
putCustomHeaders
(Map<String, String> headers) void
setExpireTimeSeconds
(long expireTimeSeconds)
-
Field Details
-
LOG
private final org.slf4j.Logger LOG -
staticResourceHandlers
-
staticResourcesSet
private boolean staticResourcesSet -
externalStaticResourcesSet
private boolean externalStaticResourcesSet -
servletInstance
-
customHeaders
-
-
Constructor Details
-
StaticFilesConfiguration
public StaticFilesConfiguration()
-
-
Method Details
-
consume
public boolean consume(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws IOException Attempt consuming using either static resource handlers or jar resource handlers- Parameters:
httpRequest
- The HTTP servlet request.httpResponse
- The HTTP servlet response.- Returns:
- true if consumed, false otherwise.
- Throws:
IOException
- in case of IO error.
-
consumeWithFileResourceHandlers
private boolean consumeWithFileResourceHandlers(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws IOException - Throws:
IOException
-
clear
public void clear()Clears all static file configuration -
isStaticResourcesSet
public boolean isStaticResourcesSet() -
isExternalStaticResourcesSet
public boolean isExternalStaticResourcesSet() -
configure
Configures location for static resources- Parameters:
folder
- the location
-
configureExternal
Configures location for static resources- Parameters:
folder
- the location
-
create
-
setExpireTimeSeconds
public void setExpireTimeSeconds(long expireTimeSeconds) -
putCustomHeaders
-
putCustomHeader
-