Changeset 75

Show
Ignore:
Timestamp:
05/15/05 18:11:43 (4 years ago)
Author:
pragma
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dsp/ConfigParser.d

    r71 r75  
    155155            if(text.length > 0){ 
    156156                dictionary.put(this.name,this.text); 
    157                 text.length = 0
     157                text = null
    158158            } 
    159159            state = Data; 
  • trunk/dsp/servlet/DSPServlet.d

    r71 r75  
    282282    static this (){ 
    283283        logger = Logger.getLogger ("dsp.servlets"); 
    284     }    
    285      
    286      
     284    } 
     285 
    287286    /*  
    288287        <desc> 
     
    341340 
    342341        // debug 
    343         debug debug printf("%.*s\n",cfg.toString()); 
     342        printf("%.*s\n",cfg.toString()); 
    344343 
    345344        // build the servlet library 
  • trunk/dsp/servlet/DSPServletContext.d

    r73 r75  
    4747    override public this (ServletProvider provider, char[] name, char[] basePath, Logger log = null){ 
    4848        super(name,basePath,log); 
    49          
     49 
    5050        this.basePath = basePath; 
    5151         
    5252        FileConduit fc = getResourceAsFile("./config.xml"); 
    5353         
    54         printf("load ServletContext configuration\n"); 
     54        debug printf("load ServletContext configuration\n"); 
    5555         
    5656        // load configuration 
     
    5858            ConfigParser configParser = new ConfigParser(); 
    5959            setConfiguration(configParser.parse(fc)); 
     60            fc.close(); 
    6061        } 
     62         
     63        debug printf("mesh the configuration\n"); 
    6164         
    6265        // add the provider's configuration while we're at it 
     
    6770             
    6871        fc.close(); 
     72         
     73        debug printf("add servlet\n"); 
    6974         
    7075        // set servlet 
  • trunk/dsp/servlet/DSPServletProvider.d

    r71 r75  
    2727 
    2828private import dsp.ConfigParser; 
     29private import dsp.ApplicationConfigParser; 
    2930 
    3031private import dsp.servlet.DSPServlet; 
     
    4849    protected MutableDictionary configuration; 
    4950 
    50     public this (char[] configPath,uint urls = 2048){ 
     51    public this (uint urls = 2048){ 
    5152        super(urls); 
    52          
    53         FileConduit fc = new FileConduit(configPath); 
     53     
     54        FileConduit configFC = new FileConduit("server.xml"); 
     55        FileConduit appFC = new FileConduit("app.xml"); 
    5456         
    5557        // load configuration 
    56         if(fc){ 
     58        if(configFC){ 
    5759            ConfigParser configParser = new ConfigParser(); 
    58             configuration = configParser.parse(fc); 
     60            configuration = configParser.parse(configFC); 
     61            configFC.close(); 
    5962        } 
     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        }    
    6073    } 
    6174     
     
    7689    override char[] toString() 
    7790    { 
    78         return "DSPServlet"; 
     91        return "DSPServletProvider"; 
    7992    } 
    8093     
  • trunk/dspconf/config.xml

    r68 r75  
    22<config> 
    33    <cache-directory value="_cache\"/> 
     4    <temp-directory value="_temp\"/> 
    45    <cache-size value="2"/> 
    5     <runtime-directory value="c:\dev\dsp\trunk\runtime/"/> 
     6    <runtime-directory value=".\runtime\"/> 
    67    <build-options value="-inline -release"/> 
    78</config> 
  • trunk/dspconf/dsp01.dsp

    r72 r75  
    2626</html> 
    2727 
     28 
     29 
     30 
  • trunk/server.d

    r68 r75  
    6060        mango.cache.VirtualCache; 
    6161 
     62private import dsp.servlet.DSPServletProvider; 
     63 
     64import mango.format.Int; 
     65 
    6266        // setup a logger for module scope 
    6367private Logger mainLogger; 
    64  
    65 import dsp.servlet.DSPServlet; 
    66 import dsp.servlet.DSPServletProvider; 
    67 import dsp.servlet.DSPServletContext; 
    68  
    69 import mango.format.Int; 
    7068 
    7169void testServletEngine () 
     
    7472 
    7573        // construct a servlet-provider 
    76         DSPServletProvider sp = new DSPServletProvider("server.xml"); 
     74        DSPServletProvider sp = new DSPServletProvider(); 
    7775 
    7876        // create a context for admin servlets 
    7977        sp.addContext (new AdminContext (sp, "/admin")); 
    8078 
    81         // create a context for example dsp servlets 
    82         sp.addContext (new DSPServletContext (sp,"/foo/bar","c:/dev/dsp/trunk/dspconf"));  
    83      
    8479        // fire up a server 
    8580        mainLogger.info ("starting server"); 
    8681 
    8782 
    88         /*** bind to port and an address ***/ 
     83        /*** fetch port and address from the config ***/ 
    8984         
    9085        uint port = 0; 
     
    10398        if(serverThreads) threads = Int.parse(serverThreads); 
    10499        if(threads == 0) threads = 1; 
     100         
     101         
     102        /*** bind to port and an address ***/ 
    105103         
    106104        HttpServer server = new HttpServer (sp, addr, threads, mainLogger);