* @see org.exist.xquery.BasicFunction#eval(org.exist.xquery.value.Sequence[], org.exist.xquery.value.Sequence)
*/
public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException
{
final RequestModule myModule = (RequestModule)context.getModule(RequestModule.NAMESPACE_URI);
// request object is read from global variable $session
final Variable var = myModule.resolveVariable(RequestModule.REQUEST_VAR);
if(var == null || var.getValue() == null)
{throw new XPathException(this, "No request object found in the current XQuery context.");}
if (var.getValue().getItemType() != Type.JAVA_OBJECT)
{throw new XPathException(this, "Variable $request is not bound to an Java object.");}
final JavaObjectValue value = (JavaObjectValue) var.getValue().itemAt(0);