Package com.nt.udc.filebrowser.service
Class FileService
java.lang.Object
com.nt.udc.filebrowser.service.FileService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatDateTime(long millis) Converts an epoch-millis timestamp to a human-readable "yyyy-MM-dd HH:mm:ss" string using the default time zone.static StringReturns a configured default path for the filebrowser.static booleanisWhitelisted(Path realPath) Determines whether the provided real path is under one of the configured allowed prefixes.static FileListResponselistFiles(FileListRequest request) Returns a list of files for the given request parameters.
-
Constructor Details
-
FileService
public FileService()
-
-
Method Details
-
isWhitelisted
Determines whether the provided real path is under one of the configured allowed prefixes.- Parameters:
realPath- absolute/normalized path- Returns:
- true if allowed, false otherwise
-
listFiles
Returns a list of files for the given request parameters.- Parameters:
request- request containing directory path, filters, and sorting options- Returns:
- file list response with requested details
- Throws:
FileBrowserException- if the directory cannot be accessed or processed
-
formatDateTime
Converts an epoch-millis timestamp to a human-readable "yyyy-MM-dd HH:mm:ss" string using the default time zone.- Parameters:
millis- epoch milliseconds- Returns:
- formatted timestamp string
-
getDefaultFilebrowserPath
Returns a configured default path for the filebrowser.- Returns:
- default path string
- Throws:
FileBrowserException- if default path is not configured or invalid
-