Class FastFileServer

  • public class FastFileServer
    extends java.lang.Object
    Fast FileServer.

    This example shows how to use the Jetty APIs for sending static as fast as possible using various strategies for small, medium and large content.

    The Jetty DefaultServlet does all this and more, and to a lesser extent so does the ResourceHandler, so unless you have exceptional circumstances it is best to use those classes for static content

    WARNING: This is an example on how to send content fast. It is not secure, is highly vulnerable, and does not contain the common set of mitigations for malicious requests that bypass your controls over what a client can access. If you want to continue this codebase, consider adding checks for content outside of the resourceBase, and other bypasses such as alias references, alternate stream references, filesystem case sensitivity differences, filesystem utf-8 handling differences, bad filename concerns, etc.. Or just use the existing DefaultServlet or ResourceHandler that gives you all of these protections (and more) built-in.

    • Constructor Summary

      Constructor Description
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Server createServer​(int port, resourceBase)  
      static void main​(java.lang.String[] args)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FastFileServer

        public FastFileServer()
    • Method Detail

      • createServer

        public static Server createServer​(int port,
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception