WebStack

examples/JavaServlet/SimpleWithLoginApp.py

383:74ed715c5455
2005-05-01 paulb [project @ 2005-05-01 18:16:52 by paulb] Added missing example for Zope.
     1 #!/usr/bin/env python     2      3 from WebStack.Adapters import JavaServlet     4 from Simple import SimpleResource     5 from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator     6 from javax.servlet.http import HttpServlet     7      8 # NOTE: Not sure if the resource should be maintained in a resource pool.     9     10 resource = LoginRedirectResource(    11     login_url="http://localhost:8080/LoginApp/",    12     app_url="http://localhost:8080",    13     resource=SimpleResource(),    14     authenticator=LoginRedirectAuthenticator(secret_key="horses"),    15     anonymous_parameter_name="anonymous",    16     logout_parameter_name="logout"    17     )    18     19 class SimpleWithLoginApp(HttpServlet):    20     def __init__(self):    21         global resource    22         HttpServlet.__init__(self)    23         self.dispatcher = JavaServlet.Dispatcher(resource)    24     25     def service(self, request, response):    26         self.dispatcher.service(request, response)    27     28 # vim: tabstop=4 expandtab shiftwidth=4