Package spark.staticfiles
Class StaticFilesConfiguration
- java.lang.Object
-
- spark.staticfiles.StaticFilesConfiguration
-
public class StaticFilesConfiguration extends java.lang.ObjectHolds the static file configuration. TODO: ETAG ?
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.String>customHeadersprivate booleanexternalStaticResourcesSetprivate org.slf4j.LoggerLOGstatic StaticFilesConfigurationservletInstanceprivate java.util.List<AbstractResourceHandler>staticResourceHandlersprivate booleanstaticResourcesSet
-
Constructor Summary
Constructors Constructor Description StaticFilesConfiguration()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears all static file configurationvoidconfigure(java.lang.String folder)Configures location for static resourcesvoidconfigureExternal(java.lang.String folder)Configures location for static resourcesbooleanconsume(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)Attempt consuming using either static resource handlers or jar resource handlersprivate booleanconsumeWithFileResourceHandlers(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)static StaticFilesConfigurationcreate()booleanisExternalStaticResourcesSet()booleanisStaticResourcesSet()voidputCustomHeader(java.lang.String key, java.lang.String value)voidputCustomHeaders(java.util.Map<java.lang.String,java.lang.String> headers)voidsetExpireTimeSeconds(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.IOExceptionAttempt 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)
-
-