Package dfischer.femtowebserver.httpd

Contains the Femto Web Server main thread and all classes for Weblets and "Simple Server Side Includes" (SSSI).

See:
          Description

Interface Summary
HttpdSssiInterface SSSI - Simple Server Side Includes - must implement this interface. SSSI are directives that are placed in static HTML pages, and evaluated on the server while the HTML pages are being served.
HttpdWebletInterface Weblets - direct from web browser executable java classes - must implement this interface. Weblets are special java classes, which can be called direct from the browser.
 

Class Summary
Httpd This is the Femto Web Server main class which is implemented as an independent thread.
HttpdProperties Allows Weblets and SSSIs to access the configuration of the Femto Web Server (read/only access).
HttpRequest Allows Weblets and SSSIs to access the HTTP request data (browser request).
HttpResponse Sets the Weblet HTTP response data (server response). Use the methods print() and println() to transmit ASCII-content like HTML data to the agent (browser).
HttpUploadFile Data encapsulation for uploaded files.
 

Package dfischer.femtowebserver.httpd Description

Contains the Femto Web Server main thread and all classes for Weblets and "Simple Server Side Includes" (SSSI).

Programming Example of the Femto Web Server Main Thread

import dfischer.femtowebserver.httpd.Httpd;
import java.net.*;


public class FemtoWebServerDemo
{		  
    public static void main(String args[])
    {
        try
        {
            // create new instance of the femto web server
            Httpd httpdThread = new Httpd();

            // configure the femto web server
            String serverName = "127.0.0.1";
            try { serverName = InetAddress.getLocalHost().getHostName(); } catch (Exception ex) {}
            httpdThread.setServerName(serverName);
            httpdThread.setServerPort(83);
            httpdThread.setWelcomePage("/dfischer/femtowebserver/test/Welcome.html");
            httpdThread.setRestrictedMimeMapping();
            httpdThread.setTimeZone("ECT");
			
            // start the femto web server
            httpdThread.start();
            httpdThread.join();		// wait here forever
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
}
>>> This example is already pre-compiled inside the package femtowebserver.jar
  1. Add the package femtowebserver.jar to the CLASSPATH
  2. Start the Femto Web Server with "java FemtoWebServerDemo"
  3. Start your web browser, enter http://127.0.0.1:83 as URL - and try it!