Example #1
0
 /**
  * Processes the HTTP request. Parses new modules and discards obsolete ones.
  *
  * @param http HTTP context
  * @throws Exception exception
  */
 void process(final HTTPContext http) throws Exception {
   try {
     module.process(http, this);
   } catch (final QueryException ex) {
     if (ex.file() == null) ex.info(function.info);
     throw ex;
   }
 }
Example #2
0
  @Override
  protected void run(final HTTPContext http) throws Exception {
    // authenticate user
    http.authenticate();

    // analyze input path
    final RestXqModules rxm = RestXqModules.get();
    // select XQuery function
    RestXqFunction func = rxm.find(http, null);
    if (func == null) throw HTTPCode.NO_XQUERY.get();

    try {
      // process function that matches the current request
      func.process(http, null);
    } catch (final QueryException ex) {
      // process optional error function
      func = rxm.find(http, ex.qname());
      if (func == null) throw ex;
      func.process(http, ex);
    }
  }