1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/JavaServlet/SimpleWithLoginApp.py Tue Sep 21 18:01:01 2004 +0000
1.3 @@ -0,0 +1,28 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +from WebStack.Adapters import JavaServlet
1.7 +from Simple import SimpleResource
1.8 +from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator
1.9 +from javax.servlet.http import HttpServlet
1.10 +
1.11 +# NOTE: Not sure if the resource should be maintained in a resource pool.
1.12 +
1.13 +resource = LoginRedirectResource(
1.14 + login_url="http://localhost:8080/LoginApp/",
1.15 + app_url="http://localhost:8080",
1.16 + resource=SimpleResource(),
1.17 + authenticator=LoginRedirectAuthenticator(secret_key="horses"),
1.18 + anonymous_parameter_name="anonymous",
1.19 + logout_parameter_name="logout"
1.20 + )
1.21 +
1.22 +class SimpleWithLoginApp(HttpServlet):
1.23 + def __init__(self):
1.24 + global resource
1.25 + HttpServlet.__init__(self)
1.26 + self.dispatcher = JavaServlet.Dispatcher(resource)
1.27 +
1.28 + def service(self, request, response):
1.29 + self.dispatcher.service(request, response)
1.30 +
1.31 +# vim: tabstop=4 expandtab shiftwidth=4