ValidationResult validateUri(URL url, ValidationRequest request) throws IOException {
    String parser = request.getValue("parser", null);
    HttpRequestBase method;
    List<NameValuePair> qParams = new ArrayList<NameValuePair>();
    qParams.add(new BasicNameValuePair("out", "json"));
    if (parser != null) {
      qParams.add(new BasicNameValuePair("parser", parser));
    }
    qParams.add(new BasicNameValuePair("doc", url.toString()));

    try {
      URI uri = new URI(baseUrl);
      URI uri2 =
          URIUtils.createURI(
              uri.getScheme(),
              uri.getHost(),
              uri.getPort(),
              uri.getPath(),
              URLEncodedUtils.format(qParams, "UTF-8"),
              null);
      method = new HttpGet(uri2);
      return validate(method);
    } catch (URISyntaxException e) {
      throw new IllegalArgumentException("invalid uri. Check your baseUrl " + baseUrl, e);
    }
  }
 public ValidationResult validateContent(InputStream inputStream, ValidationRequest request)
     throws IOException {
   String parser = request.getValue("parser", null);
   HttpRequestBase method;
   HttpPost httpPost = new HttpPost(baseUrl + "?out=json&parser=" + parser);
   httpPost.addHeader("Content-Type", "text/html");
   InputStreamEntity inputStreamEntity = new InputStreamEntity(inputStream, -1);
   httpPost.setEntity(inputStreamEntity);
   method = httpPost;
   return validate(method);
 }