Exemplo n.º 1
0
 /**
  * Performs the retrieve function.
  *
  * @param ctx query context
  * @return {@code null}
  * @throws QueryException query exception
  */
 private B64Stream retrieve(final QueryContext ctx) throws QueryException {
   final Data data = data(0, ctx);
   final String path = path(1, ctx);
   final IOFile file = data.meta.binary(path);
   if (file == null || !file.exists() || file.isDir()) RESFNF.thrw(input, path);
   return new B64Stream(file, DBERR);
 }
Exemplo n.º 2
0
 /**
  * Performs the content-type function.
  *
  * @param ctx query context
  * @return result
  * @throws QueryException query exception
  */
 private Str contentType(final QueryContext ctx) throws QueryException {
   final Data data = data(0, ctx);
   final String path = path(1, ctx);
   if (data.resources.doc(path) != -1) return Str.get(MimeTypes.APP_XML);
   final IOFile io = data.meta.binary(path);
   if (!io.exists() || io.isDir()) RESFNF.thrw(input, path);
   return Str.get(MimeTypes.get(path));
 }