Package org.exist.xquery.functions.request

Examples of org.exist.xquery.functions.request.RequestModule


     *
     * @return  The user or null if there is no session or no user
     */
    public Subject getUserFromHttpSession()
    {
        final RequestModule myModule = (RequestModule)getModule( RequestModule.NAMESPACE_URI );

        //Sanity check : one may *not* want to bind the module !
        if( myModule == null ) {
            return( null );
        }

        Variable var = null;

        try {
            var = myModule.resolveVariable( RequestModule.REQUEST_VAR );
        }
        catch( final XPathException xpe ) {
            return( null );
        }

View Full Code Here


   * @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);
View Full Code Here

    final SessionModule sessionModule = (SessionModule)context.getModule( SessionModule.NAMESPACE_URI );
        Variable var = sessionModule.resolveVariable( SessionModule.SESSION_VAR );
   
    if( createSession && ( var == null || var.getValue() == null ) ) {
      SessionWrapper session  = null;
      final RequestModule reqModule = (RequestModule)context.getModule( RequestModule.NAMESPACE_URI );
   
      // request object is read from global variable $request
      final Variable reqVar = reqModule.resolveVariable( RequestModule.REQUEST_VAR );
     
      if( reqVar == null || reqVar.getValue() == null ) {
          logger.error("No request object found in the current XQuery context.");

          throw( new XPathException( this, "No request object found in the current XQuery context." ) );
View Full Code Here

   */
  static JavaObjectValue createSession( XQueryContext context, Function fn ) throws XPathException
  {
    JavaObjectValue ret = null;
   
    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( fn, "No request object found in the current XQuery context." ) );
    }
 
View Full Code Here

TOP

Related Classes of org.exist.xquery.functions.request.RequestModule

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.