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);
if (value.getObject() instanceof RequestWrapper) {
final ValueSequence result = new ValueSequence();
for (final Enumeration<String> e =
((RequestWrapper) value.getObject()).getParameterNames();
e.hasMoreElements();
) {
final String param = e.nextElement();
result.add(new StringValue(param));
}