DocumentImpl document = (DocumentImpl) broker.getDocument(session.getUser(), name);
broker.setUser(session.getUser()); DocumentImpl document = (DocumentImpl) broker.getDocument(name);
	public String getResource(String sessionId, String name, boolean indent, boolean xinclude)		throws java.rmi.RemoteException {		Session session = getSession(sessionId);		DBBroker broker = null;		try {			broker = pool.get();			DocumentImpl document = (DocumentImpl) broker.getDocument(session.getUser(), name);			if (document == null)				throw new RemoteException("resource " + name + " not found");			Serializer serializer = broker.getSerializer();			Map props = new TreeMap();			props.put(Serializer.ENCODING, "UTF-8");			props.put(Serializer.PRETTY_PRINT, Boolean.toString(indent));			props.put(Serializer.EXPAND_XINCLUDES, Boolean.toString(xinclude));			serializer.setProperties(props);			return serializer.serialize(document);			//			if (xml != null)			//				try {			//					return xml.getBytes("UTF-8");			//				} catch (java.io.UnsupportedEncodingException e) {			//					return xml.getBytes();			//				}			//			//			return null;		} catch (SAXException saxe) {			saxe.printStackTrace();			throw new RemoteException(saxe.getMessage());		} catch (EXistException e) {			throw new RemoteException(e.getMessage());		} catch (PermissionDeniedException e) {			throw new RemoteException(e.getMessage());		} finally {			pool.release(broker);		}	}