dfischer.femtowebserver.test
Class BasicAuthTestWeblet
java.lang.Object
|
+--dfischer.femtowebserver.test.BasicAuthGenericTestWeblet
|
+--dfischer.femtowebserver.test.BasicAuthTestWeblet
- All Implemented Interfaces:
- BasicAuthGenericTestInterface, HttpdWebletInterface
- public class BasicAuthTestWeblet
- extends BasicAuthGenericTestWeblet
This Weblet example displays a username/password protected page.
It
inherits/extends the abstract BasicAuthGenericTestWeblet and implements the
BasicAuthGenericTestInterface which is a re-definition of the HttpdWebletInterface
by adding a valid, already authorized username.
The beauty of this kind of implementation is, that the authorization is already
(successfull) done, when this Weblet will be called from the BasicAuthGenericTestWeblet.
An other benefit is, that deep links can bookmarked. If (later) the authorization
has not been set, the user will first prompted for it and afterwards the bookmark will
be displayed. So there is no need of a single login procedure.
Sourcecode
package dfischer.femtowebserver.test;
import dfischer.femtowebserver.httpd.*;
public class BasicAuthTestWeblet extends BasicAuthGenericTestWeblet
{
public void execute(HttpRequest req, HttpResponse res, HttpdProperties httpdProperties, String username) throws Exception
{
res.println("<HTML>");
res.println("<BODY>");
res.println("This is the secret response for the user \"" + username + "\".<BR>");
res.println("Access from now on is granted until you close all browser windows.");
res.println("</BODY>");
res.println("</HTML>");
}
}
- See Also:
BasicAuthGenericTestWeblet,
BasicAuthGenericTestInterface
|
Method Summary |
void |
execute(HttpRequest req,
HttpResponse res,
HttpdProperties httpdProperties,
java.lang.String username)
Implements the BasicAuthGenericTestInterface which is a re-definition of the HttpdWebletInterface
by adding a valid, already authorized username. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BasicAuthTestWeblet
public BasicAuthTestWeblet()
execute
public void execute(HttpRequest req,
HttpResponse res,
HttpdProperties httpdProperties,
java.lang.String username)
throws java.lang.Exception
- Implements the BasicAuthGenericTestInterface which is a re-definition of the HttpdWebletInterface
by adding a valid, already authorized username.
- See Also:
BasicAuthGenericTestInterface,
HttpdWebletInterface