Class StaticResourceBuilderDefault<R extends org.spincast.core.exchange.RequestContext<?>,W extends org.spincast.core.websocket.WebsocketContext<?>>

java.lang.Object
org.spincast.plugins.routing.StaticResourceBuilderDefault<R,W>
All Implemented Interfaces:
org.spincast.core.routing.StaticResourceBuilder<R>

public class StaticResourceBuilderDefault<R extends org.spincast.core.exchange.RequestContext<?>,W extends org.spincast.core.websocket.WebsocketContext<?>> extends Object implements org.spincast.core.routing.StaticResourceBuilder<R>
  • Field Details

    • logger

      protected static final org.slf4j.Logger logger
  • Constructor Details

    • StaticResourceBuilderDefault

      public StaticResourceBuilderDefault(boolean isDir, org.spincast.core.routing.StaticResourceFactory<R> staticResourceFactory, StaticResourceCorsConfigFactory staticResourceCorsConfigFactory, StaticResourceCacheConfigFactory staticResourceCacheConfigFactory, org.spincast.core.config.SpincastConfig spincastConfig, org.spincast.core.utils.SpincastUtils spincastUtils, SpincastRouterConfig spincastRouterConfig)
    • StaticResourceBuilderDefault

      public StaticResourceBuilderDefault(org.spincast.core.routing.Router<R,W> router, boolean isDir, org.spincast.core.routing.StaticResourceFactory<R> staticResourceFactory, StaticResourceCorsConfigFactory staticResourceCorsConfigFactory, StaticResourceCacheConfigFactory staticResourceCacheConfigFactory, org.spincast.core.config.SpincastConfig spincastConfig, org.spincast.core.utils.SpincastUtils spincastUtils, SpincastRouterConfig spincastRouterConfig)
  • Method Details

    • isDir

      protected boolean isDir()
    • isSpicastOrPluginAddedResource

      protected boolean isSpicastOrPluginAddedResource()
    • getRouter

      protected org.spincast.core.routing.Router<R,W> getRouter()
    • getStaticResourceFactory

      protected org.spincast.core.routing.StaticResourceFactory<R> getStaticResourceFactory()
    • getStaticResourceCorsConfigFactory

      protected StaticResourceCorsConfigFactory getStaticResourceCorsConfigFactory()
    • getStaticResourceCacheConfigFactory

      protected StaticResourceCacheConfigFactory getStaticResourceCacheConfigFactory()
    • getSpincastConfig

      protected org.spincast.core.config.SpincastConfig getSpincastConfig()
    • getSpincastUtils

      protected org.spincast.core.utils.SpincastUtils getSpincastUtils()
    • getSpincastRouterConfig

      protected SpincastRouterConfig getSpincastRouterConfig()
    • getUrl

      public String getUrl()
    • getPath

      public String getPath()
    • isHotlinkingProtected

      public boolean isHotlinkingProtected()
    • getHotlinkingManager

      public org.spincast.core.routing.hotlinking.HotlinkingManager getHotlinkingManager()
    • isClasspath

      public boolean isClasspath()
    • getGenerator

      public org.spincast.core.routing.Handler<R> getGenerator()
    • getCorsConfig

      public org.spincast.core.routing.StaticResourceCorsConfig getCorsConfig()
    • getCacheConfig

      public org.spincast.core.routing.StaticResourceCacheConfig getCacheConfig()
    • isIgnoreQueryString

      public boolean isIgnoreQueryString()
    • spicastOrPluginAddedResource

      public org.spincast.core.routing.StaticResourceBuilder<R> spicastOrPluginAddedResource()
      Specified by:
      spicastOrPluginAddedResource in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • url

      public org.spincast.core.routing.StaticResourceBuilder<R> url(String url)
      Specified by:
      url in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • classpath

      public org.spincast.core.routing.StaticResourceBuilder<R> classpath(String path)
      Specified by:
      classpath in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • pathAbsolute

      public org.spincast.core.routing.StaticResourceBuilder<R> pathAbsolute(String absolutePath)
      Specified by:
      pathAbsolute in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • pathRelative

      public org.spincast.core.routing.StaticResourceBuilder<R> pathRelative(String relativePath)
      Specified by:
      pathRelative in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • cors

      public org.spincast.core.routing.StaticResourceBuilder<R> cors()
      Specified by:
      cors in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • cors

      public org.spincast.core.routing.StaticResourceBuilder<R> cors(Set<String> allowedOrigins)
      Specified by:
      cors in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • cors

      public org.spincast.core.routing.StaticResourceBuilder<R> cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead)
      Specified by:
      cors in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • cors

      public org.spincast.core.routing.StaticResourceBuilder<R> cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent)
      Specified by:
      cors in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • cors

      public org.spincast.core.routing.StaticResourceBuilder<R> cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent, boolean allowCookies)
      Specified by:
      cors in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • cors

      public org.spincast.core.routing.StaticResourceBuilder<R> cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent, boolean allowCookies, int maxAgeInSeconds)
      Specified by:
      cors in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • getCorsDefaultMaxAgeInSeconds

      protected int getCorsDefaultMaxAgeInSeconds()
      If <= 0, the "Access-Control-Max-Age" header won't be sent.
    • getCorsDefaultAllowedOrigins

      protected Set<String> getCorsDefaultAllowedOrigins()
      The origins allowed, by default.
    • getCorsDefaultExtraHeadersAllowedToBeRead

      protected Set<String> getCorsDefaultExtraHeadersAllowedToBeRead()
      The extra headers allowed to be read, by default,
    • getCorsDefaultExtraHeadersAllowedToBeSent

      protected Set<String> getCorsDefaultExtraHeadersAllowedToBeSent()
      The extra headers allowed to be sent, by default,
    • getCorsDefaultIsCookiesAllowed

      protected boolean getCorsDefaultIsCookiesAllowed()
      Are cookies allowed by default?
    • isCachePrivateDefault

      protected boolean isCachePrivateDefault()
      Is the cache private by default?
    • getCacheCdnSecondsDefault

      protected Integer getCacheCdnSecondsDefault()
    • cache

      public org.spincast.core.routing.StaticResourceBuilder<R> cache(int seconds)
      Specified by:
      cache in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • cache

      public org.spincast.core.routing.StaticResourceBuilder<R> cache(int seconds, boolean isCachePrivate)
      Specified by:
      cache in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • cache

      public org.spincast.core.routing.StaticResourceBuilder<R> cache(int seconds, boolean isCachePrivate, Integer cdnSeconds)
      Specified by:
      cache in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • handle

      public void handle()
      Specified by:
      handle in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • handle

      public void handle(org.spincast.core.routing.Handler<R> generator)
      Specified by:
      handle in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • handle

      public void handle(org.spincast.core.routing.Handler<R> generator, boolean ignoreQueryString)
      Specified by:
      handle in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • create

      public org.spincast.core.routing.StaticResource<R> create()
      Specified by:
      create in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • getDefaultCacheConfig

      protected org.spincast.core.routing.StaticResourceCacheConfig getDefaultCacheConfig()
      The default cache configurations to use if it is not specified. It can still be null and, in that case, no cache header will be used.
    • hotlinkingProtected

      public org.spincast.core.routing.StaticResourceBuilder<R> hotlinkingProtected()
      Specified by:
      hotlinkingProtected in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>
    • hotlinkingProtected

      public org.spincast.core.routing.StaticResourceBuilder<R> hotlinkingProtected(org.spincast.core.routing.hotlinking.HotlinkingManager hotlinkingManager)
      Specified by:
      hotlinkingProtected in interface org.spincast.core.routing.StaticResourceBuilder<R extends org.spincast.core.exchange.RequestContext<?>>