Ejemplo n.º 1
0
  public static String getURLContent(final String uri) {

    try {
      StringBuffer content = new StringBuffer();
      HttpUtil.getURLContent(uri, content);
      return content.toString();
    } catch (Exception e) {
      // TODO: handle this error
      Logger.error(
          "org.pentaho.platform.util.web.HttpUtil",
          Messages.getInstance().getErrorString("HttpUtil.ERROR_0001_URL_ERROR", e.getMessage()),
          e); //$NON-NLS-1$ //$NON-NLS-2$
      return null;
    }
  }
Ejemplo n.º 2
0
  public static Reader getURLReader(final String uri) {

    try {
      URL url = new URL(uri);
      HttpURLConnection connection = (HttpURLConnection) url.openConnection();
      connection.connect();
      InputStream in = connection.getInputStream();
      return new InputStreamReader(in);
    } catch (Exception e) {
      // TODO: handle this error
      Logger.error(
          HttpUtil.class.getName(),
          Messages.getInstance().getErrorString("HttpUtil.ERROR_0001_URL_ERROR", e.getMessage()),
          e); //$NON-NLS-1$
      return null;
    }
  }
Ejemplo n.º 3
0
  public static InputStream getURLInputStream(final String uri) {

    try {
      URL url = new URL(uri);
      HttpURLConnection connection = (HttpURLConnection) url.openConnection();
      connection.connect();
      InputStream in = connection.getInputStream();
      return in;
    } catch (Exception e) {
      // TODO: handle this error
      Logger.error(
          "org.pentaho.platform.util.web.HttpUtil",
          Messages.getInstance().getErrorString("HttpUtil.ERROR_0001_URL_ERROR", e.getMessage()),
          e); //$NON-NLS-1$ //$NON-NLS-2$
      return null;
    }
  }