Package org.spincast.plugins.routing
Class StaticResourceDefault<R extends RequestContext<?>>
java.lang.Object
org.spincast.plugins.routing.StaticResourceDefault<R>
- All Implemented Interfaces:
StaticResource<R>
public class StaticResourceDefault<R extends RequestContext<?>>
extends Object
implements StaticResource<R>
Represents a static resource.
-
Constructor Summary
ConstructorDescriptionStaticResourceDefault
(boolean isSpicastOrPluginAddedResource, StaticResourceType staticResourceType, String urlPath, String resourcePath, Handler<R> generator, StaticResourceCorsConfig corsConfig, StaticResourceCacheConfig cacheConfig, boolean ignoreQueryString, boolean hotlinkingProtected, HotlinkingManager hotlinkingManager, SpincastUtils spincastUtils, HotlinkingManagerDefault hotlinkingManagerDefault) -
Method Summary
Modifier and TypeMethodDescriptionThe cache configurations for the static resource.The cors configurations for the static resource.The generator to call to generate this resource if it doesn't exist yet.If a static resource is hotlinking protected (StaticResource.isHotlinkingProtected()
), then this is the component responsible to that protection.The path of the resource on the classpath or on the file system.protected SpincastUtils
The type of static resource.The URL to reach this static resource.boolean
Can this resource be generated?boolean
Is the resource on the classpath?boolean
Is the resource a directory?boolean
Is the resource a file?boolean
Is the resource on the file system?boolean
Is the resource hotlinking protected?boolean
Iftrue
, only one instance of the resource will be generated and cached.boolean
Is this a resource added by Spincast itself or by a plugin? Otherwise, the resource is considered as an application resource.toString()
-
Constructor Details
-
StaticResourceDefault
public StaticResourceDefault(boolean isSpicastOrPluginAddedResource, StaticResourceType staticResourceType, String urlPath, String resourcePath, @Nullable Handler<R> generator, @Nullable StaticResourceCorsConfig corsConfig, @Nullable StaticResourceCacheConfig cacheConfig, boolean ignoreQueryString, boolean hotlinkingProtected, @Nullable HotlinkingManager hotlinkingManager, SpincastUtils spincastUtils, HotlinkingManagerDefault hotlinkingManagerDefault)
-
-
Method Details
-
getSpincastUtils
-
isSpicastOrPluginAddedResource
public boolean isSpicastOrPluginAddedResource()Description copied from interface:StaticResource
Is this a resource added by Spincast itself or by a plugin? Otherwise, the resource is considered as an application resource.- Specified by:
isSpicastOrPluginAddedResource
in interfaceStaticResource<R extends RequestContext<?>>
-
getStaticResourceType
Description copied from interface:StaticResource
The type of static resource.- Specified by:
getStaticResourceType
in interfaceStaticResource<R extends RequestContext<?>>
-
getUrlPath
Description copied from interface:StaticResource
The URL to reach this static resource.- Specified by:
getUrlPath
in interfaceStaticResource<R extends RequestContext<?>>
-
getResourcePath
Description copied from interface:StaticResource
The path of the resource on the classpath or on the file system.- Specified by:
getResourcePath
in interfaceStaticResource<R extends RequestContext<?>>
-
isCanBeGenerated
public boolean isCanBeGenerated()Description copied from interface:StaticResource
Can this resource be generated?- Specified by:
isCanBeGenerated
in interfaceStaticResource<R extends RequestContext<?>>
-
getGenerator
Description copied from interface:StaticResource
The generator to call to generate this resource if it doesn't exist yet.- Specified by:
getGenerator
in interfaceStaticResource<R extends RequestContext<?>>
- Returns:
- the generator or
null
if there are none.
-
getCorsConfig
Description copied from interface:StaticResource
The cors configurations for the static resource.If
null
, cors won't be enabled for that resource.- Specified by:
getCorsConfig
in interfaceStaticResource<R extends RequestContext<?>>
-
getCacheConfig
Description copied from interface:StaticResource
The cache configurations for the static resource.If
null
, no caching headers will be sent, but the last modification-date of the resource will be validated and304 - Not modified
will be returned if applicable.- Specified by:
getCacheConfig
in interfaceStaticResource<R extends RequestContext<?>>
-
isFileResource
public boolean isFileResource()Description copied from interface:StaticResource
Is the resource a file?- Specified by:
isFileResource
in interfaceStaticResource<R extends RequestContext<?>>
-
isDirResource
public boolean isDirResource()Description copied from interface:StaticResource
Is the resource a directory?- Specified by:
isDirResource
in interfaceStaticResource<R extends RequestContext<?>>
-
isClasspath
public boolean isClasspath()Description copied from interface:StaticResource
Is the resource on the classpath?- Specified by:
isClasspath
in interfaceStaticResource<R extends RequestContext<?>>
-
isFileSytem
public boolean isFileSytem()Description copied from interface:StaticResource
Is the resource on the file system?- Specified by:
isFileSytem
in interfaceStaticResource<R extends RequestContext<?>>
-
isIgnoreQueryString
public boolean isIgnoreQueryString()Description copied from interface:StaticResource
Iftrue
, only one instance of the resource will be generated and cached. Iffalse
(the default), the resource will always be generated if there is a queryString.- Specified by:
isIgnoreQueryString
in interfaceStaticResource<R extends RequestContext<?>>
-
isHotlinkingProtected
public boolean isHotlinkingProtected()Description copied from interface:StaticResource
Is the resource hotlinking protected?- Specified by:
isHotlinkingProtected
in interfaceStaticResource<R extends RequestContext<?>>
-
getHotlinkingManager
Description copied from interface:StaticResource
If a static resource is hotlinking protected (StaticResource.isHotlinkingProtected()
), then this is the component responsible to that protection.Will be
null
if the resource is not hotlinking protected.- Specified by:
getHotlinkingManager
in interfaceStaticResource<R extends RequestContext<?>>
-
toString
-