cache.put(path, cached); } else
((Map)cache.get()).put(path, cached); } else {
	protected void process(HttpServletRequest request, HttpServletResponse response)		throws ServletException, IOException {		ServletOutputStream sout = response.getOutputStream();		PrintWriter output = 			new PrintWriter(new OutputStreamWriter(sout, formEncoding));		response.setContentType("text/html; charset=" + formEncoding);		response.addHeader( "pragma", "no-cache" );		response.addHeader( "Cache-Control", "no-cache" );				String path = request.getPathTranslated();		if(path == null) {			path = request.getRequestURI().substring(request.getContextPath().length());			int p = path.lastIndexOf(';');			if(p > -1)				path = path.substring(0, p);			path = getServletContext().getRealPath(path);		}		File f = new File(path);		if(!f.canRead()) {			sendError(output, "Cannot read source file", path);			return;		}		String baseURI = request.getRequestURI();		int p = baseURI.lastIndexOf('/');		if(p > -1)			baseURI = baseURI.substring(0, p);		baseURI = getServletContext().getRealPath(baseURI.substring(request.getContextPath().length()));		String actualUser = null;		String actualPassword = null;		HttpSession session = request.getSession();		if(session != null && request.isRequestedSessionIdValid()) {			actualUser = getSessionAttribute(session, "user");			actualPassword = getSessionAttribute(session, "password");		}		if(actualUser == null) actualUser = user;		if(actualPassword == null) actualPassword = password;				try {			Collection collection = DatabaseManager.getCollection(collectionURI, user, password);						XQueryService service = (XQueryService)				collection.getService("XQueryService", "1.0");			service.setProperty("base-uri", baseURI);			service.setModuleLoadPath(baseURI);			String prefix = RequestModule.PREFIX;			service.setNamespace(prefix, RequestModule.NAMESPACE_URI);			service.declareVariable(prefix + ":request", 					new HttpRequestWrapper(request, formEncoding, containerEncoding));			service.declareVariable(prefix + ":response", new HttpResponseWrapper(response));			service.declareVariable(prefix + ":session", new HttpSessionWrapper(session));									CompiledExpression compiled;			CachedQuery cached = (CachedQuery)cache.get(path);			if(cached == null || (!cached.isValid())) {				String xquery = readQuery(f);				compiled = service.compile(xquery);				cached = new CachedQuery(f, compiled);				cache.put(path, cached);			} else				compiled = cached.getExpression();			ResourceSet result = service.execute(compiled);			for(ResourceIterator i = result.getIterator(); i.hasMoreResources(); ) {				Resource res = i.nextResource();				output.println(res.getContent().toString());			}		} catch (XMLDBException e) {			log(e.getMessage(), e);			sendError(output, e.getMessage(), e);		}		output.flush();	}