Beispiel #1
0
  /**
   * Validate the request, checking HTTP method and HTTP Parameters.
   *
   * @param action HTTP Action
   */
  @Override
  protected void validate(HttpAction action) {
    String method = action.request.getMethod().toUpperCase(Locale.ROOT);

    if (HttpNames.METHOD_OPTIONS.equals(method)) return;

    if (!HttpNames.METHOD_POST.equals(method) && !HttpNames.METHOD_GET.equals(method))
      ServletOps.errorMethodNotAllowed("Not a GET or POST request");

    if (HttpNames.METHOD_GET.equals(method) && action.request.getQueryString() == null) {
      ServletOps.warning(
          action, "Service Description / SPARQL Query / " + action.request.getRequestURI());
      ServletOps.errorNotFound("Service Description: " + action.request.getRequestURI());
    }

    // Use of the dataset describing parameters is check later.
    try {
      validateParams(action, allParams);
      validateRequest(action);
    } catch (ActionErrorException ex) {
      throw ex;
    }
    // Query not yet parsed.
  }