dfischer.femtowebserver.test
Class DivisionByNullTestWeblet

java.lang.Object
  |
  +--dfischer.femtowebserver.test.DivisionByNullTestWeblet
All Implemented Interfaces:
HttpdWebletInterface

public class DivisionByNullTestWeblet
extends java.lang.Object
implements HttpdWebletInterface

This Weblet example shows what happens, when a java Exception occurs during the execution of the Weblet. The Femto Web Server response is "500 Internal Server Error".

 Sourcecode

 package dfischer.femtowebserver.test;
 import dfischer.femtowebserver.httpd.*;

 public class DivisionByNullTestWeblet implements HttpdWebletInterface
 {
 
     public void execute(HttpRequest req, HttpResponse res, HttpdProperties httpdProperties) throws Exception
     {
         int a = 2;
         int b = 0;
         int result = a / b;       // division by null
         res.println("You will never see the result " + result);
     }
 } 
 


Constructor Summary
DivisionByNullTestWeblet()
           
 
Method Summary
 void execute(HttpRequest req, HttpResponse res, HttpdProperties httpdProperties)
          Executes the Weblet.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DivisionByNullTestWeblet

public DivisionByNullTestWeblet()
Method Detail

execute

public void execute(HttpRequest req,
                    HttpResponse res,
                    HttpdProperties httpdProperties)
             throws java.lang.Exception
Executes the Weblet.
Specified by:
execute in interface HttpdWebletInterface
Parameters:
req - HTTP request data
res - HTTP response data of the Weblet
httpdProperties - properties of the Femto Web Server