Package org.exist.xquery

Examples of org.exist.xquery.Variable


   
    final RequestModule myModule =
      (RequestModule) context.getModule(RequestModule.NAMESPACE_URI);

    // request object is read from global variable $request
    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.");}

    // get parameters
    final String uploadParamName = args[0].getStringValue();

    final JavaObjectValue value = (JavaObjectValue) var.getValue().itemAt(0);
    if (value.getObject() instanceof RequestWrapper) {
      final RequestWrapper request = (RequestWrapper)value.getObject();
      final List<String> fnames = request.getUploadedFileName(uploadParamName);
      if(fnames == null) {
        return Sequence.EMPTY_SEQUENCE;
View Full Code Here


       
                final RequestModule myModule =
                        (RequestModule) context.getModule(RequestModule.NAMESPACE_URI);

                // request object is read from global variable $request
                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()).getHeaderNames(); e.hasMoreElements();)
                        {
View Full Code Here

    throws XPathException {
   
    final RequestModule myModule = (RequestModule)context.getModule(RequestModule.NAMESPACE_URI);
   
    // request object is read from global variable $request
    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 String path = ((RequestWrapper) value.getObject()).getPathInfo();
            return new StringValue(path == null ? "" : path);
        } else
      {throw new XPathException(this, "Variable $request is not bound to a Request object.");}
View Full Code Here

    }
   
    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 == null || var.getValue() == null ) {
      throw( new XPathException( this, "Request not set" ) );
    }

    if( var.getValue().getItemType() != Type.JAVA_OBJECT ) {
      throw( new XPathException( this, "Variable $request is not bound to a Java object." ) );
    }

    JavaObjectValue request = (JavaObjectValue)var.getValue().itemAt( 0 );
   
    // get attribute name parameter
    String attribName     = getArgument( 0 ).eval( contextSequence, contextItem ).getStringValue();
    Sequence attribValue   = getArgument( 1 ).eval( contextSequence, contextItem );
   
View Full Code Here

    BooleanValue exists = BooleanValue.TRUE;
   
    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 == null || var.getValue() == null ) {
      exists = BooleanValue.FALSE;
    }
     
    return( exists );
  }
View Full Code Here

  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 $request
    final Variable var = myModule.resolveVariable(RequestModule.REQUEST_VAR);
    if (var == null || var.getValue() == null || var.getValue().getItemType() != Type.JAVA_OBJECT) {
      return Sequence.EMPTY_SEQUENCE;
    }

    final JavaObjectValue value = (JavaObjectValue) var.getValue().itemAt(0);
    if (value.getObject() instanceof RequestWrapper)
    {
      final Cookie[] cookies = ((RequestWrapper)value.getObject()).getCookies();
      if(cookies != null)
      {
View Full Code Here

   
    final RequestModule myModule =
      (RequestModule) context.getModule(RequestModule.NAMESPACE_URI);

    // request object is read from global variable $request
    final Variable var = myModule.resolveVariable(RequestModule.REQUEST_VAR);
    if (var == null || var.getValue() == null || 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 String queryString = ((RequestWrapper) value.getObject()).getQueryString();
      if(queryString != null)
View Full Code Here

    throws XPathException {
   
    final RequestModule myModule = (RequestModule)context.getModule(RequestModule.NAMESPACE_URI);
   
    // request object is read from global variable $request
    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) {
      return new StringValue(((RequestWrapper) value.getObject()).getServerName());
    } else
      {throw new XPathException(this, "Variable $request is not bound to a Request object.");}
  }
View Full Code Here

    throws XPathException {
   
    final RequestModule myModule = (RequestModule)context.getModule(RequestModule.NAMESPACE_URI);
   
    // request object is read from global variable $request
    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) {
      return new StringValue(((RequestWrapper) value.getObject()).getRequestURL().toString());
    } else
      {throw new XPathException(this, "Variable $request is not bound to a Request object.");}
View Full Code Here

    throws XPathException {
   
    final RequestModule myModule = (RequestModule)context.getModule(RequestModule.NAMESPACE_URI);
   
    // request object is read from global variable $request
    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 RequestWrapper wrapper = (RequestWrapper) value.getObject();
            final Object attr = wrapper.getAttribute(XQueryURLRewrite.RQ_ATTR_REQUEST_URI);
            if (attr == null || isCalledAs("get-effective-uri"))
          {return new AnyURIValue(wrapper.getRequestURI());}
View Full Code Here

TOP

Related Classes of org.exist.xquery.Variable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.