Esempio n. 1
0
  /** @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */
  @Override
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws RequestBodyExceededException, IOException {
    try {
      Document document = ServletHandlingUtils.extractXMLRequestDocument(request);
      Map<String, String[]> parameterMap = createParameterMapFromDocument(document);
      // we're going to treat this as a GetObservation by default if not specified
      parameterMap = applyBusinessRules(parameterMap);
      queryAndSend(request, response, parameterMap);

    } catch (RequestBodyExceededException rbe) {
      // If we get errors in the request parsing, then just send the error
      int errorCode =
          (rbe.errorCode != null) ? rbe.errorCode : 403; // 403 as default value for error code
      rbe.printStackTrace();
      response.sendError(errorCode, rbe.getMessage());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }