Class ServeStatic.Options
- java.lang.Object
-
- com.github.fmjsjx.libnetty.http.server.middleware.ServeStatic.Options
-
- Enclosing class:
- ServeStatic
public static class ServeStatic.Options extends java.lang.ObjectThe options ofServeStatic.- Since:
- 1.1
-
-
Constructor Summary
Constructors Constructor Description Options()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServeStatic.OptionsaddHeaders(java.util.function.Consumer<io.netty.handler.codec.http.HttpHeaders> addHeaders)Set the function set custom headers on response.ServeStatic.OptionscacheControl(java.lang.String cacheControl)Set cacheControl.ServeStatic.Optionsetag(boolean etag)Set ifE-TAGis enabled or not.ServeStatic.OptionsetagGenerator(ServeStatic.EtagGenerator etagGenerator)Set the function to generateE-TAGs.ServeStatic.Optionsindex(java.lang.String index)Set index.ServeStatic.Optionsindexes(java.lang.String... indexes)Set multiply indexes.ServeStatic.OptionslastModified(boolean lastModified)Set if headerlast-modifiedis enabled or not.ServeStatic.OptionsredirectDirectory(boolean redirectDirectory)Set if redirect to trailing "/" when the pathname is a directory or not.ServeStatic.OptionsshowHidden()Allow clients to access hidden files.ServeStatic.OptionsshowHidden(boolean showHidden)Set if clients are allowed to access hidden files.java.lang.StringtoString()
-
-
-
Method Detail
-
index
public ServeStatic.Options index(java.lang.String index)
Set index.- Parameters:
index- the filename of the index- Returns:
- this
Options
-
indexes
public ServeStatic.Options indexes(java.lang.String... indexes)
Set multiply indexes.- Parameters:
indexes- the array contains the filenames of the indexes- Returns:
- this
Options
-
showHidden
public ServeStatic.Options showHidden()
Allow clients to access hidden files.The default is
false.- Returns:
- this
Options
-
showHidden
public ServeStatic.Options showHidden(boolean showHidden)
Set if clients are allowed to access hidden files.The default is
false.- Parameters:
showHidden-trueto allow clients to access hidden files- Returns:
- this
Options
-
redirectDirectory
public ServeStatic.Options redirectDirectory(boolean redirectDirectory)
Set if redirect to trailing "/" when the pathname is a directory or not.The default is
true.- Parameters:
redirectDirectory-falseto disable- Returns:
- this
Options
-
cacheControl
public ServeStatic.Options cacheControl(java.lang.String cacheControl)
Set cacheControl.The default is
"no-cache".- Parameters:
cacheControl- the value of the cache-control- Returns:
- this
Options
-
etag
public ServeStatic.Options etag(boolean etag)
Set ifE-TAGis enabled or not.The default is
true.- Parameters:
etag-falseto disableE-TEGfeature- Returns:
- this
Options
-
etagGenerator
public ServeStatic.Options etagGenerator(ServeStatic.EtagGenerator etagGenerator)
Set the function to generateE-TAGs.The default is
ServeStatic.EtagGenerator.BASIC.- Parameters:
etagGenerator- the function to generateE-TAGs- Returns:
- this
Options
-
lastModified
public ServeStatic.Options lastModified(boolean lastModified)
Set if headerlast-modifiedis enabled or not.The default is
true.- Parameters:
lastModified-falseto disablelast-modifiedheader- Returns:
- this
Options
-
addHeaders
public ServeStatic.Options addHeaders(java.util.function.Consumer<io.netty.handler.codec.http.HttpHeaders> addHeaders)
Set the function set custom headers on response.- Parameters:
addHeaders- the function set custom headers on response- Returns:
- this
Options
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-