private boolean parseCommonParameter(
     final String name, final String[] values, final Request request) throws ResourceException {
   if (name.equalsIgnoreCase(PARAM_FIELDS)) {
     for (final String s : values) {
       try {
         request.addField(s.split(","));
       } catch (final IllegalArgumentException e) {
         // FIXME: i18n.
         throw new BadRequestException(
             "The value '"
                 + s
                 + "' for parameter '"
                 + name
                 + "' could not be parsed as a comma separated list of JSON pointers");
       }
     }
     return true;
   } else if (name.equalsIgnoreCase(PARAM_PRETTY_PRINT)) {
     // This will be handled by the completionHandlerFactory, so just validate.
     asBooleanValue(name, values);
     return true;
   } else {
     // Unrecognized - must be request specific.
     return false;
   }
 }
 private Promise<ResourceResponse, ResourceException> evaluate(
     final Request request, final Script script) throws ScriptException {
   Object result = script.eval();
   ResourcePath resourcePath = request.getResourcePathObject();
   if (null == result) {
     return new NotFoundException("script returned null").asPromise();
   }
   JsonValue resultJson =
       (result instanceof JsonValue) ? (JsonValue) result : new JsonValue(result);
   // If the resultJson isn't able to provide an ID, then we default to the resourcePath.
   String id = resultJson.get(ResourceResponse.FIELD_CONTENT_ID).defaultTo("").asString();
   if (id.isEmpty() && resourcePath.size() > 0) {
     id = resourcePath.leaf();
   }
   return newResourceResponse(id, null, resultJson).asPromise();
 }