Changeset 75
- Timestamp:
- 05/15/05 18:11:43 (4 years ago)
- Files:
-
- trunk/app.xml (added)
- trunk/dsp/ConfigParser.d (modified) (1 diff)
- trunk/dsp/servlet/DSPServlet.d (modified) (2 diffs)
- trunk/dsp/servlet/DSPServletContext.d (modified) (3 diffs)
- trunk/dsp/servlet/DSPServletProvider.d (modified) (3 diffs)
- trunk/dspconf/config.xml (modified) (1 diff)
- trunk/dspconf/dsp01.dsp (modified) (1 diff)
- trunk/server.d (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/dsp/ConfigParser.d
r71 r75 155 155 if(text.length > 0){ 156 156 dictionary.put(this.name,this.text); 157 text .length = 0;157 text = null; 158 158 } 159 159 state = Data; trunk/dsp/servlet/DSPServlet.d
r71 r75 282 282 static this (){ 283 283 logger = Logger.getLogger ("dsp.servlets"); 284 } 285 286 284 } 285 287 286 /* 288 287 <desc> … … 341 340 342 341 // debug 343 debug debugprintf("%.*s\n",cfg.toString());342 printf("%.*s\n",cfg.toString()); 344 343 345 344 // build the servlet library trunk/dsp/servlet/DSPServletContext.d
r73 r75 47 47 override public this (ServletProvider provider, char[] name, char[] basePath, Logger log = null){ 48 48 super(name,basePath,log); 49 49 50 50 this.basePath = basePath; 51 51 52 52 FileConduit fc = getResourceAsFile("./config.xml"); 53 53 54 printf("load ServletContext configuration\n");54 debug printf("load ServletContext configuration\n"); 55 55 56 56 // load configuration … … 58 58 ConfigParser configParser = new ConfigParser(); 59 59 setConfiguration(configParser.parse(fc)); 60 fc.close(); 60 61 } 62 63 debug printf("mesh the configuration\n"); 61 64 62 65 // add the provider's configuration while we're at it … … 67 70 68 71 fc.close(); 72 73 debug printf("add servlet\n"); 69 74 70 75 // set servlet trunk/dsp/servlet/DSPServletProvider.d
r71 r75 27 27 28 28 private import dsp.ConfigParser; 29 private import dsp.ApplicationConfigParser; 29 30 30 31 private import dsp.servlet.DSPServlet; … … 48 49 protected MutableDictionary configuration; 49 50 50 public this ( char[] configPath,uint urls = 2048){51 public this (uint urls = 2048){ 51 52 super(urls); 52 53 FileConduit fc = new FileConduit(configPath); 53 54 FileConduit configFC = new FileConduit("server.xml"); 55 FileConduit appFC = new FileConduit("app.xml"); 54 56 55 57 // load configuration 56 if( fc){58 if(configFC){ 57 59 ConfigParser configParser = new ConfigParser(); 58 configuration = configParser.parse(fc); 60 configuration = configParser.parse(configFC); 61 configFC.close(); 59 62 } 63 else{ 64 configuration = new MutableDictionary(); 65 } 66 67 // load applications 68 if(appFC){ 69 ApplicationConfigParser appConfigParser = new ApplicationConfigParser(); 70 appConfigParser.parse(appFC,this); 71 appFC.close(); 72 } 60 73 } 61 74 … … 76 89 override char[] toString() 77 90 { 78 return "DSPServlet ";91 return "DSPServletProvider"; 79 92 } 80 93 trunk/dspconf/config.xml
r68 r75 2 2 <config> 3 3 <cache-directory value="_cache\"/> 4 <temp-directory value="_temp\"/> 4 5 <cache-size value="2"/> 5 <runtime-directory value=" c:\dev\dsp\trunk\runtime/"/>6 <runtime-directory value=".\runtime\"/> 6 7 <build-options value="-inline -release"/> 7 8 </config> trunk/dspconf/dsp01.dsp
r72 r75 26 26 </html> 27 27 28 29 30 trunk/server.d
r68 r75 60 60 mango.cache.VirtualCache; 61 61 62 private import dsp.servlet.DSPServletProvider; 63 64 import mango.format.Int; 65 62 66 // setup a logger for module scope 63 67 private Logger mainLogger; 64 65 import dsp.servlet.DSPServlet;66 import dsp.servlet.DSPServletProvider;67 import dsp.servlet.DSPServletContext;68 69 import mango.format.Int;70 68 71 69 void testServletEngine () … … 74 72 75 73 // construct a servlet-provider 76 DSPServletProvider sp = new DSPServletProvider( "server.xml");74 DSPServletProvider sp = new DSPServletProvider(); 77 75 78 76 // create a context for admin servlets 79 77 sp.addContext (new AdminContext (sp, "/admin")); 80 78 81 // create a context for example dsp servlets82 sp.addContext (new DSPServletContext (sp,"/foo/bar","c:/dev/dsp/trunk/dspconf"));83 84 79 // fire up a server 85 80 mainLogger.info ("starting server"); 86 81 87 82 88 /*** bind to port and an address***/83 /*** fetch port and address from the config ***/ 89 84 90 85 uint port = 0; … … 103 98 if(serverThreads) threads = Int.parse(serverThreads); 104 99 if(threads == 0) threads = 1; 100 101 102 /*** bind to port and an address ***/ 105 103 106 104 HttpServer server = new HttpServer (sp, addr, threads, mainLogger);
