1 package dolda.jsvc.scgi;
5 import dolda.jsvc.util.*;
7 public class DSContext extends JarContext {
8 public final long mtime;
9 private final File datroot;
10 public final ThreadContext tg;
12 public DSContext(File jar, File datroot) throws ThreadContext.CreateException {
14 this.mtime = jar.lastModified();
15 this.datroot = datroot;
17 this.tg = ThreadContext.create(this, loader);
20 private void loadconfig() {
22 File sroot = new File(new File(datroot, "store"), name());
23 sysconfig.put("jsvc.storage", "file:" + sroot.getPath());
24 File conf = new File(datroot, "jsvc.properties");
27 InputStream in = new FileInputStream(conf);
33 } catch(IOException e) {
34 throw(new RuntimeException(e));
40 public RequestThread worker(Responder root, Request req, ThreadGroup tg, String name) {
41 java.net.Socket sk = ((ScgiRequest)req).sk;
42 if(req.path().equals("")) {
43 return(new ScgiReqThread(new RootRedirect(""), req, tg, name, sk));
45 return(new ScgiReqThread(root, RequestWrap.chpath(req, req.path().substring(1)), tg, name, sk));