Added an optional server-context name fetching operation.
[jsvc.git] / src / dolda / jsvc / j2ee / J2eeContext.java
1 package dolda.jsvc.j2ee;
2
3 import dolda.jsvc.*;
4 import dolda.jsvc.util.*;
5 import javax.servlet.*;
6 import java.util.*;
7 import java.io.*;
8
9 public abstract class J2eeContext implements ServerContext {
10     private final ServletConfig sc;
11     private final long ctime;
12     protected final Properties config;
13     
14     protected J2eeContext(ServletConfig sc) {
15         this.sc = sc;
16         this.ctime = System.currentTimeMillis();
17         config = new Properties();
18     }
19     
20     static J2eeContext create(ServletConfig sc) {
21         if(TomcatContext.tomcatp(sc))
22             return(new TomcatContext(sc));
23         return(new StandardContext(sc));
24     }
25     
26     public long starttime() {
27         return(ctime);
28     }
29     
30     public String config(String key) {
31         return((String)config.get(key));
32     }
33     
34     public ServletConfig j2eeconfig() {
35         return(sc);
36     }
37 }