Class StaticHandlerImpl

java.lang.Object
cool.scx.web._hack.StaticHandlerImpl
All Implemented Interfaces:
io.vertx.core.Handler<io.vertx.ext.web.RoutingContext>, io.vertx.ext.web.handler.StaticHandler
Direct Known Subclasses:
SendFileHelper

public class StaticHandlerImpl extends Object implements io.vertx.ext.web.handler.StaticHandler
Copy From StaticHandlerImpl Make Some private to public so we can Override Static web server Parts derived from Yoke
Author:
Tim Fox, Paulo Lopes, Stephan Wissel
  • Field Summary

    Fields inherited from interface io.vertx.ext.web.handler.StaticHandler

    DEFAULT_ALWAYS_ASYNC_FS, DEFAULT_CACHE_ENTRY_TIMEOUT, DEFAULT_CACHING_ENABLED, DEFAULT_DIRECTORY_LISTING, DEFAULT_DIRECTORY_TEMPLATE, DEFAULT_ENABLE_FS_TUNING, DEFAULT_FILES_READ_ONLY, DEFAULT_INCLUDE_HIDDEN, DEFAULT_INDEX_PAGE, DEFAULT_MAX_AGE_SECONDS, DEFAULT_MAX_AVG_SERVE_TIME_NS, DEFAULT_MAX_CACHE_SIZE, DEFAULT_RANGE_SUPPORT, DEFAULT_ROOT_FILESYSTEM_ACCESS, DEFAULT_SEND_VARY_HEADER, DEFAULT_WEB_ROOT
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor with DEFAULT_WEB_ROOT and relative file access only
    StaticHandlerImpl(io.vertx.ext.web.handler.FileSystemAccess visibility, String staticRootDirectory)
    Constructor called by static factory method
  • Method Summary

    Modifier and Type
    Method
    Description
    getFile(String path, io.vertx.ext.web.RoutingContext context)
     
    void
    handle(io.vertx.ext.web.RoutingContext context)
     
    void
    sendStatic(io.vertx.ext.web.RoutingContext context, io.vertx.core.file.FileSystem fileSystem, String path, boolean index)
    Can be called recursive for index pages
    io.vertx.ext.web.handler.StaticHandler
    setAllowRootFileSystemAccess(boolean allowRootFileSystemAccess)
    Deprecated.
    - Use the parameters in constructor
    io.vertx.ext.web.handler.StaticHandler
    setAlwaysAsyncFS(boolean alwaysAsyncFS)
     
    io.vertx.ext.web.handler.StaticHandler
    setCacheEntryTimeout(long timeout)
     
    io.vertx.ext.web.handler.StaticHandler
    setCachingEnabled(boolean enabled)
     
    io.vertx.ext.web.handler.StaticHandler
     
    io.vertx.ext.web.handler.StaticHandler
    setDirectoryListing(boolean directoryListing)
     
    io.vertx.ext.web.handler.StaticHandler
    setDirectoryTemplate(String directoryTemplate)
     
    io.vertx.ext.web.handler.StaticHandler
    setEnableFSTuning(boolean enableFSTuning)
     
    io.vertx.ext.web.handler.StaticHandler
    setEnableRangeSupport(boolean enableRangeSupport)
     
    io.vertx.ext.web.handler.StaticHandler
    setFilesReadOnly(boolean readOnly)
     
    io.vertx.ext.web.handler.StaticHandler
    setHttp2PushMapping(List<io.vertx.ext.web.Http2PushMapping> http2PushMap)
     
    io.vertx.ext.web.handler.StaticHandler
    setIncludeHidden(boolean includeHidden)
     
    io.vertx.ext.web.handler.StaticHandler
    setIndexPage(String indexPage)
     
    io.vertx.ext.web.handler.StaticHandler
    setMaxAgeSeconds(long maxAgeSeconds)
     
    io.vertx.ext.web.handler.StaticHandler
    setMaxAvgServeTimeNs(long maxAvgServeTimeNanoSeconds)
     
    io.vertx.ext.web.handler.StaticHandler
    setMaxCacheSize(int maxCacheSize)
     
    io.vertx.ext.web.handler.StaticHandler
    setSendVaryHeader(boolean sendVaryHeader)
     
    io.vertx.ext.web.handler.StaticHandler
    setWebRoot(String webRoot)
    Deprecated.
    - Use the parameters in constructor
    io.vertx.ext.web.handler.StaticHandler
     
    io.vertx.ext.web.handler.StaticHandler
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StaticHandlerImpl

      public StaticHandlerImpl(io.vertx.ext.web.handler.FileSystemAccess visibility, String staticRootDirectory)
      Constructor called by static factory method
      Parameters:
      visibility - path specified by root is RELATIVE or ROOT
      staticRootDirectory - path on host with static file location
    • StaticHandlerImpl

      public StaticHandlerImpl()
      Default constructor with DEFAULT_WEB_ROOT and relative file access only
  • Method Details

    • handle

      public void handle(io.vertx.ext.web.RoutingContext context)
      Specified by:
      handle in interface io.vertx.core.Handler<io.vertx.ext.web.RoutingContext>
    • sendStatic

      public void sendStatic(io.vertx.ext.web.RoutingContext context, io.vertx.core.file.FileSystem fileSystem, String path, boolean index)
      Can be called recursive for index pages
    • setAllowRootFileSystemAccess

      @Deprecated public io.vertx.ext.web.handler.StaticHandler setAllowRootFileSystemAccess(boolean allowRootFileSystemAccess)
      Deprecated.
      - Use the parameters in constructor
      Specified by:
      setAllowRootFileSystemAccess in interface io.vertx.ext.web.handler.StaticHandler
    • setWebRoot

      @Deprecated public io.vertx.ext.web.handler.StaticHandler setWebRoot(String webRoot)
      Deprecated.
      - Use the parameters in constructor
      Specified by:
      setWebRoot in interface io.vertx.ext.web.handler.StaticHandler
    • setFilesReadOnly

      public io.vertx.ext.web.handler.StaticHandler setFilesReadOnly(boolean readOnly)
      Specified by:
      setFilesReadOnly in interface io.vertx.ext.web.handler.StaticHandler
    • setMaxAgeSeconds

      public io.vertx.ext.web.handler.StaticHandler setMaxAgeSeconds(long maxAgeSeconds)
      Specified by:
      setMaxAgeSeconds in interface io.vertx.ext.web.handler.StaticHandler
    • setMaxCacheSize

      public io.vertx.ext.web.handler.StaticHandler setMaxCacheSize(int maxCacheSize)
      Specified by:
      setMaxCacheSize in interface io.vertx.ext.web.handler.StaticHandler
    • setCachingEnabled

      public io.vertx.ext.web.handler.StaticHandler setCachingEnabled(boolean enabled)
      Specified by:
      setCachingEnabled in interface io.vertx.ext.web.handler.StaticHandler
    • setDirectoryListing

      public io.vertx.ext.web.handler.StaticHandler setDirectoryListing(boolean directoryListing)
      Specified by:
      setDirectoryListing in interface io.vertx.ext.web.handler.StaticHandler
    • setDirectoryTemplate

      public io.vertx.ext.web.handler.StaticHandler setDirectoryTemplate(String directoryTemplate)
      Specified by:
      setDirectoryTemplate in interface io.vertx.ext.web.handler.StaticHandler
    • setEnableRangeSupport

      public io.vertx.ext.web.handler.StaticHandler setEnableRangeSupport(boolean enableRangeSupport)
      Specified by:
      setEnableRangeSupport in interface io.vertx.ext.web.handler.StaticHandler
    • setIncludeHidden

      public io.vertx.ext.web.handler.StaticHandler setIncludeHidden(boolean includeHidden)
      Specified by:
      setIncludeHidden in interface io.vertx.ext.web.handler.StaticHandler
    • setCacheEntryTimeout

      public io.vertx.ext.web.handler.StaticHandler setCacheEntryTimeout(long timeout)
      Specified by:
      setCacheEntryTimeout in interface io.vertx.ext.web.handler.StaticHandler
    • setIndexPage

      public io.vertx.ext.web.handler.StaticHandler setIndexPage(String indexPage)
      Specified by:
      setIndexPage in interface io.vertx.ext.web.handler.StaticHandler
    • setAlwaysAsyncFS

      public io.vertx.ext.web.handler.StaticHandler setAlwaysAsyncFS(boolean alwaysAsyncFS)
      Specified by:
      setAlwaysAsyncFS in interface io.vertx.ext.web.handler.StaticHandler
    • setHttp2PushMapping

      public io.vertx.ext.web.handler.StaticHandler setHttp2PushMapping(List<io.vertx.ext.web.Http2PushMapping> http2PushMap)
      Specified by:
      setHttp2PushMapping in interface io.vertx.ext.web.handler.StaticHandler
    • skipCompressionForMediaTypes

      public io.vertx.ext.web.handler.StaticHandler skipCompressionForMediaTypes(Set<String> mediaTypes)
      Specified by:
      skipCompressionForMediaTypes in interface io.vertx.ext.web.handler.StaticHandler
    • skipCompressionForSuffixes

      public io.vertx.ext.web.handler.StaticHandler skipCompressionForSuffixes(Set<String> fileSuffixes)
      Specified by:
      skipCompressionForSuffixes in interface io.vertx.ext.web.handler.StaticHandler
    • setEnableFSTuning

      public io.vertx.ext.web.handler.StaticHandler setEnableFSTuning(boolean enableFSTuning)
      Specified by:
      setEnableFSTuning in interface io.vertx.ext.web.handler.StaticHandler
    • setMaxAvgServeTimeNs

      public io.vertx.ext.web.handler.StaticHandler setMaxAvgServeTimeNs(long maxAvgServeTimeNanoSeconds)
      Specified by:
      setMaxAvgServeTimeNs in interface io.vertx.ext.web.handler.StaticHandler
    • setSendVaryHeader

      public io.vertx.ext.web.handler.StaticHandler setSendVaryHeader(boolean sendVaryHeader)
      Specified by:
      setSendVaryHeader in interface io.vertx.ext.web.handler.StaticHandler
    • setDefaultContentEncoding

      public io.vertx.ext.web.handler.StaticHandler setDefaultContentEncoding(String contentEncoding)
      Specified by:
      setDefaultContentEncoding in interface io.vertx.ext.web.handler.StaticHandler
    • getFile

      public String getFile(String path, io.vertx.ext.web.RoutingContext context)