Package org.exist.xquery

Examples of org.exist.xquery.Variable


    throws XPathException {
   
    final SessionModule myModule = (SessionModule) context.getModule(SessionModule.NAMESPACE_URI);

    // session object is read from global variable $session
    final Variable var = myModule.resolveVariable(SessionModule.SESSION_VAR);
    if(var == null || var.getValue() == null)
      {throw new XPathException(this, "Session not set");}
    if (var.getValue().getItemType() != Type.JAVA_OBJECT)
      {throw new XPathException(this, "Variable $session is not bound to an Java object.");}
    final JavaObjectValue session = (JavaObjectValue) var.getValue().itemAt(0);
   
    if(session.getObject() instanceof SessionWrapper)
    {
      final ValueSequence result = new ValueSequence();
      final SessionWrapper sessionWrapper = (SessionWrapper)session.getObject();
View Full Code Here


  {
   
    final SessionModule myModule = (SessionModule) context.getModule(SessionModule.NAMESPACE_URI);

    //session object is read from global variable $session
    final Variable var = myModule.resolveVariable(SessionModule.SESSION_VAR);
    if(var == null || var.getValue() == null)
      {throw new XPathException(this, "Session not set");}
    if (var.getValue().getItemType() != Type.JAVA_OBJECT)
      {throw new XPathException(this, "Variable $session is not bound to an Java object.");}
    final JavaObjectValue session = (JavaObjectValue) var.getValue().itemAt(0);
   
    if(session.getObject() instanceof SessionWrapper)
    {
      final SessionWrapper sessionWrapper = (SessionWrapper)session.getObject();
      for(final Enumeration<String> e = sessionWrapper.getAttributeNames(); e.hasMoreElements();)
View Full Code Here

        }
       
    final SessionModule myModule = (SessionModule)context.getModule( SessionModule.NAMESPACE_URI );

    // session object is read from global variable $session
    final Variable var = myModule.resolveVariable( SessionModule.SESSION_VAR );
   
    if( var == null || var.getValue() == null ) {
      // No saved session, so create one
      session = SessionModule.createSession( context, this );
    } else if( var.getValue().getItemType() != Type.JAVA_OBJECT ) {
      throw( new XPathException( this, "Variable $session is not bound to a Java object." ) );
    } else {
      session = (JavaObjectValue)var.getValue().itemAt( 0 );
    }
   
    // get attribute name parameter
    final String attribName = getArgument(0).eval( contextSequence, contextItem ).getStringValue();
    final Sequence attribValue = getArgument(1).eval( contextSequence, contextItem) ;
View Full Code Here

        }
       
    final SessionModule myModule = (SessionModule)context.getModule(SessionModule.NAMESPACE_URI);

    // session object is read from global variable $session
    final Variable var = myModule.resolveVariable(SessionModule.SESSION_VAR);
    if(var == null || var.getValue() == null)
      {throw new XPathException(this, "Session not set");}
    if(var.getValue().getItemType() != Type.JAVA_OBJECT)
      {throw new XPathException(this, "Variable $session is not bound to a Java object.");}
    final JavaObjectValue session = (JavaObjectValue) var.getValue().itemAt(0);
   
    // get attribute name parameter
    final String attrib = getArgument(0).eval(contextSequence, contextItem).getStringValue();
    if(session.getObject() instanceof SessionWrapper)
      {((SessionWrapper)session.getObject()).removeAttribute(attrib);}
View Full Code Here

        }

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

        // response object is read from global variable $response
        final Variable       var      = myModule.resolveVariable( ResponseModule.RESPONSE_VAR );

        if( ( var == null ) || ( var.getValue() == null ) ) {
            throw( new XPathException( this, "Response not set" ) );
        }

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

        //get parameters
        final String          name      = getArgument( 0 ).eval( contextSequence, contextItem ).getStringValue();
        final String          value     = getArgument( 1 ).eval( contextSequence, contextItem ).getStringValue();
View Full Code Here

        BooleanValue   exists   = BooleanValue.TRUE;

        ResponseModule myModule = (ResponseModule)context.getModule( ResponseModule.NAMESPACE_URI );

        // response object is read from global variable $response
        Variable       var      = myModule.resolveVariable( ResponseModule.RESPONSE_VAR );

        if( ( var == null ) || ( var.getValue() == null ) ) {
            exists = BooleanValue.FALSE;
        }

        return( exists );
    }
View Full Code Here

        }

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

        // response object is read from global variable $response
        final Variable       var      = myModule.resolveVariable( ResponseModule.RESPONSE_VAR );

        if( ( var == null ) || ( var.getValue() == null ) ) {
            throw( new XPathException( this, "Response not set" ) );
        }

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

        //get parameters
        final String          name     = getArgument( 0 ).eval( contextSequence, contextItem ).getStringValue();
        final long            value    = new DateTimeValue( getArgument( 1 ).eval( contextSequence, contextItem ).getStringValue() ).getDate().getTime();
View Full Code Here

        }

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

        // response object is read from global variable $response
        final Variable respVar = myModule.resolveVariable(ResponseModule.RESPONSE_VAR);

        if((respVar == null) || (respVar.getValue() == null)) {
            throw (new XPathException(this, "No response object found in the current XQuery context."));
        }

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

        final JavaObjectValue respValue = (JavaObjectValue) respVar.getValue().itemAt(0);

        if(!"org.exist.http.servlets.HttpResponseWrapper".equals(respValue.getObject().getClass().getName())) {
            throw (new XPathException(this, signature.toString() + " can only be used within the EXistServlet or XQueryServlet"));
        }
View Full Code Here

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

        final String         redirectURI = args[0].getStringValue();

        // response object is read from global variable $response
        final Variable       var         = myModule.resolveVariable( ResponseModule.RESPONSE_VAR );

        if( ( var == null ) || ( var.getValue() == null ) ) {
            throw( new XPathException( this, "No response object found in the current XQuery context." ) );
        }

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

        final JavaObjectValue value = (JavaObjectValue)var.getValue().itemAt( 0 );

        if( value.getObject() instanceof ResponseWrapper ) {

            try {
                ( (ResponseWrapper)value.getObject() ).sendRedirect( redirectURI );
View Full Code Here

        }

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

        // response object is read from global variable $response
        final Variable       var      = myModule.resolveVariable( ResponseModule.RESPONSE_VAR );

        if( ( var == null ) || ( var.getValue() == null ) ) {
            throw( new XPathException( this, "Response not set" ) );
        }

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

        //get parameters
        final String          name     = getArgument( 0 ).eval( contextSequence, contextItem ).getStringValue();
        final String          value    = getArgument( 1 ).eval( contextSequence, contextItem ).getStringValue();
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.