if(var == null) throw new XPathException("No request object found in the current XQuery context.");
	public Sequence eval(Sequence[] args, Sequence contextSequence)			throws XPathException {		RequestModule myModule = (RequestModule)context.getModule(RequestModule.NAMESPACE_URI);				// request object is read from global variable $request		Variable var = 			myModule.resolveVariable(RequestModule.REQUEST_VAR);		if (var.getValue().getItemType() != Type.JAVA_OBJECT)			throw new XPathException("Variable $request is not bound to an Java object.");		JavaObjectValue value = (JavaObjectValue) var.getValue().itemAt(0);		RequestWrapper request;		if(value.getObject() instanceof RequestWrapper) {			request = (RequestWrapper)value.getObject();		} else			throw new XPathException("Variable $request is not bound to a Request object.");				String userName = args[0].getStringValue();		String passwd = args[1].getStringValue();				SecurityManager security = context.getBroker().getBrokerPool().getSecurityManager();		User user = security.getUser(userName);		if (user == null)			return Sequence.EMPTY_SEQUENCE;		if (user.validate(passwd)) {			context.getBroker().setUser(user);			SessionWrapper session = request.getSession(true);			session.setAttribute("user", userName);			session.setAttribute("password", new StringValue(passwd));			return BooleanValue.TRUE;		} else {			LOG.warn("Could not validate user " + userName);			return BooleanValue.FALSE;		}	}