/*
 *  Copyright 2011 Eric F. Savage, code@efsavage.com
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */
package com.ajah.util.net;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

/**
 * Simple HTTP client that depends only on JDK libraries. For production-level
 * code, use a more robust solution.
 * 
 * @author <a href="http://efsavage.com">Eric F. Savage</a>, <a
 *         href="mailto:code@efsavage.com">code@efsavage.com</a>.
 * 
 */
public class HttpClient {

	/**
	 * Get an {@link InputStream} of the target URL.
	 * 
	 * @param cssFile
	 * @return The results of the URL, if possible, or null.
	 * @throws IOException
	 */
	public static InputStream stream(String cssFile) throws IOException {
		try {
			URL ur = new URL(cssFile);
			URLConnection conn;
			conn = ur.openConnection();
			return conn.getInputStream();
		} catch (MalformedURLException e) {
			return null;
		}
	}

}

@@ -1165,23 +1165,52 @@
  @param 
-cssFile
+url%0A%09 *            The URL to fetch.
 %0A%09 * @re
@@ -1284,16 +1284,66 @@
 ception%0A
+%09 *             If the file could not be fetched.%0A
 %09 */%0A%09pu
@@ -1380,23 +1380,19 @@
 (String 
-cssFile
+url
 ) throws
@@ -1438,15 +1438,11 @@
 URL(
-cssFile
+url
 );%0A%09
@@ -1589,10 +1589,603 @@
 %09%09%7D%0A%09%7D%0A%0A
+%09/**%0A%09 * Get a string version of the target URL.%0A%09 * %0A%09 * @param url%0A%09 *            The URL to fetch.%0A%09 * @return The results of the URL, if possible, or null.%0A%09 * @throws IOException%0A%09 *             If the file could not be fetched.%0A%09 */%0A%09public static String getString(String url) throws IOException %7B%0A%09%09try %7B%0A%09%09%09URL ur = new URL(url);%0A%09%09%09URLConnection conn;%0A%09%09%09conn = ur.openConnection();%0A%09%09%09Object content = conn.getContent();%0A%09%09%09if (content instanceof String) %7B%0A%09%09%09%09return (String) content;%0A%09%09%09%7D%0A%09%09%09return content.toString();%0A%09%09%7D catch (MalformedURLException e) %7B%0A%09%09%09return null;%0A%09%09%7D%0A%09%7D%0A%0A
 %7D%0A

Add getString()