weblanguages = new WebLanguages(globalconfiguration);
    public GlobalConfiguration initialize(HttpServletRequest request, String resource) throws Exception{    	    	certificates = (X509Certificate[]) request.getAttribute( "javax.servlet.request.X509Certificate" );    	if(certificates == null) throw new AuthenticationFailedException("Client certificate required.");    	String userdn = "";    	    	if(!initialized){    		administrator = new Admin(certificates[0]) ;    		    		commonInit();            ServiceLocator locator = ServiceLocator.getInstance();    		IUserAdminSessionLocalHome adminsessionhome = (IUserAdminSessionLocalHome) locator.getLocalHome(IUserAdminSessionLocalHome.COMP_NAME);    		IUserAdminSessionLocal  adminsession = adminsessionhome.create();    		    		adminspreferences = new AdminPreferenceDataHandler(administrator);    		weblanguages = new WebLanguages(globalconfiguration);    		    		// Check if user certificate is revoked    		authorizedatahandler.authenticate(certificates[0]);    		    		// Check if certificate and user is an RA Admin    		userdn = CertTools.getSubjectDN(certificates[0]);    		log.debug("Verifying authorization of '"+userdn);    		    		adminsession.checkIfCertificateBelongToAdmin(administrator, certificates[0].getSerialNumber(), certificates[0].getIssuerDN().toString());            		logsession.log(administrator, certificates[0], LogEntry.MODULE_ADMINWEB,  new java.util.Date(),null, null, LogEntry.EVENT_INFO_ADMINISTRATORLOGGEDIN,"");    	}    	try {    		isAuthorized(URLDecoder.decode(resource,"UTF-8"));    	} catch(AuthorizationDeniedException e) {    		throw new AuthorizationDeniedException("You are not authorized to view this page.");    	} catch(java.io.UnsupportedEncodingException e) {}    	    	    	if(!initialized){    		certificatefingerprint = CertTools.getFingerprintAsString(certificates[0]);    		    		// Get current admin preference.    		currentadminpreference=null;    		if(certificatefingerprint != null){    			currentadminpreference = adminspreferences.getAdminPreference(certificatefingerprint);    		}    		if(currentadminpreference == null){    			currentadminpreference = adminspreferences.getDefaultAdminPreference();    		}    		adminsweblanguage = new WebLanguages( currentadminpreference.getPreferedLanguage()    				,currentadminpreference.getSecondaryLanguage());    		    		// set User Common Name    		DNFieldExtractor dn = new DNFieldExtractor(userdn, DNFieldExtractor.TYPE_SUBJECTDN);    		usercommonname = dn.getField(DNFieldExtractor.CN,0);    		    		initialized=true;    	}    	return globalconfiguration;    }