Class StaticResourceServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
de.businesscode.bcdui.web.servlets.StaticResourceServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

public class StaticResourceServlet extends jakarta.servlet.http.HttpServlet
This class enables the use of the database-backed virtual file system and jar files as source for seemingly static resources. Normal static files are located on the filesystem within the webapps root, put there when the server extracts the app.war file. Static files are requested by /appContext/some/path/someFile.txt for example. This class makes files under such an address available, which really come from the database or a jar (and classpath in general) within the app.war instead. Main usage is the virtual file system and making BCD-UI static files like js and xslt available from bcd-ui-core.jar within app.war. The search order is: First vfs, then file system (on server this is normal file from the war), then jar files. Note: Since vfs caches the file list from the database (not the actual content), a lookup in vfs is no performance hit. <servlet> <servlet-name>staticResourceServlet</servlet-name> <servlet-class>de.businesscode.web.StaticResourceServlet</servlet-class> <init-param> <param-name>vfsFileExtensions</param-name> <!-- Extensions that can be overwritten in vfs --> <param-value>xml txt vfsxml pdf png gif jpg jpeg svg doc docx xls xlsx csv zip</param-value> </init-param> </servlet> <!-- Add any URL for the virtual file system here --> <servlet-mapping> <servlet-name>bcdui4.StaticResourceServlet</servlet-name> <url-pattern>/bcdui/*</url-pattern> <url-pattern>/vfs/*</url-pattern> <url-pattern>*.vfsxml</url-pattern> </servlet-mapping>
See Also:
  • Field Details

    • patternExports

      public static final Pattern patternExports
    • customElementsReplace1

      public static final Pattern customElementsReplace1
    • customElementsReplace2

      public static final Pattern customElementsReplace2
  • Constructor Details

    • StaticResourceServlet

      public StaticResourceServlet()
  • Method Details

    • init

      public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException
      Specified by:
      init in interface jakarta.servlet.Servlet
      Overrides:
      init in class jakarta.servlet.http.HttpServlet
      Throws:
      jakarta.servlet.ServletException
    • doGet

      protected void doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException
      Implementation of GET requests.
      Overrides:
      doGet in class jakarta.servlet.http.HttpServlet
      Throws:
      jakarta.servlet.ServletException
      IOException
    • doPost

      protected void doPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException
      Overrides:
      doPost in class jakarta.servlet.http.HttpServlet
      Throws:
      jakarta.servlet.ServletException
      IOException