<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2enclosuresfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" 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/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>IgorShare Weblog</title>
	
	<link>http://igorshare.wordpress.com</link>
	<description>Practical Engineering</description>
	<lastBuildDate>Mon, 13 Jul 2009 14:55:25 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<image>
		<url>http://www.gravatar.com/blavatar/3e81c82619fe2ddae5ef1340b5d57788?s=96&amp;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>IgorShare Weblog</title>
		<link>http://igorshare.wordpress.com</link>
	</image>
			<itunes:explicit>no</itunes:explicit><itunes:subtitle>Practical Engineering</itunes:subtitle><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/IgorshareWeblog" type="application/rss+xml" /><item>
		<title>Web Form Validation: Best Practices and Tutorials</title>
		<link>http://feedproxy.google.com/~r/IgorshareWeblog/~3/6VVMR4DWa6E/</link>
		<comments>http://igorshare.wordpress.com/2009/07/09/web-form-validation-best-practices-and-tutorials/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 16:02:58 +0000</pubDate>
		<dc:creator>igormoochnick</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://igorshare.wordpress.com/2009/07/09/web-form-validation-best-practices-and-tutorials/</guid>
		<description><![CDATA[
Great article about forms and ways of implementing data validation for the web applications.
Highly advised to read.
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=289&subd=igorshare&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img style="display:inline;margin:5px 20px 20px 0;" alt="validation" align="left" src="http://media2.smashingmagazine.com/wp-content/uploads/images/web-form-validation/validation.png" />
<p><a href="http://www.smashingmagazine.com/2009/07/07/web-form-validation-best-practices-and-tutorials/">Great article</a> about forms and ways of implementing data validation for the web applications.</p>
<p>Highly advised to read.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/igorshare.wordpress.com/289/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/igorshare.wordpress.com/289/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/igorshare.wordpress.com/289/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/igorshare.wordpress.com/289/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/igorshare.wordpress.com/289/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/igorshare.wordpress.com/289/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/igorshare.wordpress.com/289/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/igorshare.wordpress.com/289/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/igorshare.wordpress.com/289/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/igorshare.wordpress.com/289/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=289&subd=igorshare&ref=&feed=1" /></div>
<p><a href="http://feedads.g.doubleclick.net/~a/Qoxjzl6zbJqXtl6jETyDXdh6TQE/0/da"><img src="http://feedads.g.doubleclick.net/~a/Qoxjzl6zbJqXtl6jETyDXdh6TQE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Qoxjzl6zbJqXtl6jETyDXdh6TQE/1/da"><img src="http://feedads.g.doubleclick.net/~a/Qoxjzl6zbJqXtl6jETyDXdh6TQE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/IgorshareWeblog/~4/6VVMR4DWa6E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://igorshare.wordpress.com/2009/07/09/web-form-validation-best-practices-and-tutorials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/96b0fd2825bdeb9f9039b1259156b91b?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">IgorM</media:title>
		</media:content>

		<media:content url="http://media2.smashingmagazine.com/wp-content/uploads/images/web-form-validation/validation.png" medium="image">
			<media:title type="html">validation</media:title>
		</media:content>
	<feedburner:origLink>http://igorshare.wordpress.com/2009/07/09/web-form-validation-best-practices-and-tutorials/</feedburner:origLink></item>
		<item>
		<title>The importance of nightly builds (hilarious)!</title>
		<link>http://feedproxy.google.com/~r/IgorshareWeblog/~3/M213fHPR4QQ/</link>
		<comments>http://igorshare.wordpress.com/2009/07/08/the-importance-of-nightly-builds-hilarious/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 15:57:49 +0000</pubDate>
		<dc:creator>igormoochnick</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Continous Integration]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://igorshare.wordpress.com/2009/07/08/the-importance-of-nightly-builds-hilarious/</guid>
		<description><![CDATA[I’ve preached to all my customers and co-workers the importance of Continuous Integration. Now I’ll be pointing them to this training course – they’ll learn and will have fun at the same time.
It’s hilarious!
  
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=288&subd=igorshare&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I’ve preached to all my customers and co-workers the importance of Continuous Integration. Now I’ll be pointing them to this training course – they’ll learn and will have fun at the same time.</p>
<p>It’s hilarious!</p>
<p>  <span style="text-align:center; display: block;"><a href="http://igorshare.wordpress.com/2009/07/08/the-importance-of-nightly-builds-hilarious/"><img src="http://img.youtube.com/vi/Azl4nqLn4-Y/2.jpg" alt="" /></a></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/igorshare.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/igorshare.wordpress.com/288/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/igorshare.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/igorshare.wordpress.com/288/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/igorshare.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/igorshare.wordpress.com/288/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/igorshare.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/igorshare.wordpress.com/288/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/igorshare.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/igorshare.wordpress.com/288/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=288&subd=igorshare&ref=&feed=1" /></div>
<p><a href="http://feedads.g.doubleclick.net/~a/qlHtsCTJmDBsLYAY0fWWvWspI7o/0/da"><img src="http://feedads.g.doubleclick.net/~a/qlHtsCTJmDBsLYAY0fWWvWspI7o/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/qlHtsCTJmDBsLYAY0fWWvWspI7o/1/da"><img src="http://feedads.g.doubleclick.net/~a/qlHtsCTJmDBsLYAY0fWWvWspI7o/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/IgorshareWeblog/~4/M213fHPR4QQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://igorshare.wordpress.com/2009/07/08/the-importance-of-nightly-builds-hilarious/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/96b0fd2825bdeb9f9039b1259156b91b?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">IgorM</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/Azl4nqLn4-Y/2.jpg" medium="image" />
	<feedburner:origLink>http://igorshare.wordpress.com/2009/07/08/the-importance-of-nightly-builds-hilarious/</feedburner:origLink></item>
		<item>
		<title>Adding Watermark to GWT Textbox widget</title>
		<link>http://feedproxy.google.com/~r/IgorshareWeblog/~3/9HbsZgjkF9Y/</link>
		<comments>http://igorshare.wordpress.com/2009/06/30/adding-watermark-to-gwt-textbox-widget/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 17:48:22 +0000</pubDate>
		<dc:creator>igormoochnick</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[GWT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://igorshare.wordpress.com/2009/06/30/adding-watermark-to-gwt-textbox-widget/</guid>
		<description><![CDATA[Let’s see how we can improve our UI by adding some watermarked “spice”:

Let’s define the primary style for the text box (textInput) and the dependent style for the watermark (textInput-watermark):




.textInput {
	border: 1px solid #C9C7BA;
	font-family:Tahoma, Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
	padding-left: 2px;
	padding-top: 2px;
}

.textInput-watermark {
   /* background-image: url(&#039;images/overlay.gif&#039;);
   background-repeat: no-repeat;
   padding-left: 20px;
 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=287&subd=igorshare&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Let’s see how we can improve our UI by adding some watermarked “spice”:</p>
<p><a href="http://igorshare.files.wordpress.com/2009/06/clip_image0011.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="clip_image001" border="0" alt="clip_image001" src="http://igorshare.files.wordpress.com/2009/06/clip_image001_thumb1.png?w=224&#038;h=45" width="224" height="45" /></a></p>
<p>Let’s define the primary style for the text box (<strong>textInput</strong>) and the dependent style for the watermark (<strong>textInput-watermark</strong>):</p>
</p>
<pre>
<pre name="code" class="css">

.textInput {
	border: 1px solid #C9C7BA;
	font-family:Tahoma, Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
	padding-left: 2px;
	padding-top: 2px;
}

.textInput-watermark {
   /* background-image: url(&#039;images/overlay.gif&#039;);
   background-repeat: no-repeat;
   padding-left: 20px;
   vertical-align: middle; */
   font-style: italic;
   color: DarkGray;
}
</pre>
</pre>
<p>Note that the watermark style can contain images as well (see the commented out piece).</p>
<p>After the styles were defined we need to add some code that will apply it to the text box. To do this I’m going to extend the default GWT TextBox. The trick is to hijack the OnBlur and OnFocus events. When the OnBlur is occurring, we’re going to show the watermark and OnFocus – hide it:</p>
<pre>
<pre name="code" class="java">

public class WatermarkedTextBox extends TextBox implements BlurHandler, FocusHandler
{
	String watermark;
	HandlerRegistration blurHandler;
	HandlerRegistration focusHandler;

	public WatermarkedTextBox( )
	{
		super();
		this.setStylePrimaryName(&quot;textInput&quot;);
	}

	public WatermarkedTextBox(String defaultValue)
	{
		this();
		setText(defaultValue);
	}

	public WatermarkedTextBox(String defaultValue, String watermark)
	{
		this(defaultValue);
		setWatermark(watermark);
	}

	/**
	 * Adds a watermark if the parameter is not NULL or EMPTY
	 *
	 * @param watermark
	 */
	public void setWatermark(final String watermark)
	{
		this.watermark = watermark;

		if ((watermark != null) &amp;&amp; (watermark != &quot;&quot;))
		{
			blurHandler = addBlurHandler(this);
			focusHandler = addFocusHandler(this);
			EnableWatermark();
		}
		else
		{
			// Remove handlers
			blurHandler.removeHandler();
			focusHandler.removeHandler();
		}
	}

	@Override
	public void onBlur(BlurEvent event)
	{
		EnableWatermark();
	}

	void EnableWatermark()
	{
		String text = getText();
		if ((text.length() == 0) || (text.equalsIgnoreCase(watermark)))
		{
			// Show watermark
			setText(watermark);
			addStyleDependentName(&quot;watermark&quot;);
		}
	}

	@Override
	public void onFocus(FocusEvent event)
	{
		removeStyleDependentName(&quot;watermark&quot;);

		if (getText().equalsIgnoreCase(watermark))
		{
			// Hide watermark
			setText(&quot;&quot;);
		}
	}
}
</pre>
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/igorshare.wordpress.com/287/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/igorshare.wordpress.com/287/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/igorshare.wordpress.com/287/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/igorshare.wordpress.com/287/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/igorshare.wordpress.com/287/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/igorshare.wordpress.com/287/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/igorshare.wordpress.com/287/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/igorshare.wordpress.com/287/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/igorshare.wordpress.com/287/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/igorshare.wordpress.com/287/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=287&subd=igorshare&ref=&feed=1" /></div>
<p><a href="http://feedads.g.doubleclick.net/~a/cd2FMimFmQBKhFCKKKuawcG2fk8/0/da"><img src="http://feedads.g.doubleclick.net/~a/cd2FMimFmQBKhFCKKKuawcG2fk8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/cd2FMimFmQBKhFCKKKuawcG2fk8/1/da"><img src="http://feedads.g.doubleclick.net/~a/cd2FMimFmQBKhFCKKKuawcG2fk8/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/IgorshareWeblog/~4/9HbsZgjkF9Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://igorshare.wordpress.com/2009/06/30/adding-watermark-to-gwt-textbox-widget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/96b0fd2825bdeb9f9039b1259156b91b?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">IgorM</media:title>
		</media:content>

		<media:content url="http://igorshare.files.wordpress.com/2009/06/clip_image001_thumb1.png" medium="image">
			<media:title type="html">clip_image001</media:title>
		</media:content>
	<feedburner:origLink>http://igorshare.wordpress.com/2009/06/30/adding-watermark-to-gwt-textbox-widget/</feedburner:origLink></item>
		<item>
		<title>Job trends for GWT and jQuery on a sharp rise</title>
		<link>http://feedproxy.google.com/~r/IgorshareWeblog/~3/kSFI0V8S1GY/</link>
		<comments>http://igorshare.wordpress.com/2009/06/11/job-trends-for-gwt-and-jquery-on-a-sharp-rise/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 04:15:19 +0000</pubDate>
		<dc:creator>igormoochnick</dc:creator>
				<category><![CDATA[GWT]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://igorshare.wordpress.com/2009/06/11/job-trends-for-gwt-and-jquery-on-a-sharp-rise/</guid>
		<description><![CDATA[Gotta love this …

       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=284&subd=igorshare&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Gotta love this …</p>
<p><a href="http://igorshare.files.wordpress.com/2009/06/jobgraph1.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="jobgraph[1]" border="0" alt="jobgraph[1]" src="http://igorshare.files.wordpress.com/2009/06/jobgraph1_thumb.png?w=589&#038;h=328" width="589" height="328" /></a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/igorshare.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/igorshare.wordpress.com/284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/igorshare.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/igorshare.wordpress.com/284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/igorshare.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/igorshare.wordpress.com/284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/igorshare.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/igorshare.wordpress.com/284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/igorshare.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/igorshare.wordpress.com/284/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=284&subd=igorshare&ref=&feed=1" /></div>
<p><a href="http://feedads.g.doubleclick.net/~a/wt-8kw9n2tsGrGrjCOPXdOscSpw/0/da"><img src="http://feedads.g.doubleclick.net/~a/wt-8kw9n2tsGrGrjCOPXdOscSpw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/wt-8kw9n2tsGrGrjCOPXdOscSpw/1/da"><img src="http://feedads.g.doubleclick.net/~a/wt-8kw9n2tsGrGrjCOPXdOscSpw/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/IgorshareWeblog/~4/kSFI0V8S1GY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://igorshare.wordpress.com/2009/06/11/job-trends-for-gwt-and-jquery-on-a-sharp-rise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/96b0fd2825bdeb9f9039b1259156b91b?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">IgorM</media:title>
		</media:content>

		<media:content url="http://igorshare.files.wordpress.com/2009/06/jobgraph1_thumb.png" medium="image">
			<media:title type="html">jobgraph[1]</media:title>
		</media:content>
	<feedburner:origLink>http://igorshare.wordpress.com/2009/06/11/job-trends-for-gwt-and-jquery-on-a-sharp-rise/</feedburner:origLink></item>
		<item>
		<title>Recent “Application Patters for the Cloud” presentation for Boston Architect factory</title>
		<link>http://feedproxy.google.com/~r/IgorshareWeblog/~3/47zptUXly_c/</link>
		<comments>http://igorshare.wordpress.com/2009/06/10/recent-application-patters-for-the-cloud-presentation-for-boston-architect-factory/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 23:43:57 +0000</pubDate>
		<dc:creator>igormoochnick</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[S+S]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://igorshare.wordpress.com/2009/06/10/recent-application-patters-for-the-cloud-presentation-for-boston-architect-factory/</guid>
		<description><![CDATA[&#160;
Thanks for all the attendees. You’ve made this event a success! Thanks to all the organizers – without you this would have never happened.
&#160;
You can find all the pictures are on Flickr and all the the presentations are hosted on the on Architect Factory collateral page (hosted on Azure Cloud).
You can access my presentation directly [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=280&subd=igorshare&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a title="Igor Moochnick" href="http://www.flickr.com/photos/38284634@N00/3592411776/"><img border="0" alt="Igor Moochnick" src="http://static.flickr.com/3416/3592411776_2050da414f.jpg" /></a>&#160;</p>
<p>Thanks for all the attendees. You’ve made this event a success! Thanks to all the organizers – without you this would have never happened.</p>
<p>&#160;</p>
<p>You can find all the pictures are <a href="http://www.flickr.com/groups/arcfactory">on Flickr</a> and all the the presentations are hosted on the on <a href="http://arcfactory.cloudapp.net">Architect Factory collateral page</a> (hosted on Azure Cloud).</p>
<p>You can access my presentation directly on the Slide Share:</p>
<p> <object type='application/x-shockwave-flash' wmode='transparent' data='http://static.slideshare.net/swf/ssplayer2.swf?id=1551709&#038;doc=applicationpattersforthecloud-090608204523-phpapp01' width='425' height='348'><param name='movie' value='http://static.slideshare.net/swf/ssplayer2.swf?id=1551709&#038;doc=applicationpattersforthecloud-090608204523-phpapp01' /><param name='allowFullScreen' value='true' /><param name='allowScriptAccess' value='always' /></object>
<p>&#160;</p>
<p><strong><u>Note:</u></strong> check out <a href="http://highscalability.com/hotpads-shows-true-cost-hosting-amazon">the price analysis article of &#8220;True Cost of Hosting&#8221;</a> of a big web application deployments on Amazon AWS infrastructure &#8211; <a href="http://hotpads.com/">HotPads</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/igorshare.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/igorshare.wordpress.com/280/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/igorshare.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/igorshare.wordpress.com/280/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/igorshare.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/igorshare.wordpress.com/280/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/igorshare.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/igorshare.wordpress.com/280/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/igorshare.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/igorshare.wordpress.com/280/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=280&subd=igorshare&ref=&feed=1" /></div>
<p><a href="http://feedads.g.doubleclick.net/~a/ivnVvPCd_kkkL6oAAIAoRQq2I2E/0/da"><img src="http://feedads.g.doubleclick.net/~a/ivnVvPCd_kkkL6oAAIAoRQq2I2E/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ivnVvPCd_kkkL6oAAIAoRQq2I2E/1/da"><img src="http://feedads.g.doubleclick.net/~a/ivnVvPCd_kkkL6oAAIAoRQq2I2E/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/IgorshareWeblog/~4/47zptUXly_c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://igorshare.wordpress.com/2009/06/10/recent-application-patters-for-the-cloud-presentation-for-boston-architect-factory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://feedproxy.google.com/~r/IgorshareWeblog/~5/gO8eZ3irknY/ssplayer2.swf" medium="image">
			<media:title type="html">IgorM</media:title>
		</media:content>

		<media:content url="http://static.flickr.com/3416/3592411776_2050da414f.jpg" medium="image">
			<media:title type="html">Igor Moochnick</media:title>
		</media:content>
	<itunes:subtitle>&amp;#160; Thanks for all the attendees. You’ve made this event a success! Thanks to all the organizers – without you this would have never happened. &amp;#160; You can find all the pictures are on Flickr and all the the presentations are hosted on the on Archite</itunes:subtitle><itunes:summary>&amp;#160; Thanks for all the attendees. You’ve made this event a success! Thanks to all the organizers – without you this would have never happened. &amp;#160; You can find all the pictures are on Flickr and all the the presentations are hosted on the on Architect Factory collateral page (hosted on Azure Cloud). You can access my presentation directly [...]</itunes:summary><itunes:keywords>Azure, Community, Presentations, S+S, Web</itunes:keywords><feedburner:origLink>http://igorshare.wordpress.com/2009/06/10/recent-application-patters-for-the-cloud-presentation-for-boston-architect-factory/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/IgorshareWeblog/~5/gO8eZ3irknY/ssplayer2.swf" length="87064" type="application/x-shockwave-flash" /><feedburner:origEnclosureLink>http://static.slideshare.net/swf/ssplayer2.swf?id=1551709&amp;#038;doc=applicationpattersforthecloud-090608204523-phpapp01</feedburner:origEnclosureLink></item>
		<item>
		<title>Building GWT web clients [Part 4.1] – How to create an Azure RESTful web service?</title>
		<link>http://feedproxy.google.com/~r/IgorshareWeblog/~3/9S5COigyJlE/</link>
		<comments>http://igorshare.wordpress.com/2009/06/08/building-gwt-web-clients-part-4-1-how-to-create-an-azure-restful-web-service/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 03:18:35 +0000</pubDate>
		<dc:creator>igormoochnick</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[S+S]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://igorshare.wordpress.com/2009/06/08/building-gwt-web-clients-part-4-1-how-to-create-an-azure-restful-web-service/</guid>
		<description><![CDATA[Prerequisites: make sure that you have all the Azure SDK tools installed for your VS2008.
&#160;
(1) Start by creating a new “Web Cloud Service” project in the Visual Studio. Give it a nice name.
(2) Add a new “WCF Service” to the WebRole project.
(3) Define a required contract:
The most important part here is to put attributes that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=279&subd=igorshare&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Prerequisites: make sure that you have all the <a href="http://www.microsoft.com/azure/sdk.mspx">Azure SDK tools</a> installed for your VS2008.</p>
<p>&#160;</p>
<p>(1) Start by creating a new “Web Cloud Service” project in the Visual Studio. Give it a nice name.</p>
<p>(2) Add a new “WCF Service” to the WebRole project.</p>
<p>(3) Define a required contract:</p>
<p>The most important part here is to put attributes that will tell the WCF in what format to send/receive the message body (XML or JSON) &#8230;</p>
<pre>
<pre name="code" class="csharp">
[ServiceContract(Name = &quot;service&quot;, Namespace = &quot;http://www.igorshare.com&quot;)]
public interface IContactManagerService
{
    [OperationContract]
    [WebGet(UriTemplate = &quot;/contacts&quot;, BodyStyle = WebMessageBodyStyle.Bare,
       ResponseFormat = WebMessageFormat.Json)]
    List&lt;Contact&gt; GetAllContacts();

    [OperationContract]
    [WebGet(UriTemplate = &quot;/contacts/{filter}&quot;, BodyStyle = WebMessageBodyStyle.Bare,
       ResponseFormat = WebMessageFormat.Json)]
    List&lt;Contact&gt; GetContacts(string filter);
}

[DataContract]
public class Contact
{
    [DataMember]
    public string FirstName { get; set; }

    [DataMember]
    public string LastName { get; set; }

    [DataMember]
    public string Company { get; set; }
}
</pre>
</pre>
<p>(4) Implement the service logic:</p>
<pre>
<pre name="code" class="csharp">
public class ContactManagerService : IContactManagerService
{
    private static readonly List&lt;Contact&gt; Contacts = new List&lt;Contact&gt;() { ... };

    public List&lt;Contact&gt; GetAllContacts()
    {
        return Contacts;
    }

    public List&lt;Contact&gt; GetContacts(string filter)
    {
        string f = filter.ToLower();

        var contacts = from contact in Contacts
                       where contact.FirstName.ToLower().Contains(f)
                            || contact.LastName.ToLower().Contains(f)
                            || contact.Company.ToLower().Contains(f)
                       select contact;

        return contacts.ToList();
    }
}
</pre>
</pre>
<p>(5) Configure it to be exposed as a RESTful service:</p>
<p>To make it REALLY, REALLY simple for you, do this trick:</p>
<p>a) Comment out the system.serviceModel section in the Web.config file</p>
<p>b) Add the Factory attribute to the .svc file</p>
<pre>
<pre name="code" class="html">
&lt;%@ ServiceHost Language=&quot;C#&quot; Debug=&quot;true&quot;
Service=&quot;ContactManagerCloudService_WebRole.ContactManagerService&quot;
CodeBehind=&quot;ContactManagerService.svc.cs&quot;
Factory=&quot;System.ServiceModel.Activation.WebServiceHostFactory&quot; %&gt;
</pre>
</pre>
<p>(6) Build the service</p>
<p>&#160;</p>
<p>You’re interested in 2 artifacts of the build:</p>
<ol>
<li>.cscfg file – configuration for the Cloud Service deployment</li>
<li>.cspkg file – all the bits packaged (zipped)</li>
</ol>
<p>&#160;</p>
<p>At this moment you have 2 choices:</p>
<ol>
<li>Run your project in the local Development Fabric (for testing and debugging), or …</li>
<li>Deploy it to the Azure Cloud (for staging or production)</li>
</ol>
<p>&#160;</p>
<p>To deploy your application to the cloud, do right-click on the CloudService project and select “Publish”.</p>
<p>Visual Studio will launch the Azure Service Developer Portal page. Log-in to your account, create a project and deploy your bits to the staging environment:</p>
<p><a href="http://igorshare.files.wordpress.com/2009/06/clip_image001.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="clip_image001" border="0" alt="clip_image001" src="http://igorshare.files.wordpress.com/2009/06/clip_image001_thumb.png?w=629&#038;h=484" width="629" height="484" /></a></p>
<p>&#160;</p>
<p>This is it!&#160; You’re good to go. </p>
<p>BTW: make sure that your application works in the staging environment and then you can push it to Production by just switching it with the Staging.</p>
<p>&#160;</p>
<p><a href="http://cid-49af16156c2594a4.skydrive.live.com/self.aspx/Public/Blog%20Source%20Code/GWT%20fat%20Client/ContactManagerCloudService.zip"><img style="border-width:0;" border="0" src="http://igorshare.files.wordpress.com/2008/02/image4.png?w=213&amp;h=37&amp;h=37" /></a></p>
<p>&#160;</p>
<p><strong><u>Note:</u></strong> Check out a great explanation about the difference between the <a title="WCF REST Configuration for ASP.NET AJAX and plain REST Services" href="http://www.west-wind.com/WebLog/posts/310747.aspx">WCF REST Configuration for ASP.NET AJAX and plain REST Services</a> by Rick Strahl.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/igorshare.wordpress.com/279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/igorshare.wordpress.com/279/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/igorshare.wordpress.com/279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/igorshare.wordpress.com/279/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/igorshare.wordpress.com/279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/igorshare.wordpress.com/279/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/igorshare.wordpress.com/279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/igorshare.wordpress.com/279/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/igorshare.wordpress.com/279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/igorshare.wordpress.com/279/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=279&subd=igorshare&ref=&feed=1" /></div>
<p><a href="http://feedads.g.doubleclick.net/~a/55orhpl60WjlNs7CipTFnYrSiJg/0/da"><img src="http://feedads.g.doubleclick.net/~a/55orhpl60WjlNs7CipTFnYrSiJg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/55orhpl60WjlNs7CipTFnYrSiJg/1/da"><img src="http://feedads.g.doubleclick.net/~a/55orhpl60WjlNs7CipTFnYrSiJg/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/IgorshareWeblog/~4/9S5COigyJlE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://igorshare.wordpress.com/2009/06/08/building-gwt-web-clients-part-4-1-how-to-create-an-azure-restful-web-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/96b0fd2825bdeb9f9039b1259156b91b?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">IgorM</media:title>
		</media:content>

		<media:content url="http://igorshare.files.wordpress.com/2009/06/clip_image001_thumb.png" medium="image">
			<media:title type="html">clip_image001</media:title>
		</media:content>

		<media:content url="http://igorshare.files.wordpress.com/2008/02/image4.png?w=213&amp;h=37&amp;h=37" medium="image" />
	<feedburner:origLink>http://igorshare.wordpress.com/2009/06/08/building-gwt-web-clients-part-4-1-how-to-create-an-azure-restful-web-service/</feedburner:origLink></item>
		<item>
		<title>Building GWT web clients [Part 4] – How to connect GWT client to Azure web service?</title>
		<link>http://feedproxy.google.com/~r/IgorshareWeblog/~3/2-RnCtuCGEE/</link>
		<comments>http://igorshare.wordpress.com/2009/06/08/building-gwt-web-clients-part-4-how-to-connect-gwt-client-to-azure-web-service/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 20:20:07 +0000</pubDate>
		<dc:creator>igormoochnick</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[GWT]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[S+S]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://igorshare.wordpress.com/2009/06/08/building-gwt-web-clients-part-4-how-to-connect-gwt-client-to-azure-web-service/</guid>
		<description><![CDATA[Stay tuned … 

       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=275&subd=igorshare&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Stay tuned … </p>
<p><img style="border-width:0;" border="0" src="http://igorshare.files.wordpress.com/2008/02/image4.png?w=213&amp;h=37&amp;h=37" /></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/igorshare.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/igorshare.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/igorshare.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/igorshare.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/igorshare.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/igorshare.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/igorshare.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/igorshare.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/igorshare.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/igorshare.wordpress.com/275/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=275&subd=igorshare&ref=&feed=1" /></div>
<p><a href="http://feedads.g.doubleclick.net/~a/apQPKDXxcYaRFbnfwBcTJHiL9yE/0/da"><img src="http://feedads.g.doubleclick.net/~a/apQPKDXxcYaRFbnfwBcTJHiL9yE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/apQPKDXxcYaRFbnfwBcTJHiL9yE/1/da"><img src="http://feedads.g.doubleclick.net/~a/apQPKDXxcYaRFbnfwBcTJHiL9yE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/IgorshareWeblog/~4/2-RnCtuCGEE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://igorshare.wordpress.com/2009/06/08/building-gwt-web-clients-part-4-how-to-connect-gwt-client-to-azure-web-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/96b0fd2825bdeb9f9039b1259156b91b?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">IgorM</media:title>
		</media:content>

		<media:content url="http://igorshare.files.wordpress.com/2008/02/image4.png?w=213&amp;h=37&amp;h=37" medium="image" />
	<feedburner:origLink>http://igorshare.wordpress.com/2009/06/08/building-gwt-web-clients-part-4-how-to-connect-gwt-client-to-azure-web-service/</feedburner:origLink></item>
		<item>
		<title>Building GWT web clients [Part 3] – How to connect GWT client to JAX-RS Jersey server?</title>
		<link>http://feedproxy.google.com/~r/IgorshareWeblog/~3/YLK71t9xHq4/</link>
		<comments>http://igorshare.wordpress.com/2009/06/08/building-gwt-web-clients-part-3-how-to-connect-gwt-client-to-jax-rs-jersey-server/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 20:15:23 +0000</pubDate>
		<dc:creator>igormoochnick</dc:creator>
				<category><![CDATA[GWT]]></category>
		<category><![CDATA[JAX-RS]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Jersey]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[S+S]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://igorshare.wordpress.com/2009/06/08/building-gwt-web-clients-part-3-how-to-connect-gwt-client-to-jax-rs-jersey-server/</guid>
		<description><![CDATA[Stay tuned … 

       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=272&subd=igorshare&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Stay tuned … </p>
<p><img style="border-width:0;" border="0" src="http://igorshare.files.wordpress.com/2008/02/image4.png?w=213&amp;h=37&amp;h=37" /></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/igorshare.wordpress.com/272/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/igorshare.wordpress.com/272/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/igorshare.wordpress.com/272/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/igorshare.wordpress.com/272/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/igorshare.wordpress.com/272/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/igorshare.wordpress.com/272/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/igorshare.wordpress.com/272/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/igorshare.wordpress.com/272/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/igorshare.wordpress.com/272/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/igorshare.wordpress.com/272/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=272&subd=igorshare&ref=&feed=1" /></div>
<p><a href="http://feedads.g.doubleclick.net/~a/wPUpEkddYJVmkcsfzaoc9vB2DkQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/wPUpEkddYJVmkcsfzaoc9vB2DkQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/wPUpEkddYJVmkcsfzaoc9vB2DkQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/wPUpEkddYJVmkcsfzaoc9vB2DkQ/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/IgorshareWeblog/~4/YLK71t9xHq4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://igorshare.wordpress.com/2009/06/08/building-gwt-web-clients-part-3-how-to-connect-gwt-client-to-jax-rs-jersey-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/96b0fd2825bdeb9f9039b1259156b91b?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">IgorM</media:title>
		</media:content>

		<media:content url="http://igorshare.files.wordpress.com/2008/02/image4.png?w=213&amp;h=37&amp;h=37" medium="image" />
	<feedburner:origLink>http://igorshare.wordpress.com/2009/06/08/building-gwt-web-clients-part-3-how-to-connect-gwt-client-to-jax-rs-jersey-server/</feedburner:origLink></item>
		<item>
		<title>Building GWT web clients [Part 2.1] – How to control JSON output format from Jersey?</title>
		<link>http://feedproxy.google.com/~r/IgorshareWeblog/~3/j0diKH_janY/</link>
		<comments>http://igorshare.wordpress.com/2009/05/21/building-gwt-web-clients-part-2-1-how-to-control-json-output-format-from-jersey/#comments</comments>
		<pubDate>Thu, 21 May 2009 21:31:18 +0000</pubDate>
		<dc:creator>igormoochnick</dc:creator>
				<category><![CDATA[JAX-RS]]></category>
		<category><![CDATA[JAXB]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Jersey]]></category>
		<category><![CDATA[REST]]></category>

		<guid isPermaLink="false">http://igorshare.wordpress.com/2009/05/21/building-gwt-web-clients-part-2-1-how-to-control-json-output-format-from-jersey/</guid>
		<description><![CDATA[As you know that in XML you can represent the same data in variety of ways by using fields, names, attributes, etc..
The same is true to JSON. In many cases different serializers produce different JSON representation of the same objects.
JAX-RS (as well as Jersey) provide you control over what and how you want to serialize. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=269&subd=igorshare&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>As you know that in XML you can represent the same data in variety of ways by using fields, names, attributes, etc..</p>
<p>The same is true to JSON. In many cases different serializers produce different JSON representation of the same objects.</p>
<p>JAX-RS (as well as Jersey) provide you control over what and how you want to serialize. This is accomplished via providers.</p>
<p>Here is an example of such provider (Note that the class should be marked with @Provider annotation):</p>
<pre>
<pre name="code" class="java">
@Provider
public class JAXBContextResolver implements ContextResolver&lt;JAXBContext&gt; {
    private JAXBContext context;
    private Class&lt;?&gt;[] types = { ListDescription.class }; 

    public JAXBContextResolver() throws Exception {
        JSONConfiguration config = JSONConfiguration.natural().build();
        context = new JSONJAXBContext(config, types);
    } 

    public JAXBContext getContext(Class&lt;?&gt; objectType) {
        for (Class&lt;?&gt; type : types) {
            if (type == objectType) {
                return context;
            }
        }
        return null;
    }
}
</pre>
</pre>
<p>Note that by creating an appropriate JSONConfiguration (JSONConfiguration.natural().build()) you, in fact, control the output JSON format. The JSONConfiguration class provide 4 different JSON formatters:</p>
<ol>
<li>natural (Jackson)</li>
<li>mapped</li>
<li>mappedJettison</li>
<li>Badgerfish</li>
</ol>
<p>Here is how the output will vary, depending on the choice of the configuration. Don&#8217;t forget that the class should be annotated with  A simple class (with fields (int)ID and (String)Name) added to an ArrayList and then returned back as a @GET return value:</p>
<pre>
<pre name="code" class="java">
@XmlRootElement
public class ListDescription
{
	public int ID;
	public String Name;
}

@GET
@Produces({MediaType.APPLICATION_JSON })
public List&lt;DataListInfo&gt; getAllLists()
{
	List&lt;ListDescription&gt; lists = new ArrayList&lt;ListDescription&gt;();
	ListDescription ls = new ListDescription();
	ls.ID = 1;
	ls.Name = &quot;Test&quot;;
	lists.add(ls);
	return lists;
}
</pre>
</pre>
<p>This is what you’ll get from each configuration (respectively):</p>
<p><b><u>mappedJettison:</u></b></p>
<pre>
<pre name="code" class="css">

{&quot;listDescriptions&quot;:{&quot;listDescription&quot;:{&quot;ID&quot;:1,&quot;Name&quot;:&quot;Test&quot;}}}
</pre>
</pre>
<p><b><u>mapped:</u></b></p>
<pre>
<pre name="code" class="css">

{&quot;listDescription&quot;:{&quot;ID&quot;:&quot;1&quot;,&quot;Name&quot;:&quot;Test&quot;}}
</pre>
</pre>
<p><b><u>natural (jackson):</u></b></p>
<pre>
<pre name="code" class="css">

[{&quot;ID&quot;:1,&quot;Name&quot;:&quot;Test&quot;}]
</pre>
</pre>
<p><b><u>Badgerfish:</u></b></p>
<pre>
<pre name="code" class="css">

{&quot;listDescriptions&quot;:{&quot;listDescription&quot;:{&quot;ID&quot;:{&quot;$&quot;:&quot;1&quot;},&quot;Name&quot;:{&quot;$&quot;:&quot;Test&quot;}}}}
</pre>
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/igorshare.wordpress.com/269/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/igorshare.wordpress.com/269/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/igorshare.wordpress.com/269/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/igorshare.wordpress.com/269/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/igorshare.wordpress.com/269/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/igorshare.wordpress.com/269/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/igorshare.wordpress.com/269/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/igorshare.wordpress.com/269/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/igorshare.wordpress.com/269/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/igorshare.wordpress.com/269/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=269&subd=igorshare&ref=&feed=1" /></div>
<p><a href="http://feedads.g.doubleclick.net/~a/7GTYsxjK2QYHbCQlFE-gyNvPlEc/0/da"><img src="http://feedads.g.doubleclick.net/~a/7GTYsxjK2QYHbCQlFE-gyNvPlEc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/7GTYsxjK2QYHbCQlFE-gyNvPlEc/1/da"><img src="http://feedads.g.doubleclick.net/~a/7GTYsxjK2QYHbCQlFE-gyNvPlEc/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/IgorshareWeblog/~4/j0diKH_janY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://igorshare.wordpress.com/2009/05/21/building-gwt-web-clients-part-2-1-how-to-control-json-output-format-from-jersey/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/96b0fd2825bdeb9f9039b1259156b91b?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">IgorM</media:title>
		</media:content>
	<feedburner:origLink>http://igorshare.wordpress.com/2009/05/21/building-gwt-web-clients-part-2-1-how-to-control-json-output-format-from-jersey/</feedburner:origLink></item>
		<item>
		<title>Building GWT web clients [Part 2] – How to expose REST-full JAX-RS service with Jersey on Tomcat server?</title>
		<link>http://feedproxy.google.com/~r/IgorshareWeblog/~3/3-_ceVpiMJM/</link>
		<comments>http://igorshare.wordpress.com/2009/05/20/building-gwt-web-clients-part-2-how-to-expose-rest-full-jax-rs-service-with-jersey-on-tomcat-server/#comments</comments>
		<pubDate>Wed, 20 May 2009 18:27:41 +0000</pubDate>
		<dc:creator>igormoochnick</dc:creator>
				<category><![CDATA[JAX-RS]]></category>
		<category><![CDATA[JAXB]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Jersey]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://igorshare.wordpress.com/2009/05/20/building-gwt-web-clients-part-2-how-to-expose-rest-full-jax-rs-service-with-jersey-on-tomcat-server/</guid>
		<description><![CDATA[In the previous article (Part 1) we’ve seen how to create a web-based REST-full client (and an appropriate server) by using GWT. GWT is not providing any “standard” REST (if you can use this word in REST context at all) interface, but, merely, exposes the server-side logic via a proprietary GWT RPC interface.
Today, the most [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=267&subd=igorshare&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In the <a href="http://igorshare.wordpress.com/2009/05/18/building-fat-gwt-web-clients-intro-how-to-create-a-gwt-rpc-client/">previous article (Part 1)</a> we’ve seen how to create a web-based REST-full client (and an appropriate server) by using GWT. GWT is not providing any “standard” REST (if you can use this word in REST context at all) interface, but, merely, exposes the server-side logic via a proprietary GWT RPC interface.</p>
<p>Today, the most common REST standard is the JAX-RS specification. By implementing your code along the JAX-RS guidelines you can be rest assured that you can easily switch one REST-RX library with another.</p>
<p>As of today there are a couple of JAX-RS libraries used by the Java community:</p>
<ol>
<li>Jersey </li>
<li>Restlet </li>
<li>Portlet </li>
<li>etc… </li>
</ol>
<p>On the other hand, being a big fan of Spring, I was hoping that Spring will provide the JAX-RS support in it’s Spring v3 release, but, looking at the M3 drop, I have realized that it’s nowhere near that promise (<a href="http://stackoverflow.com/questions/852969/what-is-the-minimal-configuration-for-rest-fully-annotated-service-built-on-sprin">check my discussion on the StackOverflow</a>).</p>
<p>For this post I’m going to use <a href="https://jersey.dev.java.net/">Jersey JAX-RS</a> implementation. Let’s start with creating </p>
<p> <span id="more-267"></span>
<p>a Dynamic Web Project in Eclipse. I’m going to use:</p>
<ol>
<li>Apache Tomcat v6.0 </li>
<li>Dynamic Web Module v2.5 </li>
<li>Default Configuration for Apache Tomcat v6.0 </li>
</ol>
<p>To add Jersey (1.1.0-ea) into this mix, add the following JARs (from <a href="https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.1.0-ea/jersey/dependencies.html">this obscure installation instructions</a> page) to your build path:</p>
<ol>
<li>asm-3.1.jar </li>
<li>jsr311-api-1.1.jar </li>
<li>jersey-bundle-1.1.0-ea.jar </li>
<li>jersey-json-1.1.0-ea.jar </li>
<li>jaxb-impl-2.1.10.jar </li>
</ol>
<p>Don’t forget to add these JARs to the “Java EE Module Dependencies” (in the properties of the project) as well.</p>
<p>Let’s define our Web Service. By using the JAX-RS specification it becomes extremely easy:</p>
<pre>
<pre name="code" class="java">
@PerRequest
@Path(&quot;/contacts&quot;)
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public class ContactManagerService {
    final static List&lt;ContactInfo&gt; contacts = new ArrayList&lt;ContactInfo&gt;();
    static {
        contacts.add(new ContactInfo(&quot;Joe&quot;, &quot;Simth&quot;, &quot;Some Company&quot;));
        contacts.add(new ContactInfo(&quot;Tom&quot;, &quot;Doe&quot;, &quot;Another Company&quot;));
    } 

    @GET
    public ContactList getAllContacts()
    {
        return contacts;
    } 

    @GET
    @Path(&quot;{filter}&quot;)
    public ContactList getFilteredContacts(@PathParam(&quot;filter&quot;) String filter)
    {
        ...

        return ContactList.fromContacts( contacts );
    } 

}
</pre>
</pre>
<p>A couple of things to notice here:</p>
<ol>
<li>The “root” path to the ContactManager Web service marked by tompost annotation @Path(&quot;/contacts&quot;), is: /contacts </li>
<li>This class returns<font color="#000000"> data in both application/json and application/xml formats. This is defined by the @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) annotations.</font> </li>
<li>The “default” method for this web service is “getAllContacts”. This is happening because this method has NO @Path annotation. </li>
<li>The “getFilteredContacts” will be called if the Web Services URL will contain a non-empty addition to the root URL, like this: /contact/joe
<ol>
<li>Note that this addition should be URL-encoded </li>
<li>If you’d like to replace it with the query param – replace the annotation with the @QueryParam one. In this case the call will look like /contacts?filter=joe </li>
</ol>
</li>
</ol>
<p>The ContactList, that is returned to the client, should be annotated with @XmlRootElement so Jetty will fire up an appropriate the JAXB provider for the serialization (we’ll talk more about providers later):</p>
<pre>
<pre name="code" class="java">
@XmlRootElement
public class ContactList { 

    @XmlElement
    protected java.util.List&lt;ContactInfo&gt; contacts; 

    public ContactList() { ... }

}
</pre>
</pre>
<p>As you can guess, there is no magic in the world (I, actually, still hope that there is some <img src='http://s.wordpress.com/wp-includes/images/smilies/face-wink.png' alt=';-)' class='wp-smiley' />  so, to make our service visible to the outside world, we need to make sure that Tomcat loads Jersey which, in its order, will load and expose our service according to our annotations. This is done via the additional configuration in the web.config file:</p>
<pre>
<pre name="code" class="xml">
&lt;!-- Servlets --&gt;
&lt;servlet&gt;
    &lt;servlet-name&gt;ContactManager Web Services&lt;/servlet-name&gt;
    &lt;servlet-class&gt;com.sun.jersey.spi.container.servlet.ServletContainer&lt;/servlet-class&gt;
    &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
&lt;/servlet&gt;
&lt;servlet-mapping&gt;
    &lt;servlet-name&gt;ContactManager Web Services&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/services/*&lt;/url-pattern&gt;
&lt;/servlet-mapping&gt;
</pre>
</pre>
<p>After completing all the above you can start Tomcat and use any of the available REST test clients like Fiddler, RESTClient or RESTTest (see <a href="http://stackoverflow.com/questions/165720/how-to-debug-restful-services">discussion on StackOverflow</a>) to see our service in action.</p>
<p>The root URL to the ContactManagerService is <a title="http://localhost:8080/ContactManagerServer/services/contacts" href="http://localhost:8080/ContactManagerServer/services/contacts">http://localhost:8080/ContactManagerServer/services/contacts</a>.</p>
<p>If the request will contain header “Accept: application/json” the result will look like this:</p>
<pre>
<pre name="code" class="css">
{&quot;contacts&quot;:[{&quot;FirstName&quot;:&quot;Joe&quot;,&quot;LastName&quot;:&quot;Simth&quot;,&quot;Company&quot;:&quot;Some Company&quot;},
{&quot;FirstName&quot;:&quot;Tom&quot;,&quot;LastName&quot;:&quot;Doe&quot;,&quot;Company&quot;:&quot;Another Company&quot;}]}
</pre>
</pre>
<p>On the other hand the header “Accept: application/xml” will produce result like this:</p>
<pre>
<pre name="code" class="xml">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;
&lt;contactList&gt;
	&lt;contacts&gt;&lt;FirstName&gt;Joe&lt;/FirstName&gt;&lt;LastName&gt;Simth&lt;/LastName&gt;&lt;Company&gt;Some Company&lt;/Company&gt;&lt;/contacts&gt;
	&lt;contacts&gt;&lt;FirstName&gt;Tom&lt;/FirstName&gt;&lt;LastName&gt;Doe&lt;/LastName&gt;&lt;Company&gt;Another Company&lt;/Company&gt;&lt;/contacts&gt;
&lt;/contactList&gt;
</pre>
</pre>
<p>Disregard format of the returned content for a moment, we&#8217;re going to talk about serialization in later posts.</p>
<p>More information about the JSON support in Jersey can be found in the <a href="https://jersey.dev.java.net/documentation/1.1.0-ea/user-guide.html#json">Jersey User Guide</a>.</p>
<p><a href="http://cid-49af16156c2594a4.skydrive.live.com/self.aspx/Public/Blog%20Source%20Code/GWT%20fat%20Client/ContactManager%20-%20part2.zip"><img style="border-width:0;" border="0" src="http://igorshare.files.wordpress.com/2008/02/image4.png?w=213&amp;h=37&amp;h=37" /></a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/igorshare.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/igorshare.wordpress.com/267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/igorshare.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/igorshare.wordpress.com/267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/igorshare.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/igorshare.wordpress.com/267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/igorshare.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/igorshare.wordpress.com/267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/igorshare.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/igorshare.wordpress.com/267/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=igorshare.wordpress.com&blog=2434376&post=267&subd=igorshare&ref=&feed=1" /></div>
<p><a href="http://feedads.g.doubleclick.net/~a/xUY24AslqKyB26Pe7-fn4wVHBPQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/xUY24AslqKyB26Pe7-fn4wVHBPQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/xUY24AslqKyB26Pe7-fn4wVHBPQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/xUY24AslqKyB26Pe7-fn4wVHBPQ/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/IgorshareWeblog/~4/3-_ceVpiMJM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://igorshare.wordpress.com/2009/05/20/building-gwt-web-clients-part-2-how-to-expose-rest-full-jax-rs-service-with-jersey-on-tomcat-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/96b0fd2825bdeb9f9039b1259156b91b?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">IgorM</media:title>
		</media:content>

		<media:content url="http://igorshare.files.wordpress.com/2008/02/image4.png?w=213&amp;h=37&amp;h=37" medium="image" />
	<feedburner:origLink>http://igorshare.wordpress.com/2009/05/20/building-gwt-web-clients-part-2-how-to-expose-rest-full-jax-rs-service-with-jersey-on-tomcat-server/</feedburner:origLink></item>
	<media:rating>nonadult</media:rating></channel>
</rss>
