java.lang.Object
com.semanticcms.openfile.servlet.OpenFile
Opens files on the server-side.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Additional file openers may be registered to the application context.static class
Registers file openers during application start-up. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addFileOpener
(ServletContext servletContext, OpenFile.FileOpener fileOpener, String... extensions) Registers a file opener.static boolean
isAllowed
(ServletContext servletContext, ServletRequest request) Checks if the given request is allowed to open files on the server.static boolean
static void
openFile
(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, String book, String path) Opens a file on the server-side.static void
removeFileOpener
(ServletContext servletContext, String... extensions) Removes file openers.
-
Method Details
-
isAllowed
Checks if the given request is allowed to open files on the server. The servlet init param must have it enabled, as well as be from an allowed IP. -
isWindows
public static boolean isWindows() -
addFileOpener
public static void addFileOpener(ServletContext servletContext, OpenFile.FileOpener fileOpener, String... extensions) Registers a file opener.- Parameters:
extensions
- The simple extensions, in lowercase, not including the dot, such as "dia"
-
removeFileOpener
Removes file openers.- Parameters:
extensions
- The simple extensions, in lowercase, not including the dot, such as "dia"
-
openFile
public static void openFile(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, String book, String path) throws ServletException, IOException, SkipPageException Opens a file on the server-side.
-