Package spark.staticfiles
Class StaticFilesConfiguration
- java.lang.Object
-
- spark.staticfiles.StaticFilesConfiguration
-
public class StaticFilesConfiguration extends java.lang.Object
Holds the static file configuration. TODO: ETAG ?
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.String>
customHeaders
private boolean
externalStaticResourcesSet
private org.slf4j.Logger
LOG
static StaticFilesConfiguration
servletInstance
private java.util.List<AbstractResourceHandler>
staticResourceHandlers
private boolean
staticResourcesSet
-
Constructor Summary
Constructors Constructor Description StaticFilesConfiguration()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears all static file configurationvoid
configure(java.lang.String folder)
Configures location for static resourcesvoid
configureExternal(java.lang.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
isExternalStaticResourcesSet()
boolean
isStaticResourcesSet()
void
putCustomHeader(java.lang.String key, java.lang.String value)
void
putCustomHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
void
setExpireTimeSeconds(long expireTimeSeconds)
-
-
-
Field Detail
-
LOG
private final org.slf4j.Logger LOG
-
staticResourceHandlers
private java.util.List<AbstractResourceHandler> staticResourceHandlers
-
staticResourcesSet
private boolean staticResourcesSet
-
externalStaticResourcesSet
private boolean externalStaticResourcesSet
-
servletInstance
public static StaticFilesConfiguration servletInstance
-
customHeaders
private java.util.Map<java.lang.String,java.lang.String> customHeaders
-
-
Method Detail
-
consume
public boolean consume(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws java.io.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:
java.io.IOException
- in case of IO error.
-
consumeWithFileResourceHandlers
private boolean consumeWithFileResourceHandlers(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws java.io.IOException
- Throws:
java.io.IOException
-
clear
public void clear()
Clears all static file configuration
-
isStaticResourcesSet
public boolean isStaticResourcesSet()
-
isExternalStaticResourcesSet
public boolean isExternalStaticResourcesSet()
-
configure
public void configure(java.lang.String folder)
Configures location for static resources- Parameters:
folder
- the location
-
configureExternal
public void configureExternal(java.lang.String folder)
Configures location for static resources- Parameters:
folder
- the location
-
create
public static StaticFilesConfiguration create()
-
setExpireTimeSeconds
public void setExpireTimeSeconds(long expireTimeSeconds)
-
putCustomHeaders
public void putCustomHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
-
putCustomHeader
public void putCustomHeader(java.lang.String key, java.lang.String value)
-
-