Changeset 1076

Show
Ignore:
Timestamp:
06/07/08 20:21:32 (3 months ago)
Author:
kris
Message:

replaced AdminContext? with AdminServlet?.configure()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/mango/net/servlet/tools/AdminServlet.d

    r1071 r1076  
    55        Classes for administration of logging from a Servlet Engine. 
    66 
    7         AdminServlet can be used to modify logging details. 
    8        
    9         AdminContext is a pre-built ServletContext that includes AdminServlet 
    10  
    11         AdminServer is a pre-built server that allows logging administration. 
    12         Simply instantiate it with an InternetAddress to bind to. 
     7        AdminServlet can be used to modify logging details. Use function 
     8        AdminServlet.configure() to install the administrator within your  
     9        server 
    1310         
    1411        Scott Sanders, June 3, 2004 
     
    3431class AdminServlet : Servlet 
    3532{ 
     33        version (WithOwnLogger) 
     34        { 
    3635        // our logging instance 
    3736        private Logger log; 
     
    4746                log = Log.lookup ("mango.admin.AdminServlet"); 
    4847                log.level = log.Level.Error; 
     48        } 
    4949        } 
    5050 
     
    8787                   } 
    8888 
     89                version (WithOwnLogger) 
     90                { 
    8991                //set the level on the logger 
    9092                log.info("Setting logger " ~ loggerName ~  
    9193                         " to level " ~ Log.convert(level)); 
     94                } 
    9295 
    9396                // force update to children too 
     
    109112                char[] action = request.parameters().get("action"); 
    110113                 
    111                 // if the action is null, then we are doing the default - list 
     114                version (WithOwnLogger) 
     115                { 
     116                 // if the action is null, then we are doing the default - list 
    112117                if (action is null) 
    113118                    action = "L"; 
    114119                else 
    115120                   log.trace ("request to logadmin with uri: " ~ uri.toString); 
    116                  
     121                } 
     122                else 
     123                   // if the action is null, then we are doing the default - list 
     124                   if (action is null) 
     125                       action = "L"; 
     126 
    117127                switch (action[0]) 
    118128                       { 
     
    169179 
    170180                //List out the currently defined Loggers 
    171                 output ("<h1>Mango Server Console - Logger Administrator</h1>")  
     181                output ("<h1>Log Administration Console</h1>")  
    172182                       ("<h2>Existing Loggers</h2><table border='1' cellpadding='3'>") 
    173183                       (HttpConst.Eol) 
     
    183193                        char[] label = name; 
    184194                        if (label.length is 0) 
    185                             label = "(root)"; 
     195                            label = "[root]"; 
    186196 
    187197                        int level = l.level; 
     
    250260                output ("</body></html>"); 
    251261        } 
     262 
     263        /*********************************************************************** 
     264 
     265        ***********************************************************************/ 
     266 
     267        static void configure (ServletProvider sp, ServletContext context) 
     268        { 
     269                sp.addMapping ("/admin/logger", sp.addServlet (new AdminServlet, "admin", context)); 
     270        } 
    252271} 
    253272 
    254273 
    255  
     274version (OldAdmin) 
     275
    256276/******************************************************************************* 
    257277 
     
    275295        } 
    276296} 
    277  
     297