WebStack

examples/JavaServlet/LoginApp.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 WebStack.Resources.Login import LoginResource, LoginAuthenticator     5 from javax.servlet.http import HttpServlet     6      7 # NOTE: Not sure if the resource should be maintained in a resource pool.     8      9 resource = LoginResource(    10     LoginAuthenticator(    11         secret_key="horses",    12         credentials=(    13             ("badger", "abc"),    14             ("vole", "xyz"),    15         )    16     ),    17     use_redirect=0    18 )    19     20 class LoginApp(HttpServlet):    21     def __init__(self):    22         global resource    23         HttpServlet.__init__(self)    24         self.dispatcher = JavaServlet.Dispatcher(resource)    25     26     def service(self, request, response):    27         self.dispatcher.service(request, response)    28     29 # vim: tabstop=4 expandtab shiftwidth=4