*) Making mimeTable static final

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@619 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 19 years ago
parent 60e77dcc60
commit ebbd063c92

@ -104,7 +104,7 @@ import de.anomic.server.logging.serverLog;
public final class httpdFileHandler extends httpdAbstractHandler implements httpdHandler { public final class httpdFileHandler extends httpdAbstractHandler implements httpdHandler {
// class variables // class variables
private Properties mimeTable = null; private static final Properties mimeTable = new Properties();
private serverClassLoader provider = null; private serverClassLoader provider = null;
private File htRootPath = null; private File htRootPath = null;
private File htDocsPath = null; private File htDocsPath = null;
@ -122,15 +122,14 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
// creating a logger // creating a logger
this.theLogger = new serverLog("FILEHANDLER"); this.theLogger = new serverLog("FILEHANDLER");
if (this.mimeTable == null) { if (mimeTable.size() == 0) {
// load the mime table // load the mime table
this.mimeTable = new Properties();
String mimeTablePath = switchboard.getConfig("mimeConfig",""); String mimeTablePath = switchboard.getConfig("mimeConfig","");
FileInputStream mimeTableInputStream = null; FileInputStream mimeTableInputStream = null;
try { try {
serverLog.logConfig("HTTPDFiles", "Loading mime mapping file " + mimeTablePath); serverLog.logConfig("HTTPDFiles", "Loading mime mapping file " + mimeTablePath);
mimeTableInputStream = new FileInputStream(new File(switchboard.getRootPath(), mimeTablePath)); mimeTableInputStream = new FileInputStream(new File(switchboard.getRootPath(), mimeTablePath));
this.mimeTable.load(mimeTableInputStream); mimeTable.load(mimeTableInputStream);
} catch (Exception e) { } catch (Exception e) {
serverLog.logSevere("HTTPDFiles", "ERROR: path to configuration file or configuration invalid\n" + e); serverLog.logSevere("HTTPDFiles", "ERROR: path to configuration file or configuration invalid\n" + e);
System.exit(1); System.exit(1);
@ -401,7 +400,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
// re-write - method to create an result // re-write - method to create an result
serverObjects tp = new serverObjects(); serverObjects tp = new serverObjects();
filedate = new Date(localizedFile.lastModified()); filedate = new Date(localizedFile.lastModified());
String mimeType = this.mimeTable.getProperty(conProp.getProperty("EXT",""),"text/html"); String mimeType = mimeTable.getProperty(conProp.getProperty("EXT",""),"text/html");
byte[] result; byte[] result;
boolean zipContent = requestHeader.acceptGzip() && httpd.shallTransportZipped("." + conProp.getProperty("EXT","")); boolean zipContent = requestHeader.acceptGzip() && httpd.shallTransportZipped("." + conProp.getProperty("EXT",""));
String md5String = null; String md5String = null;

Loading…
Cancel
Save