Package io.inversion.action.misc
Class FileAction<A extends FileAction>
- java.lang.Object
-
- io.inversion.Rule<A>
-
- io.inversion.Action<A>
-
- io.inversion.action.misc.FileAction<A>
-
- All Implemented Interfaces:
java.lang.Comparable<A>
public class FileAction<A extends FileAction> extends Action<A>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.inversion.Rule
Rule.RuleMatcher
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringbaseDirprotected java.util.Set<java.lang.String>files-
Fields inherited from class io.inversion.Rule
ALL_METHODS, configMap, description, excludeMatchers, excludeOn, includeMatchers, includeOn, log, name, order, params
-
-
Constructor Summary
Constructors Constructor Description FileAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanServe(java.lang.String filePath)voiddoGet(Request req, Response res)Handle an HTTP GET.protected java.io.InputStreamfindStream(java.lang.String filePath)java.lang.StringgetBaseDir()java.util.Set<java.lang.String>getFiles()protected voidserveFile(Request req, Response res)protected voidserveFile(Request req, Response res, java.lang.String filePath, boolean filterMode)FileActionwithBaseDir(java.lang.String baseDir)FileActionwithFiles(java.lang.String... files)-
Methods inherited from class io.inversion.Action
configureOp, doDelete, doPatch, doPost, doPut, getFullIncludePaths, getIncludePaths, isDecoration, joinPaths, joinPaths0, run, run0, withDecoration
-
Methods inherited from class io.inversion.Rule
afterWiringComplete, checkLazyConfig, compareTo, doLazyConfig, getAllExcludePaths, getAllIncludeMethods, getAllIncludePaths, getDefaultIncludeMatchers, getDescription, getExcludeMatchers, getIncludeMatchers, getName, getOrder, getParams, match, match, matches, matches, toString, withDescription, withExcludeOn, withExcludeOn, withIncludeOn, withIncludeOn, withName, withOrder, withParam, withParams
-
-
-
-
Method Detail
-
doGet
public void doGet(Request req, Response res) throws ApiException
Description copied from class:ActionHandle an HTTP GET.Override run() to handle all requests or override this method with your business logic specifically for a GET request
- Overrides:
doGetin classAction<A extends FileAction>- Parameters:
req- the request to runres- the response to populate- Throws:
ApiException
-
serveFile
protected void serveFile(Request req, Response res, java.lang.String filePath, boolean filterMode)
-
findStream
protected java.io.InputStream findStream(java.lang.String filePath)
-
canServe
public boolean canServe(java.lang.String filePath)
-
getBaseDir
public java.lang.String getBaseDir()
-
withBaseDir
public FileAction withBaseDir(java.lang.String baseDir)
-
getFiles
public java.util.Set<java.lang.String> getFiles()
-
withFiles
public FileAction withFiles(java.lang.String... files)
-
-