Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java	(revision 32326)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java	(revision 32327)
@@ -123,45 +123,71 @@
 		//System.setProperty("java.util.prefs.PreferencesFactory", "org.greenstone.gsdl3.util.DisabledPreferencesFactory");
 
-		library_name = config.getInitParameter(GSConstants.LIBRARY_NAME);
-		String interface_name = config.getInitParameter(GSConstants.INTERFACE_NAME);
-
-		String useXslt = (String) config.getInitParameter(GSConstants.USE_CLIENT_SIDE_XSLT);
-		supports_client_xslt = useXslt != null && useXslt.equals("true");
-
-		this.default_lang = config.getInitParameter(GSConstants.DEFAULT_LANG);
-		String sess_expire = config.getInitParameter(GSXML.SESSION_EXPIRATION);
-
-		if (sess_expire != null && !sess_expire.equals(""))
-		{
-			this.session_expiration = Integer.parseInt(sess_expire);
-		}
-
-		if (library_name == null || interface_name == null)
-		{
-			// must have this
-			System.err.println("initialisation parameters not all set!");
-			System.err.println(" you must have libraryname and interfacename");
-			System.exit(1);
-		}
-
-		String site_name = config.getInitParameter(GSConstants.SITE_NAME);
+		// Look through all the init params
+		// these are the ones we are expecting
+		String interface_name = null;
+		String useXslt = null;
+		String sess_expire = null;
+		String site_name = null;
+		String recept_name = null;
+
+		// may have these instead of site_name
 		String remote_site_name = null;
 		String remote_site_type = null;
 		String remote_site_address = null;
 
-		if (site_name == null)
-		{
-			// no site, try for communicator
-			remote_site_name = config.getInitParameter("remote_site_name");
-			remote_site_type = config.getInitParameter("remote_site_type");
-			remote_site_address = config.getInitParameter("remote_site_address");
-			if (remote_site_name == null || remote_site_type == null || remote_site_address == null)
-			{
-				System.err.println("initialisation paramters not all set!");
-				System.err.println("if site_name is not set, then you must have remote_site_name, remote_site_type and remote_site_address set");
-				System.exit(1);
-			}
-		}
-
+		// the stored config params
+		HashMap<String, Object> config_params = new HashMap<String, Object>();
+		Enumeration<String> params = config.getInitParameterNames();
+		while (params.hasMoreElements()) {
+		  String name = params.nextElement();
+		  String value = config.getInitParameter(name);
+		  switch(name) {
+		  case GSConstants.LIBRARY_NAME: library_name = value;
+		    break;
+		  case GSConstants.INTERFACE_NAME: interface_name = value;
+		    break;
+		  case GSConstants.USE_CLIENT_SIDE_XSLT: useXslt = value;
+		    break;
+		  case GSConstants.DEFAULT_LANG: this.default_lang = value;
+		    break;
+		  case GSXML.SESSION_EXPIRATION: sess_expire = value;
+		    break;
+		  case GSConstants.SITE_NAME: site_name = value;
+		    break;
+		  case GSConstants.REMOTE_SITE_NAME: remote_site_name = value;
+		    break;
+		  case GSConstants.REMOTE_SITE_TYPE: remote_site_type = value;
+		    break;
+		  case GSConstants.REMOTE_SITE_ADDRESS: remote_site_address = value;
+		    break;
+		  case GSConstants.RECEPTIONIST_CLASS: recept_name = value;
+		    break;
+		    // default - just add to config params
+		  default: config_params.put(name, value);
+		    break;
+		  }
+		}
+
+		if (library_name == null || interface_name == null) {
+		  
+		  // must have these
+		  System.err.println("initialisation parameters not all set!");
+		  System.err.println(" you must have libraryname and interfacename");
+		  System.exit(1);
+		}
+
+		// If we don't have a site, then we must be using a Communicator, and all the remote params must be set
+		if (site_name == null && (remote_site_name == null || remote_site_type == null || remote_site_address == null)) {
+		  
+		  System.err.println("initialisation paramters not all set!");
+		  System.err.println("if site_name is not set, then you must have remote_site_name, remote_site_type and remote_site_address set");
+		  System.exit(1);
+		}
+		
+		supports_client_xslt = useXslt != null && useXslt.equals("true");
+		if (sess_expire != null && !sess_expire.equals(""))
+		{
+			this.session_expiration = Integer.parseInt(sess_expire);
+		}
 		if (this.default_lang == null)
 		{
@@ -169,6 +195,4 @@
 			this.default_lang = DEFAULT_LANG;
 		}
-
-		HashMap<String, Object> config_params = new HashMap<String, Object>();
 
 		config_params.put(GSConstants.LIBRARY_NAME, library_name);
@@ -180,9 +204,6 @@
 			config_params.put(GSConstants.SITE_NAME, site_name);
 		}
-		//this.converter = new XMLConverter();
-		//this.doc = XMLConverter.newDOM();
 
 		// the receptionist -the servlet will talk to this
-		String recept_name = (String) config.getInitParameter("receptionist_class");
 		if (recept_name == null)
 		{
@@ -204,5 +225,5 @@
 		this.recept.setConfigParams(config_params);
 
-		// the receptionist uses a MessageRouter or Communicator to send its requests to. We either create a MessageRouter here for the designated site (if site_name set), or we create a Communicator for a remote site. The is given to teh Receptionist, and the servlet never talks to it again.directly.
+		// the receptionist uses a MessageRouter or Communicator to send its requests to. We either create a MessageRouter here for the designated site (if site_name set), or we create a Communicator for a remote site. The is given to the Receptionist, and the servlet never talks to it again directly.
 		if (site_name != null)
 		{
@@ -287,5 +308,4 @@
 		//Allow the message router and the document to be accessed from anywhere in this servlet context
 		this.getServletContext().setAttribute("GSRouter", this.recept.getMessageRouter());
-		//this.getServletContext().setAttribute("GSDocument", this.doc);
 	}
 
