-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
daceb0e
commit 2f1c463
Showing
15 changed files
with
215 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
blade-core/src/main/java/com/hellokaton/blade/options/StaticOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.hellokaton.blade.options; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
@Getter | ||
@Setter | ||
public class StaticOptions { | ||
|
||
public static final int DEFAULT_CACHE_SECONDS = 86400 * 30; | ||
public static final Set<String> DEFAULT_STATICS = new HashSet<>( | ||
Arrays.asList("/favicon.ico", "/robots.txt", "/static", "/webjars/")); | ||
|
||
private boolean showList; | ||
private Set<String> paths = DEFAULT_STATICS; | ||
private int cacheSeconds = DEFAULT_CACHE_SECONDS; | ||
|
||
public static StaticOptions create() { | ||
return new StaticOptions(); | ||
} | ||
|
||
public StaticOptions showList() { | ||
this.showList = true; | ||
return this; | ||
} | ||
|
||
public StaticOptions addStatic(String staticPath) { | ||
this.paths.add(staticPath); | ||
return this; | ||
} | ||
|
||
public StaticOptions removeStatic(String staticPath) { | ||
this.paths.remove(staticPath); | ||
return this; | ||
} | ||
|
||
public StaticOptions cacheSeconds(int cacheSeconds) { | ||
this.cacheSeconds = cacheSeconds; | ||
return this; | ||
} | ||
|
||
} |
Oops, something went wrong.