<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: [Tutorial] Accessing the TinyURL &#8220;API&#8221; from Java</title>
	<atom:link href="http://www.mularien.com/blog/2008/12/04/tutorial-accessing-the-tinyurl-api-from-java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mularien.com/blog/2008/12/04/tutorial-accessing-the-tinyurl-api-from-java/</link>
	<description>Notes by Peter Mularien on Hibernate, Spring, CSS, Java, etc.</description>
	<lastBuildDate>Sun, 05 Sep 2010 11:03:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: dBune</title>
		<link>http://www.mularien.com/blog/2008/12/04/tutorial-accessing-the-tinyurl-api-from-java/comment-page-1/#comment-29508</link>
		<dc:creator>dBune</dc:creator>
		<pubDate>Wed, 25 Aug 2010 15:56:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.mularien.com/blog/?p=84#comment-29508</guid>
		<description>Thanks Peter for sharing the code, and thanks gdoko for the improvements, yes the warnings are gone with the corrected code.</description>
		<content:encoded><![CDATA[<p>Thanks Peter for sharing the code, and thanks gdoko for the improvements, yes the warnings are gone with the corrected code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: &#187; [Tutorial] URL Shortening in Java using bit.ly &#8211; It&#8217;s Only Software</title>
		<link>http://www.mularien.com/blog/2008/12/04/tutorial-accessing-the-tinyurl-api-from-java/comment-page-1/#comment-20938</link>
		<dc:creator>&#187; [Tutorial] URL Shortening in Java using bit.ly &#8211; It&#8217;s Only Software</dc:creator>
		<pubDate>Tue, 01 Dec 2009 05:19:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.mularien.com/blog/?p=84#comment-20938</guid>
		<description>[...] while ago, I had written up a tutorial on accessing the TinyURL API from Java. I was recently playing with the bit.ly API and decided to write up a quick tutorial on generating [...]</description>
		<content:encoded><![CDATA[<p>[...] while ago, I had written up a tutorial on accessing the TinyURL API from Java. I was recently playing with the bit.ly API and decided to write up a quick tutorial on generating [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gdoko</title>
		<link>http://www.mularien.com/blog/2008/12/04/tutorial-accessing-the-tinyurl-api-from-java/comment-page-1/#comment-15738</link>
		<dc:creator>gdoko</dc:creator>
		<pubDate>Tue, 30 Jun 2009 08:19:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.mularien.com/blog/?p=84#comment-15738</guid>
		<description>Thanks Peter for taking the time to post this. In case someone has difficulties with making the sample code run; try to download: commons-httpclient-3.1.jar, commons-logging-1.1.1.jar, and commons-codec-1.3.jar. Additionally, in order to have the code working without any warnings (due to getResponseBodyAsStream) you can use the following slightly modified version:
&lt;code&gt;
import java.io.InputStream;
import java.io.IOException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
 
public abstract class TinyURL {
	public static String getTinyUrl( String fullUrl ) throws HttpException, IOException {

		HttpClient httpclient = new HttpClient();
		HttpMethod method = new GetMethod( &quot;http://tinyurl.com/api-create.php&quot; ); 
		method.setQueryString( new NameValuePair[] { new NameValuePair( &quot;url&quot;, fullUrl ) } );
		httpclient.executeMethod( method );

		InputStream is = method.getResponseBodyAsStream();
		StringBuffer sb = new StringBuffer();
		for( int i = is.read(); i != -1; i = is.read() ) {
			sb.append( (char) i );
		}

		String tinyUrl = sb.toString();
		method.releaseConnection();
		return tinyUrl;
	}
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Thanks Peter for taking the time to post this. In case someone has difficulties with making the sample code run; try to download: commons-httpclient-3.1.jar, commons-logging-1.1.1.jar, and commons-codec-1.3.jar. Additionally, in order to have the code working without any warnings (due to getResponseBodyAsStream) you can use the following slightly modified version:<br />
<pre><code>import java.io.InputStream;
import java.io.IOException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
 
public abstract class TinyURL {
	public static String getTinyUrl( String fullUrl ) throws HttpException, IOException {

		HttpClient httpclient = new HttpClient();
		HttpMethod method = new GetMethod( "http://tinyurl.com/api-create.php" ); 
		method.setQueryString( new NameValuePair[] { new NameValuePair( "url", fullUrl ) } );
		httpclient.executeMethod( method );

		InputStream is = method.getResponseBodyAsStream();
		StringBuffer sb = new StringBuffer();
		for( int i = is.read(); i != -1; i = is.read() ) {
			sb.append( (char) i );
		}

		String tinyUrl = sb.toString();
		method.releaseConnection();
		return tinyUrl;
	}
}</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tweeting tiny URLs using Java &#171; Scotsman on a Horse</title>
		<link>http://www.mularien.com/blog/2008/12/04/tutorial-accessing-the-tinyurl-api-from-java/comment-page-1/#comment-12294</link>
		<dc:creator>Tweeting tiny URLs using Java &#171; Scotsman on a Horse</dc:creator>
		<pubDate>Fri, 08 May 2009 15:00:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.mularien.com/blog/?p=84#comment-12294</guid>
		<description>[...] » [Tutorial] Accessing the TinyURL “API” from Java &#8211; It’s Only Software Recently, I poked around and wrote up a simple Java method to, given a URL (TinyURL supports only GET requests), generate a TinyURL from it in Java. This is really the only “API” supported by the TinyURL service, but it’s a handy one!   Published in: [...]</description>
		<content:encoded><![CDATA[<p>[...] » [Tutorial] Accessing the TinyURL “API” from Java &#8211; It’s Only Software Recently, I poked around and wrote up a simple Java method to, given a URL (TinyURL supports only GET requests), generate a TinyURL from it in Java. This is really the only “API” supported by the TinyURL service, but it’s a handy one!   Published in: [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pmularien</title>
		<link>http://www.mularien.com/blog/2008/12/04/tutorial-accessing-the-tinyurl-api-from-java/comment-page-1/#comment-7811</link>
		<dc:creator>pmularien</dc:creator>
		<pubDate>Wed, 04 Feb 2009 19:44:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.mularien.com/blog/?p=84#comment-7811</guid>
		<description>@DLackey
For internal use? Or because you can&#039;t hit the TinyURL site from behind the firewall?

If you&#039;re planning on rolling your own service, have a look at this answer on LinkedIn: &lt;a href=&quot;http://www.linkedin.com/answers/technology/software-development/TCH_SFT/200183-210097?browseCategory=TCH_WDD&quot; rel=&quot;nofollow&quot;&gt;Link&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>@DLackey<br />
For internal use? Or because you can&#8217;t hit the TinyURL site from behind the firewall?</p>
<p>If you&#8217;re planning on rolling your own service, have a look at this answer on LinkedIn: <a href="http://www.linkedin.com/answers/technology/software-development/TCH_SFT/200183-210097?browseCategory=TCH_WDD" rel="nofollow">Link</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DLackey</title>
		<link>http://www.mularien.com/blog/2008/12/04/tutorial-accessing-the-tinyurl-api-from-java/comment-page-1/#comment-7639</link>
		<dc:creator>DLackey</dc:creator>
		<pubDate>Fri, 30 Jan 2009 19:31:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.mularien.com/blog/?p=84#comment-7639</guid>
		<description>I would be interested in how to build a tinyurl generate for use within a corporate lan and behind a firewall.  Can you offer any insight or direction on how to do this?</description>
		<content:encoded><![CDATA[<p>I would be interested in how to build a tinyurl generate for use within a corporate lan and behind a firewall.  Can you offer any insight or direction on how to do this?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
