|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
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. In opposite to a static HTML page, you will be able to generate a dynamic HTML result (based on the browser request with CGI parameters). Weblets are similar to Java Servlets, but easier to program ...
Programming Example
package mypackage;
import dfischer.femtowebserver.httpd.*;
public class MyTestWeblet implements HttpdWebletInterface
{
public void execute(HttpRequest req, HttpResponse res, HttpdProperties httpdProperties) throws Exception
{
res.println("<HTML>");
res.println("<BODY>");
res.println("The current time in milliseconds is " + System.currentTimeMillis());
res.println("</BODY>");
res.println("</HTML>");
}
}
Call this example from the web browser, if the Femto Web Server has started on Port 83:Built-in Security: before execution of a class, the Femto Web Server will check if the class implements the HttpdWebletInterface. This will be done before an instance of the class has been created (to avoid security problems by executing the constructor). If the HttpdWebletInterface is not implemented, the browser request will be aborted and the web server response is "403 Forbidden".
Hint 1: make sure that the Weblet is part of the CLASSPATH during execution of the Femto Web Server.
Hint 2: an other way to create dynamic content is also the usage of Simple Server Side Includes (SSSI).
Httpd,
HttpRequest,
HttpResponse,
HttpdProperties,
HttpdSssiInterface| Method Summary | |
void |
execute(HttpRequest httpRequest,
HttpResponse httpResponse,
HttpdProperties httpdProperties)
Executes the Weblet. |
| Method Detail |
public void execute(HttpRequest httpRequest,
HttpResponse httpResponse,
HttpdProperties httpdProperties)
throws java.lang.Exception
httpRequest - access to the HTTP request data (browser request)httpResponse - Weblet HTTP response data (server response)httpdProperties - read/only access to the Femto Web Server configuration
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||