Class FileServer


  • public class FileServer
    extends java.lang.Object
    Objekte der Klasse FileServer liefern Dateien ueber HTTP aus Im Attribut FileServer.ATTR_FILE_BASE in HttpExchange.getContext().getAttributes() wird das Verzeichnis erwartet, aus dem Dateien ausgeliefert werden sollen. Im Attribut FileServer.ATTR_WELCOME_FILES in HttpExchange.getContext().getAttributes() kann eine mit Komma getrennte Liste mit Dateinamen uebergeben werden, die ausgeliefert werden sollen, wenn ein Verzeichnis anstelle einer Datei angefragt ist.
    • Constructor Summary

      Constructors 
      Constructor Description
      FileServer()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void serveFile​(com.sun.net.httpserver.HttpExchange exchange)  
      java.io.File tryWelcomeFiles​(com.sun.net.httpserver.HttpExchange e, java.lang.String fName)  
      • Methods inherited from class java.lang.Object

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

      • FileServer

        public FileServer()
    • Method Detail

      • serveFile

        public void serveFile​(com.sun.net.httpserver.HttpExchange exchange)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • tryWelcomeFiles

        public java.io.File tryWelcomeFiles​(com.sun.net.httpserver.HttpExchange e,
                                            java.lang.String fName)