Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
Bugfix: language of ConfigBasic.html was not changed properly when a different language was choosen here. Note: there's a similair bug on ConfigLanguage_p.html
(no author)e59ff8b65790
diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.javaindex 7c799c33b..cb319608b 100644--- a/source/de/anomic/http/httpdFileHandler.java+++ b/source/de/anomic/http/httpdFileHandler.java@@ -225,24 +225,22 @@ public final class httpdFileHandler extends httpdAbstractHandler implements httpif (defaultFiles.length == 0) defaultFiles = new String[] {"index.html"};}- /*- * Returns the path of a (existing) localized File, or the english one, if not availible.- * @param path is relative from htroot- * @return the function returns a Filehandle to the translated file, or if not availitble to the english one.- */- public static File getLocalizedFile(String path){- plasmaSwitchboard switchboard=plasmaSwitchboard.getSwitchboard();- // create htLocaleDefault, htLocalePath+ /** Returns a path to the localized or default file according to the htLocaleSelection (from he switchboard)+ * @param path relative from htroot */+ public static File getLocalizedFile(String path){+ return getLocalizedFile(path, switchboard.getConfig("htLocaleSelection","default"));+ }++ /** Returns a path to the localized or default file according to the parameter localeSelection+ * @param path relative from htroot+ * @param localeSelection language of localized file; htLocaleSelection from switchboard is used if localeSelection.equals("") */+ public static File getLocalizedFile(String path, String localeSelection){if (htDefaultPath == null) htDefaultPath = new File(switchboard.getRootPath(), switchboard.getConfig("htDefaultPath","htroot"));if (htLocalePath == null) htLocalePath = new File(switchboard.getRootPath(), switchboard.getConfig("htLocalePath","htroot/locale"));- //htLocaleSelection = switchboard.getConfig("htLocaleSelection","default");- // find locales or alternatives in htDocsPath- String htLocaleSelection = switchboard.getConfig("htLocaleSelection","default");- // look if we have a localization of that file- if (!(htLocaleSelection.equals("default"))) {- File localePath = new File(htLocalePath, htLocaleSelection + "/" + path);- if (localePath.exists())+ if (!(localeSelection.equals("default"))) {+ File localePath = new File(htLocalePath, localeSelection + "/" + path);+ if (localePath.exists()) // avoid "NoSuchFile" troubles if the "localeSelection" is misspelledreturn localePath;}return new File(htDefaultPath, path);@@ -443,7 +441,13 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http// locate the fileif (!(path.startsWith("/"))) path = "/" + path; // attach leading slash- File targetFile = getLocalizedFile(path);++ // a different language can be desired (by i.e. ConfigBasic.html) than the one stored in the htLocaleSelection+ String localeSelection = switchboard.getConfig("htLocaleSelection","default");+ if (args != null)+ localeSelection = args.get("language", localeSelection);++ File targetFile = getLocalizedFile(path, localeSelection);String targetExt = conProp.getProperty("EXT","");targetClass = rewriteClassFile(new File(htDefaultPath, path));if (path.endsWith("/")) {@@ -1012,8 +1016,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements httpMethod m = null;// now make a class out of the streamtry {- if (useTemplateCache) {-+ if (useTemplateCache) {SoftReference ref = (SoftReference) templateMethodCache.get(classFile);if (ref != null) {m = (Method) ref.get();@@ -1025,7 +1028,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http}}- }+ }//System.out.println("**DEBUG** loading class file " + classFile);Class c = provider.loadClass(classFile);