You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wink.apache.org by ng...@apache.org on 2009/06/23 07:33:38 UTC

svn commit: r787552 [3/5] - in /incubator/wink/contrib/ibm-jaxrs/samples: ./ addressBook/ addressBook/build/ addressBook/build/classes/ addressBook/build/classes/server/ addressBook/build/classes/server/com/ addressBook/build/classes/server/com/ibm/ ad...

Added: incubator/wink/contrib/ibm-jaxrs/samples/context/server/src/com/ibm/ws/jaxrs/sample/context/xml/Stats.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/context/server/src/com/ibm/ws/jaxrs/sample/context/xml/Stats.java?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/context/server/src/com/ibm/ws/jaxrs/sample/context/xml/Stats.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/context/server/src/com/ibm/ws/jaxrs/sample/context/xml/Stats.java Tue Jun 23 05:33:31 2009
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.ibm.ws.jaxrs.sample.context.xml;
+
+public class Stats {
+    
+    private int homeTeamHits;
+    private int homeTeamErrors;
+    private int homeTeamWalks;
+    private int homeTeamDoubles;
+    private int homeTeamTriples;
+    private int homeTeamHomeRuns;
+    private int visitorTeamHits;
+    private int visitorTeamErrors;
+    private int visitorTeamWalks;
+    private int visitorTeamDoubles;
+    private int visitorTeamTriples;
+    private int visitorTeamHomeRuns;
+    
+    public int getHomeTeamDoubles() {
+        return homeTeamDoubles;
+    }
+    public void setHomeTeamDoubles(int homeTeamDoubles) {
+        this.homeTeamDoubles = homeTeamDoubles;
+    }
+    public int getHomeTeamErrors() {
+        return homeTeamErrors;
+    }
+    public void setHomeTeamErrors(int homeTeamErrors) {
+        this.homeTeamErrors = homeTeamErrors;
+    }
+    public int getHomeTeamHits() {
+        return homeTeamHits;
+    }
+    public void setHomeTeamHits(int homeTeamHits) {
+        this.homeTeamHits = homeTeamHits;
+    }
+    public int getHomeTeamHomeRuns() {
+        return homeTeamHomeRuns;
+    }
+    public void setHomeTeamHomeRuns(int homeTeamHomeRuns) {
+        this.homeTeamHomeRuns = homeTeamHomeRuns;
+    }
+    public int getHomeTeamTriples() {
+        return homeTeamTriples;
+    }
+    public void setHomeTeamTriples(int homeTeamTriples) {
+        this.homeTeamTriples = homeTeamTriples;
+    }
+    public int getHomeTeamWalks() {
+        return homeTeamWalks;
+    }
+    public void setHomeTeamWalks(int homeTeamWalks) {
+        this.homeTeamWalks = homeTeamWalks;
+    }
+    public int getVisitorTeamDoubles() {
+        return visitorTeamDoubles;
+    }
+    public void setVisitorTeamDoubles(int visitorTeamDoubles) {
+        this.visitorTeamDoubles = visitorTeamDoubles;
+    }
+    public int getVisitorTeamErrors() {
+        return visitorTeamErrors;
+    }
+    public void setVisitorTeamErrors(int visitorTeamErrors) {
+        this.visitorTeamErrors = visitorTeamErrors;
+    }
+    public int getVisitorTeamHits() {
+        return visitorTeamHits;
+    }
+    public void setVisitorTeamHits(int visitorTeamHits) {
+        this.visitorTeamHits = visitorTeamHits;
+    }
+    public int getVisitorTeamHomeRuns() {
+        return visitorTeamHomeRuns;
+    }
+    public void setVisitorTeamHomeRuns(int visitorTeamHomeRuns) {
+        this.visitorTeamHomeRuns = visitorTeamHomeRuns;
+    }
+    public int getVisitorTeamTriples() {
+        return visitorTeamTriples;
+    }
+    public void setVisitorTeamTriples(int visitorTeamTriples) {
+        this.visitorTeamTriples = visitorTeamTriples;
+    }
+    public int getVisitorTeamWalks() {
+        return visitorTeamWalks;
+    }
+    public void setVisitorTeamWalks(int visitorTeamWalks) {
+        this.visitorTeamWalks = visitorTeamWalks;
+    }
+    
+}

Added: incubator/wink/contrib/ibm-jaxrs/samples/context/server/static/content.zip
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/context/server/static/content.zip?rev=787552&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/contrib/ibm-jaxrs/samples/context/server/static/content.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wink/contrib/ibm-jaxrs/samples/context/server/static/index.html
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/context/server/static/index.html?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/context/server/static/index.html (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/context/server/static/index.html Tue Jun 23 05:33:31 2009
@@ -0,0 +1,604 @@
+<html>
+<head>
+<title>Context - Using the @Context Annotation</title>
+
+<link rel="stylesheet" href="dijit/themes/soria/soria.css" type="text/css" media="screen" id="themeCss" charset="utf-8"> 
+<script type="text/javascript" src="dojo/dojo.js" djConfig="parseOnLoad: true"></script>
+<script type="text/javascript" src="dijit/dijit-all.js"></script>
+<script type="text/javascript">
+dojo.require("dijit.layout.TabContainer");
+dojo.require("dijit.layout.ContentPane");
+dojo.require("dijit.form.Button");
+</script>
+
+<script>
+
+	function BoxScore(score, stats) {
+		this.score = score;
+		this.stats = stats;
+	}
+	
+	function Score(homeTeam, homeTeamScore, visitorTeam, visitorTeamScore, lastModified) {
+		this.homeTeam = homeTeam;
+		this.homeTeamScore = homeTeamScore;
+		this.visitorTeam = visitorTeam;
+		this.visitorTeamScore = visitorTeamScore;
+		this.lastModified = lastModified;
+	}
+	
+	function Stats(homeTeamHits, homeTeamErrors, homeTeamWalks, homeTeamDoubles, homeTeamTriples, homeTeamHomeRuns,
+	               visitorTeamHits, visitorTeamErrors, visitorTeamWalks, visitorTeamDoubles, visitorTeamTriples, visitorTeamHomeRuns,
+	               lastModified) {
+		this.homeTeamHits = homeTeamHits;
+		this.homeTeamErrors = homeTeamErrors;
+		this.homeTeamWalks = homeTeamWalks;
+		this.homeTeamDoubles = homeTeamDoubles;
+		this.homeTeamTriples = homeTeamTriples;
+		this.homeTeamHomeRuns = homeTeamHomeRuns;
+		this.visitorTeamHits = visitorTeamHits;
+		this.visitorTeamErrors = visitorTeamErrors;
+		this.visitorTeamWalks = visitorTeamWalks;
+		this.visitorTeamDoubles = visitorTeamDoubles;
+		this.visitorTeamTriples = visitorTeamTriples;
+		this.visitorTeamHomeRuns = visitorTeamHomeRuns;
+		this.lastModified = lastModified;
+	}
+	
+	var gameOne = new BoxScore(new Score("", 0, "", 0, ""), new Stats(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ""));
+	var gameTwo = new BoxScore(new Score("", 0, "", 0, ""), new Stats(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ""));	
+	var scoreBoard = [gameOne, gameTwo];
+
+    function updateRequest(url, method, entity, headers) {
+        var requestURL = dojo.byId("requestURL");
+        var requestEntity = dojo.byId("requestEntity");
+        var requestMethod = dojo.byId("requestMethod");
+        var requestHeaders = dojo.byId("requestHeaders");
+
+        requestURL.innerHTML = "<pre>" + url + "</pre>";
+        requestMethod.innerHTML = "<pre>" + method + "</pre>";
+        requestEntity.innerHTML = "<pre>" + entity + "</pre>";
+        requestHeaders.innerHTML = "<pre>" + headers + "</pre>";
+    }
+    
+    function updateResponse(data, ioArgs) {
+    	var responseStatus = dojo.byId("responseStatusCode");
+        responseStatus.innerHTML = "<pre>" + ioArgs.xhr.status + "</pre>";
+
+        var responseEntity = dojo.byId("responseEntity");
+        var responseEntityValue = ioArgs.xhr.responseText;
+        responseEntityValue = responseEntityValue.replace(/</g, "&lt;").replace(/>/g, "&gt;");
+        responseEntity.innerHTML = "<pre>" + responseEntityValue + "</pre>";
+
+        var responseHeadersValue = ioArgs.xhr.getAllResponseHeaders();
+
+        var responseHeaders = dojo.byId("responseHeaders");
+        responseHeaders.innerHTML = "<pre>" + responseHeadersValue + "</pre>";
+    }
+    
+    function updateScoreBoard(data, ioArgs, gameNum) {
+    	if(ioArgs.xhr.status == "200"){
+   	        var lastModified = ioArgs.xhr.getResponseHeader("Last-Modified");
+    		var boxScore = null;
+    		if(gameNum == "1") {
+    			boxScore = scoreBoard[0];
+    		} else {
+    			boxScore = scoreBoard[1];
+    		}
+    		boxScore.score.homeTeam = data.getElementsByTagName("homeTeam").item(0).firstChild.nodeValue;
+			boxScore.score.homeTeamScore = data.getElementsByTagName("homeScore").item(0).firstChild.nodeValue;
+			boxScore.score.visitorTeam = data.getElementsByTagName("visitorTeam").item(0).firstChild.nodeValue;
+			boxScore.score.visitorTeamScore = data.getElementsByTagName("visitorScore").item(0).firstChild.nodeValue;
+			boxScore.score.lastModified = lastModified;
+			
+			if(data.getElementsByTagName("homeTeamHits").length == 0) {
+				return;
+			}
+			
+			boxScore.stats.homeTeamHits = data.getElementsByTagName("homeTeamHits").item(0).firstChild.nodeValue;
+			var t = data.getElementsByTagName("homeTeamErrors");
+			var t2 = t.item(0);
+			var t3 = t2.firstChild;
+			var t4 = t3.nodeValue;
+			// for some reason this next line of code doesn't work without the above 4 lines
+			boxScore.stats.homeTeamErrors = data.getElementsByTagName("homeTeamErrors").item(0).firstChild.nodeValue;
+			boxScore.stats.homeTeamWalks = data.getElementsByTagName("homeTeamWalks").item(0).firstChild.nodeValue;
+			boxScore.stats.homeTeamDoubles = data.getElementsByTagName("homeTeamDoubles").item(0).firstChild.nodeValue;
+			boxScore.stats.homeTeamTriples = data.getElementsByTagName("homeTeamTriples").item(0).firstChild.nodeValue;
+			boxScore.stats.homeTeamHomeRuns = data.getElementsByTagName("homeTeamHomeRuns").item(0).firstChild.nodeValue;
+			boxScore.stats.visitorTeamHits = data.getElementsByTagName("visitorTeamHits").item(0).firstChild.nodeValue;
+			boxScore.stats.visitorTeamErrors = data.getElementsByTagName("visitorTeamErrors").item(0).firstChild.nodeValue;
+			boxScore.stats.visitorTeamWalks = data.getElementsByTagName("visitorTeamWalks").item(0).firstChild.nodeValue;
+			boxScore.stats.visitorTeamDoubles = data.getElementsByTagName("visitorTeamDoubles").item(0).firstChild.nodeValue;
+			boxScore.stats.visitorTeamTriples = data.getElementsByTagName("visitorTeamTriples").item(0).firstChild.nodeValue;
+			boxScore.stats.visitorTeamHomeRuns = data.getElementsByTagName("visitorTeamHomeRuns").item(0).firstChild.nodeValue;
+			boxScore.stats.lastModified = lastModified;
+    	}
+    }
+    
+    function reloadScoreBoard(ioArgs, gameNum, scoreType) {
+    	var scoreDiv = dojo.byId("score");
+    	var statsDiv = dojo.byId("stats");
+    	
+		while(scoreDiv.childNodes.length > 0) {
+			scoreDiv.removeChild(scoreDiv.firstChild);
+		}
+		while(statsDiv.childNodes.length > 0) {
+			statsDiv.removeChild(statsDiv.firstChild);
+		}
+
+		if (ioArgs.xhr.status != 200) {
+			scoreDiv.appendChild(document.createTextNode("Error retrieving scoreboard data."));
+		}
+		
+		var boxScore = null;
+		if(gameNum == "1") {
+			boxScore = scoreBoard[0];
+		} else {
+			boxScore = scoreBoard[1];
+		}
+		
+		var table = document.createElement("table");
+		var tbody = document.createElement("tbody");
+		table.appendChild(tbody);		
+
+		var tr = document.createElement("tr");
+		td = document.createElement("td");
+		var b = document.createElement("b");
+		b.appendChild(document.createTextNode("Score for Game " + gameNum + ":"));
+		td.appendChild(b);
+		tr.appendChild(td);
+		td = document.createElement("td");
+		td.appendChild(document.createTextNode(" "));
+		tr.appendChild(td);
+		tbody.appendChild(tr);
+		
+		tr = document.createElement("tr");
+		td = document.createElement("td");
+		td.appendChild(document.createTextNode(boxScore.score.homeTeam + ":"));
+		tr.appendChild(td);
+		td = document.createElement("td");
+		td.appendChild(document.createTextNode(boxScore.score.homeTeamScore));
+		tr.appendChild(td);
+		tbody.appendChild(tr);
+		
+		tr = document.createElement("tr");
+		td = document.createElement("td");
+		td.appendChild(document.createTextNode(boxScore.score.visitorTeam + ":"));
+		tr.appendChild(td);
+		td = document.createElement("td");
+		td.appendChild(document.createTextNode(boxScore.score.visitorTeamScore));
+		tr.appendChild(td);
+		tbody.appendChild(tr);
+		
+		scoreDiv.appendChild(table);
+		
+		if(scoreType == "boxscore") {
+			table = document.createElement("table");
+			tbody = document.createElement("tbody");
+			table.appendChild(tbody);		
+	
+			tr = document.createElement("tr");
+			td = document.createElement("td");
+			var b = document.createElement("b");
+			b.appendChild(document.createTextNode("Stats for Game " + gameNum + ":"));
+			td.appendChild(b);
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(" "));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(" "));
+			tr.appendChild(td);
+			tbody.appendChild(tr);
+			
+			tr = document.createElement("tr");
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode("HomeTeamHits:"));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(boxScore.stats.homeTeamHits));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(" "));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(" "));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode("VisitorTeamHits:"));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(boxScore.stats.visitorTeamHits));
+			tr.appendChild(td);
+			tbody.appendChild(tr);
+			
+			tr = document.createElement("tr");
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode("HomeTeamErrors:"));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(boxScore.stats.homeTeamErrors));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(" "));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(" "));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode("VisitorTeamErrors:"));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(boxScore.stats.visitorTeamErrors));
+			tr.appendChild(td);
+			tbody.appendChild(tr);
+			
+			tr = document.createElement("tr");
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode("HomeTeamWalks:"));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(boxScore.stats.homeTeamWalks));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(" "));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(" "));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode("VisitorTeamWalks:"));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(boxScore.stats.visitorTeamWalks));
+			tr.appendChild(td);
+			tbody.appendChild(tr);
+			
+			tr = document.createElement("tr");
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode("HomeTeamDoubles:"));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(boxScore.stats.homeTeamDoubles));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(" "));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(" "));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode("VisitorTeamDoubles:"));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(boxScore.stats.visitorTeamDoubles));
+			tr.appendChild(td);
+			tbody.appendChild(tr);
+			
+			tr = document.createElement("tr");
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode("HomeTeamTriples:"));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(boxScore.stats.homeTeamTriples));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(" "));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(" "));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode("VisitorTeamTriples:"));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(boxScore.stats.visitorTeamTriples));
+			tr.appendChild(td);
+			tbody.appendChild(tr);
+			
+			tr = document.createElement("tr");
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode("HomeTeamHomeRuns:"));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(boxScore.stats.homeTeamHomeRuns));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(" "));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(" "));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode("VisitorTeamHomeRuns:"));
+			tr.appendChild(td);
+			td = document.createElement("td");
+			td.appendChild(document.createTextNode(boxScore.stats.visitorTeamHomeRuns));
+			tr.appendChild(td);
+			tbody.appendChild(tr);
+			
+			statsDiv.appendChild(table);
+		} else {
+			
+		}
+    }
+
+    dojo.addOnLoad(function() {
+        var button = dojo.byId("getgame");
+        dojo.connect(button, "onclick", function(event) {
+        	var selectedContextType = dojo.byId("contexttype");
+        	var selectedScoreType = dojo.byId("scoretype");
+        	var selectedGameNum = dojo.byId("gamenum");
+            var requestURLValue = 'scoreboard/game/' + selectedContextType.value;
+            var ifModifiedSince = "";
+            if(selectedGameNum.value == "1" && selectedScoreType.value == "score") {
+            	ifModifiedSince = scoreBoard[0].score.lastModified;
+            } else if(selectedGameNum.value == "1" && selectedScoreType.value == "boxscore") {
+            	ifModifiedSince = scoreBoard[0].stats.lastModified;
+            } else if(selectedGameNum.value == "2" && selectedScoreType.value == "score") {
+            	ifModifiedSince = scoreBoard[1].score.lastModified;
+            } else if(selectedGameNum.value == "2" && selectedScoreType.value == "boxscore") {
+            	ifModifiedSince = scoreBoard[1].stats.lastModified;
+            }
+            if(selectedContextType.value != "uri") {
+            	var headers = {
+                	"X-GameNum" : selectedGameNum.value,
+                	"X-ScoreType" : selectedScoreType.value,
+                	"Accept" : "text/xml",
+                	"If-Modified-Since" : ifModifiedSince
+            	};
+            } else {
+            	requestURLValue = requestURLValue + '?gamenum=' + selectedGameNum.value + '&type=' + selectedScoreType.value;
+            	var headers = {
+                	"Accept" : "text/xml",
+                	"If-Modified-Since" : ifModifiedSince
+            	};
+            }
+            var headersValue = "";
+            for (var h in headers) {
+                headersValue += h + ": " + headers[h] + "\r\n"
+            }
+            updateRequest(requestURLValue, "GET", "", headersValue);
+            dojo.xhrGet( {
+                url: requestURLValue,
+                handleAs: "xml",
+                headers: headers,
+                handle: function(data, ioArgs) {
+                    updateResponse(data, ioArgs);
+                    updateScoreBoard(data, ioArgs, selectedGameNum.value);
+                    reloadScoreBoard(ioArgs, selectedGameNum.value, selectedScoreType.value);
+                }
+            });
+
+        });
+    });
+    
+    function getUpdateBoxScoreEntity(gameNum) {
+    	var boxScore = null;
+    	if(gameNum == "1") {
+    		boxScore = scoreBoard[0];
+    	} else {
+    		boxScore = scoreBoard[1];
+    	}
+    	
+    	var homeTeamScore = dojo.byId("hometeamscoreupdate").value;
+    	if(homeTeamScore == "")
+    		homeTeamScore = -1;
+    	var homeTeamHits = dojo.byId("hometeamhitsupdate").value;
+    	if(homeTeamHits == "")
+    		homeTeamHits = -1;
+    	var homeTeamErrors = dojo.byId("hometeamerrorsupdate").value;
+    	if(homeTeamErrors == "")
+    		homeTeamErrors = -1;
+    	var homeTeamWalks = dojo.byId("hometeamwalksupdate").value;
+    	if(homeTeamWalks == "")
+    		homeTeamWalks = -1;
+    	var homeTeamDoubles = dojo.byId("hometeamdoublesupdate").value;
+    	if(homeTeamDoubles == "")
+    		homeTeamDoubles = -1;
+    	var homeTeamTriples = dojo.byId("hometeamtriplesupdate").value;
+    	if(homeTeamTriples == "")
+    		homeTeamTriples = -1;
+    	var homeTeamHomeRuns = dojo.byId("hometeamhomerunsupdate").value;
+    	if(homeTeamHomeRuns == "")
+    		homeTeamHomeRuns = -1;
+		var visitorTeamScore = dojo.byId("visitorteamscoreupdate").value;
+		if(visitorTeamScore == "")
+			visitorTeamScore = -1;
+		var visitorTeamHits = dojo.byId("visitorteamhitsupdate").value;
+		if(visitorTeamHits == "")
+			visitorTeamHits = -1;
+    	var visitorTeamErrors = dojo.byId("visitorteamerrorsupdate").value;
+    	if(visitorTeamErrors == "")
+			visitorTeamErrors = -1;
+    	var visitorTeamWalks = dojo.byId("visitorteamwalksupdate").value;
+    	if(visitorTeamWalks == "")
+			visitorTeamWalks = -1;
+    	var visitorTeamDoubles = dojo.byId("visitorteamdoublesupdate").value;
+    	if(visitorTeamDoubles == "")
+			visitorTeamDoubles = -1;
+    	var visitorTeamTriples = dojo.byId("visitorteamtriplesupdate").value;
+    	if(visitorTeamTriples == "")
+			visitorTeamTriples = -1;
+    	var visitorTeamHomeRuns = dojo.byId("visitorteamhomerunsupdate").value;
+    	if(visitorTeamHomeRuns == "")
+			visitorTeamHomeRuns = -1;
+
+    	var score = "<score><homeScore>"+homeTeamScore+"</homeScore><homeTeam>"+boxScore.score.homeTeam+"</homeTeam><visitorScore>"+visitorTeamScore+"</visitorScore><visitorTeam>"+boxScore.score.visitorTeamScore+"</visitorTeam></score>";
+    	var homeStats = "<homeTeamDoubles>"+homeTeamDoubles+"</homeTeamDoubles><homeTeamErrors>"+homeTeamErrors+"</homeTeamErrors><homeTeamHits>"+homeTeamHits+"</homeTeamHits><homeTeamHomeRuns>"+homeTeamHomeRuns+"</homeTeamHomeRuns><homeTeamTriples>"+homeTeamTriples+"</homeTeamTriples><homeTeamWalks>"+homeTeamWalks+"</homeTeamWalks>";
+    	var visitorStats = "<visitorTeamDoubles>"+visitorTeamDoubles+"</visitorTeamDoubles><visitorTeamErrors>"+visitorTeamErrors+"</visitorTeamErrors><visitorTeamHits>"+visitorTeamHits+"</visitorTeamHits><visitorTeamHomeRuns>"+visitorTeamHomeRuns+"</visitorTeamHomeRuns><visitorTeamTriples>"+visitorTeamTriples+"</visitorTeamTriples><visitorTeamWalks>"+visitorTeamWalks+"</visitorTeamWalks>";
+    	
+    	return "<boxScore>"+score+"<stats>"+homeStats+visitorStats+"</stats></boxScore>";
+    }
+    
+    dojo.addOnLoad(function() {
+        var button = dojo.byId("putgame");
+        dojo.connect(button, "onclick", function(event) {
+            var selectedGameNum = dojo.byId("gamenumput");
+            var requestURLValue = 'scoreboard/game/' + selectedGameNum.value;
+            
+            var entity = getUpdateBoxScoreEntity(selectedGameNum.value);
+            var cleanedUpString = entity.replace(/</g, "&lt;").replace(/>/g, "&gt;");
+
+            var requestHeaders = {
+                "Content-Type" : "text/xml"
+            };
+
+            var requestHeadersValue = "";
+            for (var h in requestHeaders) {
+                requestHeadersValue += h + ": " + requestHeaders[h] + "\r\n"
+            }
+
+            updateRequest(requestURLValue, "PUT", cleanedUpString, requestHeadersValue);
+
+            dojo.xhrPut( {
+                url: requestURLValue,
+                handleAs: "xml",
+                headers: requestHeaders, 
+                putData: entity,
+                handle: function(data, ioArgs) {
+                    updateResponse(data, ioArgs);
+                }
+            });
+
+        });
+    });
+    
+</script>
+
+<body class="soria">
+<p>Context Sample</p>
+
+<p>Welcome to the Context sample.  This sample demonstrates the various ways that the @Context annotation can be used to obtain information about a request and interact directly with the servlet container.  The JAX-RS sample application has multiple root resources that are functionally equivilant but have different method parameters and return types.</p>
+
+<p>On this page, you can submit GET requests to the resources and see the requests and responses. The requests will be handled using information injected into the resource method parameters using the @Context annotation. Depending on the resource method invoked, the response maybe be written and committed directly to the HttpServletResponse.</p>
+
+<p>No matter the context, all resource methods use the @Context annotation to obtain a Request Object. The Request is used to evaluate the Last-Modified date of the request to determine whether or not to return updated information in the response.  Updating game information resets the Last-Modified time to the current time.</p>
+
+<div>
+1)  Choose the context type to use to process Requests:
+<form>
+<select id="contexttype" name="contexttype">
+<option value="uri" selected>uri</option>
+<option value="headers">headers</option>
+<option value="servlet">servlet</option>
+<option value="contextresolver">contextresolver</option>
+</select>
+</form>
+
+About the context type options:
+<ol>
+<li><b>uri</b>:<br/>UriInfo is used to obtain the query parameters and determine which game and score type to return.</li>
+<li><b>headers</b>:<br/>The game and score type are read from the HttpHeaders.</li>
+<li><b>servlet</b>:<br/>The game and score type headers are read directly from the HttpServletRequest. A Providers instance is used to invoke the MessageBodyWriter directly to write and commit the response to the HttpServletResponse.</li>
+<li><b>contextresolver</b>:<br/>Same as HttpServletRequest/HttpServletResponse except that a ContextResolver is used to obtain the JAXBContext and marshall the response to the HttpServletResponse.</li>
+</ol>
+</div>
+
+<div>
+2)  Choose the score type to be returned. Choose "Score" to return a just a score or "BoxScore" to return the score along with the game stats:
+<form>
+<select id="scoretype" name="scoretype">
+<option value="score" selected>Score</option>
+<option value="boxscore">BoxScore</option>
+</select>
+</form>
+
+</div>
+
+<div>
+3)  Choose an action by selecting one of the tabs:
+<div dojoType="dijit.layout.TabContainer" style="width: 100%; height: 370px;">
+
+<div dojoType="dijit.layout.ContentPane" title="GET">
+<p>Choose a game to get the score for.</p>
+<form>
+<table>
+<tr><td valign="right">
+<select id="gamenum" name="gamenum">
+<option value="1" selected>Game 1</option>
+<option value="2">Game 2</option>
+</select>
+</td></tr>
+<tr><td colspan="2"><button name="submit" id="getgame" dojoType="dijit.form.Button">Get the Score</button></td></tr>
+</table>
+</form>
+</div>
+
+<div dojoType="dijit.layout.ContentPane" title="PUT">
+<form>
+<table>
+<tr><td><p>Choose a game to update.</p></td></tr>
+<tr><td valign="right">
+<select id="gamenumput" name="gamenumput">
+<option value="1" selected>Game 1</option>
+<option value="2">Game 2</option>
+</select>
+</td></tr>
+<tr></tr>
+</table>
+<p>Enter the updated information.</p>
+<table>
+<tr>
+<td>HomeTeamScore</td><td valign="right"><input type="text" name="HomeTeamScore" id="hometeamscoreupdate"/></td>
+<td>VisitorTeamScore</td><td valign="right"><input type="text" name="VisitorTeamScore" id="visitorteamscoreupdate"/></td>
+</tr>
+<tr>
+<td>HomeTeamHits</td><td valign="right"><input type="text" name="HomeTeamHits" id="hometeamhitsupdate"/></td>
+<td>VisitorTeamHits</td><td valign="right"><input type="text" name="VisitorTeamHits" id="visitorteamhitsupdate"/></td>
+</tr>
+<tr>
+<td>HomeTeamErrors</td><td valign="right"><input type="text" name="HomeTeamErrors" id="hometeamerrorsupdate"/></td>
+<td>VisitorTeamErrors</td><td valign="right"><input type="text" name="VisitorTeamErrors" id="visitorteamerrorsupdate"/></td>
+</tr>
+<tr>
+<td>HomeTeamWalks</td><td valign="right"><input type="text" name="HomeTeamWalks" id="hometeamwalksupdate"/></td>
+<td>VisitorTeamWalks</td><td valign="right"><input type="text" name="VisitorTeamWalks" id="visitorteamwalksupdate"/></td>
+</tr>
+<tr>
+<td>HomeTeamDoubles</td><td valign="right"><input type="text" name="HomeTeamDoubles" id="hometeamdoublesupdate"/></td>
+<td>VisitorTeamDoubles</td><td valign="right"><input type="text" name="VisitorTeamDoubles" id="visitorteamdoublesupdate"/></td>
+</tr>
+<tr>
+<td>HomeTeamTriples</td><td valign="right"><input type="text" name="HomeTeamTriples" id="hometeamtriplesupdate"/></td>
+<td>VisitorTeamTriples</td><td valign="right"><input type="text" name="VisitorTeamTriples" id="visitorteamtriplesupdate"/></td>
+</tr>
+<tr>
+<td>HomeTeamHomeRuns</td><td valign="right"><input type="text" name="HomeTeamHomeRuns" id="hometeamhomerunsupdate"/></td>
+<td>VisitorTeamHomeRuns</td><td valign="right"><input type="text" name="VisitorTeamHomeRuns" id="visitorteamhomerunsupdate"/></td>
+</tr>
+<tr><td colspan="2"><button name="submitscore" id="putgame" dojoType="dijit.form.Button">Update the Score</button></td></tr>
+</table>
+</form>
+</div>
+
+</div>
+
+<div>
+4)  See the actual request/response:
+<table>
+<tr><th colspan="2">Request</th></tr>
+<tr><td valign="top" align="right">URL:</td><td id="requestURL" valign="top"></td></tr>
+<tr><td valign="top" align="right">HTTP Method:</td><td id="requestMethod" valign="top"></td></tr>
+<tr><td valign="top" align="right">Headers:</td><td id="requestHeaders" valign="top"></td></tr>
+<tr><td valign="top" align="right">Entity:</td><td id="requestEntity" valign="top"></td></tr>
+</tr>
+
+
+<tr><th colspan="2">Response</th></tr>
+<tr><td valign="top" align="right">Status Code:</td><td id="responseStatusCode" valign="top"></td></tr>
+<tr><td valign="top" align="right">Headers:</td><td id="responseHeaders" valign="top"></td></tr>
+<tr><td valign="top" align="right">Entity:</td><td id="responseEntity" valign="top"></td></tr>
+</table>
+</div>
+
+<div>
+5) Here is the score you have selected for in your last GET request:
+<div id="score">
+</div>
+<div id="stats">
+</div>
+</div>
+
+</body>
+</html>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/samples/guestbook/build.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/guestbook/build.xml?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/guestbook/build.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/guestbook/build.xml Tue Jun 23 05:33:31 2009
@@ -0,0 +1,187 @@
+<project name="guestbook" default="all">
+
+	<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you 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.
+  -->
+
+	<dirname file="${ant.file.guestbook}" property="sample.base.dir" />
+	<property name="sample.build.dir" location="${sample.base.dir}/build" />
+	<property name="sample.compile.dir" location="${sample.build.dir}/classes" />
+	<property name="sample.work.dir" location="${sample.build.dir}/work" />
+	<property name="sample.dist.dir" location="${sample.base.dir}/dist" />
+
+	<property name="sample.runtime.dir" location="${sample.base.dir}/runtime" />
+	<available file="${sample.runtime.dir}" type="dir" property="sample.runtime.dir.exists" />
+
+	<property name="sample.server.src.dir" location="${sample.base.dir}/server/src" />
+	<property name="sample.server.build.dir" location="${sample.compile.dir}/server/" />
+
+	<property name="sample.client.dir" location="${sample.base.dir}/client" />
+	<property name="sample.client.static.dir" location="${sample.base.dir}/client/static" />
+
+	<!-- Get the current directory name.  This is needed to label
+	     the sample WAR, JAR, etc.  -->
+	<basename property="archiveName" file="${sample.base.dir}" />
+
+	<!-- Classpath to compile with -->
+	<path id="sample.compile.classpath">
+		<path refid="${samples.compile.classpathref}" />
+		<pathelement path="${classpath}" />
+	</path>
+
+	<target name="init">
+	</target>
+
+	<target name="clean" description="Cleans all built artifacts." depends="init">
+		<delete dir="${sample.build.dir}" includeemptydirs="true" failonerror="false" />
+		<mkdir dir="${sample.build.dir}" />
+		<mkdir dir="${sample.compile.dir}" />
+		<mkdir dir="${sample.work.dir}" />
+
+		<delete dir="${sample.dist.dir}" includeemptydirs="true" failonerror="false" />
+		<mkdir dir="${sample.dist.dir}" />
+	</target>
+
+	<!-- Just does the compile of sample src.  -->
+	<target name="compileServer" depends="init, clean">
+		<echo>-------------------------------------------</echo>
+		<echo>Compiling Server Side Sample - ${archiveName}</echo>
+		<echo>-------------------------------------------</echo>
+
+		<mkdir dir="${sample.server.build.dir}" />
+		<javac srcdir="${sample.server.src.dir}" destdir="${sample.server.build.dir}" debug="on">
+			<classpath refid="${samples.compile.classpathref}" />
+		</javac>
+	</target>
+
+	<target name="compile" description="Compiles all source code.">
+		<antcall target="compileServer">
+		</antcall>
+	</target>
+
+	<target name="distClient">
+		<war destfile="${sample.dist.dir}/${archiveName}_client.war" webxml="${sample.base.dir}/client/WEB-INF/web.xml">
+			<fileset dir="." includes="client/src/**" />
+			<zipfileset src="${sample.client.static.dir}/content.zip" />
+			<zipfileset dir="${sample.client.static.dir}">
+				<exclude name="*.zip" />
+			</zipfileset>
+			<lib refid="${samples.filesetref}" />
+			<lib refid="${samples.runtime.filesetref}" />
+		</war>
+	</target>
+
+	<!-- Get the current directory name.  This is needed to label
+	     the sample WAR, JAR, etc.  -->
+	<basename property="archiveName" file="${basedir}" />
+
+	<target name="distServer">
+		<war destfile="${sample.dist.dir}/${archiveName}_server.war" webxml="${sample.base.dir}/server/WEB-INF/web.xml">
+			<fileset dir="." includes="server/src/**" />
+			<classes dir="${sample.server.build.dir}" />
+			<lib refid="${samples.filesetref}" />
+			<lib refid="${samples.runtime.filesetref}" />
+		</war>
+	</target>
+
+	<target name="dist" description="Packages the sample for distribution.">
+		<antcall target="distServer">
+		</antcall>
+		<antcall target="distClient">
+		</antcall>
+	</target>
+
+	<target name="all" depends="clean, compile, dist">
+	</target>
+
+	<!-- Magic -->
+	<condition property="samples.compile.classpathref" value="samples.compile.classpath.packaged" else="samples.compile.classpath.dist.runtime">
+		<isset property="sample.runtime.dir.exists" />
+	</condition>
+
+	<condition property="samples.filesetref" value="samples.classpath.packaged.fileset" else="samples.classpath.dist.fileset">
+		<isset property="sample.runtime.dir.exists" />
+	</condition>
+
+	<condition property="samples.runtime.filesetref" value="samples.runtime.packaged.fileset" else="samples.runtime.dist.fileset">
+		<isset property="sample.runtime.dir.exists" />
+	</condition>
+
+	<path id="samples.compile.classpath.packaged">
+		<!-- If this is a sample by itself, expect the JARs to be in a subdirectory. -->
+		<fileset refid="${samples.filesetref}" />
+		<fileset refid="${samples.runtime.filesetref}" />
+	</path>
+
+	<path id="samples.compile.classpath.dist.runtime">
+		<fileset refid="${samples.filesetref}" />
+		<fileset refid="${samples.runtime.filesetref}" />
+	</path>
+
+	<fileset dir="${sample.base.dir}/lib" id="samples.runtime.packaged.fileset">
+		<include name="ibmjaxrs*.jar" />
+	</fileset>
+
+	<fileset dir="${sample.base.dir}/../../build" id="samples.runtime.dist.fileset">
+		<include name="ibmjaxrs*.jar" />
+	</fileset>
+
+	<fileset dir="${sample.runtime.dir}/lib" id="samples.classpath.packaged.fileset">
+		<include name="asm-all-3.1.jar" />
+		<include name="serp-1.13.1.jar" />
+
+		<include name="commons-logging-1.1.1.jar" />
+
+		<include name="abdera-0.4.0-incubating.jar" />
+		<include name="abdera-core-0.4.0-incubating.jar" />
+		<include name="axiom-api-1.2.5.jar" />
+		<include name="axiom-impl-1.2.5.jar" />
+		<include name="commons-codec-1.3.jar" />
+		<include name="jaxen-1.1.1.jar" />
+
+		<include name="xmlbeans-2.3.0.jar" />
+
+		<include name="jsr311-api-0.11.jar" />
+	</fileset>
+
+	<fileset dir="${sample.base.dir}/../../lib" id="samples.classpath.dist.fileset">
+		<include name="asm-all-3.1.jar" />
+		<include name="serp-1.13.1.jar" />
+
+		<include name="commons-logging-1.1.1.jar" />
+
+		<include name="abdera-0.4.0-incubating.jar" />
+		<include name="abdera-core-0.4.0-incubating.jar" />
+		<include name="axiom-api-1.2.5.jar" />
+		<include name="axiom-impl-1.2.5.jar" />
+		<include name="commons-codec-1.3.jar" />
+		<include name="jaxen-1.1.1.jar" />
+
+		<include name="xmlbeans-2.3.0.jar" />
+
+		<include name="jsr311-api-0.11.jar" />
+	</fileset>
+
+	<target name="packageSampleOnly">
+		<mkdir dir="${sample.runtime.dir}/lib" />
+		<copy todir="${sample.runtime.dir}/lib">
+			<fileset refid="samples.classpath.dist.fileset">
+			</fileset>
+		</copy>
+	</target>
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/samples/guestbook/client/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/guestbook/client/WEB-INF/web.xml?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/guestbook/client/WEB-INF/web.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/guestbook/client/WEB-INF/web.xml Tue Jun 23 05:33:31 2009
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you 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.
+  -->
+
+	<!--
+		This program may be used, executed, copied, modified and distributed
+		without royalty for the purpose of developing, using, marketing, or
+		distributing.
+	-->
+<web-app id="WebApp_ID" version="2.5"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+</web-app>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/samples/guestbook/client/src/deleteme.txt
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/guestbook/client/src/deleteme.txt?rev=787552&view=auto
==============================================================================
    (empty)

Added: incubator/wink/contrib/ibm-jaxrs/samples/guestbook/client/static/content.zip
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/guestbook/client/static/content.zip?rev=787552&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/contrib/ibm-jaxrs/samples/guestbook/client/static/content.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wink/contrib/ibm-jaxrs/samples/guestbook/client/static/guestbook.html
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/guestbook/client/static/guestbook.html?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/guestbook/client/static/guestbook.html (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/guestbook/client/static/guestbook.html Tue Jun 23 05:33:31 2009
@@ -0,0 +1,260 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<title>IBM JAX-RS: Guestbook</title>
+<script type="text/javascript" src="dojo/dojo.js"
+	djConfig="parseOnLoad: true"></script>
+<style type="text/css">
+</style>
+
+<script type="text/javascript">
+	dojo.require("dijit.layout.BorderContainer");
+	dojo.require("dijit.layout.ContentPane");
+	dojo.require("dojo.parser");
+	dojo.require("dojox.data.dom");
+
+	function updateStatus(ioArgs) {
+		var text = ioArgs.xhr.responseText;
+		text = text.replace(/</g, "&lt;");
+		text = text.replace(/>/g, "&gt;");
+		dojo.byId("status").innerHTML = "HTTP status code:<br/>"
+				+ ioArgs.xhr.status
+				+ "<br/>HTTP response:<br/><textarea cols=\"60\" rows=\"5\">"
+				+ text + "</textarea>";
+	}
+
+	function getComments() {
+		dojo.xhrGet( {
+			url :"/samples/guestbook/guestbook",
+			handleAs :"xml",
+			timeout :5000,
+
+			headers : {
+				'Accept' :'text/xml'
+			},
+
+			preventCache: true,
+
+			load : function(response, ioArgs) {
+				var commentsTable = dojo.byId("comments");
+
+				while (commentsTable.childNodes.length > 0) {
+					commentsTable.removeChild(commentsTable.firstChild);
+				}
+
+				var tbody = document.createElement("tbody");
+
+				var responseXML = dojox.data.dom
+						.createDocument(ioArgs.xhr.responseText);
+
+				var comments = responseXML.getElementsByTagName("comment");
+				for ( var c = 0; c < comments.length; ++c) {
+					var comment = comments.item(c);
+
+					var tr = document.createElement("tr");
+					var td = document.createElement("td");
+					td.appendChild(document
+							.createTextNode(comment.getElementsByTagName("id")
+									.item(0).firstChild.nodeValue));
+					tr.appendChild(td);
+
+					td = document.createElement("td");
+					td.appendChild(document
+							.createTextNode(comment.getElementsByTagName(
+									"author").item(0).firstChild.nodeValue));
+					tr.appendChild(td);
+
+					td = document.createElement("td");
+					td.appendChild(document
+							.createTextNode(comment.getElementsByTagName(
+									"message").item(0).firstChild.nodeValue));
+					tr.appendChild(td);
+
+					tbody.appendChild(tr);
+				}
+
+				commentsTable.appendChild(tbody);
+				return response;
+			},
+
+			error : function(response, ioArgs) {
+				return response;
+			}
+		});
+	}
+
+	function getComment() {
+		var commentForm = dojo.byId("commentForm");
+		dojo.xhrGet( {
+			url :"/samples/guestbook/guestbook/" + commentForm.id.value,
+			handleAs :"xml",
+			timeout :5000,
+			preventCache: false,
+			load : function(response, ioArgs) {
+				updateStatus(ioArgs);
+				return response;
+			},
+
+			error : function(response, ioArgs) {
+				updateStatus(ioArgs);
+				return response;
+			}
+		});
+	}
+
+	function newComment() {
+		var commentForm = dojo.byId("commentForm");
+		var commentData = "<comment>";
+		if (commentForm.id.value != "") {
+			commentData += "<id>" + commentForm.id.value + "</id>";
+		}
+		if (commentForm.author.value != "") {
+			commentData += "<author>" + commentForm.author.value + "</author>";
+		}
+		if (commentForm.message.value != "") {
+			commentData += "<message>" + commentForm.message.value
+					+ "</message>";
+		}
+		commentData += "</comment>";
+		if (commentForm.id.value == "" && commentForm.author.value == ""
+				&& commentForm.message.value == "") {
+			commentData = " ";
+		}
+		dojo.rawXhrPost( {
+			url :"/samples/guestbook/guestbook",
+			handleAs :"xml",
+			timeout :5000,
+			postData :commentData,
+			preventCache: false,
+
+			load : function(response, ioArgs) {
+				updateStatus(ioArgs);
+				getComments();
+				return response;
+			},
+
+			headers : {
+				'Accept' :'text/xml',
+				'Content-Type' :'text/xml'
+			},
+
+			error : function(response, ioArgs) {
+				updateStatus(ioArgs);
+				getComments();
+				return response;
+			}
+		});
+	}
+
+	function updateComment() {
+		var commentForm = dojo.byId("commentForm");
+		var commentData = "<comment>";
+		if (commentForm.id.value != "") {
+			commentData += "<id>" + commentForm.id.value + "</id>";
+		}
+		if (commentForm.author.value != "") {
+			commentData += "<author>" + commentForm.author.value + "</author>";
+		}
+		if (commentForm.message.value != "") {
+			commentData += "<message>" + commentForm.message.value
+					+ "</message>";
+		}
+		commentData += "</comment>";
+		if (commentForm.id.value == "" && commentForm.author.value == ""
+				&& commentForm.message.value == "") {
+			commentData = " ";
+		}
+		dojo.rawXhrPut( {
+			url :"/samples/guestbook/guestbook/" + commentForm.id.value,
+			handleAs :"xml",
+			timeout :5000,
+			putData :commentData,
+			preventCache: false,
+
+			load : function(response, ioArgs) {
+				updateStatus(ioArgs);
+				getComments();
+				return response;
+			},
+
+			headers : {
+				'Accept' :'text/xml',
+				'Content-Type' :'text/xml'
+			},
+
+			error : function(response, ioArgs) {
+				updateStatus(ioArgs);
+				getComments();
+				return response;
+			}
+		});
+	}
+	
+
+	function deleteComment() {
+		var commentForm = dojo.byId("commentForm");
+		dojo.xhrDelete( {
+			url :"/samples/guestbook/guestbook/" + commentForm.id.value,
+			handleAs :"xml",
+			timeout :5000,
+			preventCache: false,
+			load : function(response, ioArgs) {
+				updateStatus(ioArgs);
+				return response;
+			},
+
+			error : function(response, ioArgs) {
+				updateStatus(ioArgs);
+				return response;
+			}
+		});
+		getComments();
+	}
+
+	dojo.addOnLoad(getComments);
+</script>
+</head>
+
+<body class="tundra">
+
+<div style="width: 600px; margin-left: auto; margin-right: auto">
+<div>
+<h2>Guestbook</h2>
+</div>
+<div style="background-color: lightblue">
+<form id="commentForm">
+<table>
+	<tr>
+		<td>ID:</td>
+		<td><input type="text" size="30" name="id" /></td>
+	</tr>
+	<tr>
+		<td>Author:</td>
+		<td><input type="text" size="30" name="author" /></td>
+	</tr>
+	<tr>
+		<td>Message:</td>
+		<td><textarea name="message" cols="60" rows="3"></textarea></td>
+	</tr>
+	<tr>
+		<td colspan="2"><input type="button" value="POST Request"
+			onclick="javascript:newComment()" /><input type="button"
+			value="GET Request" onclick="javascript:getComment()" /><input type="button"
+			value="PUT Request" onclick="javascript:updateComment()" /><input type="button"
+			value="DELETE Request" onclick="javascript:deleteComment()" /><input type="button"
+			value="Refresh Comments" onclick="javascript:getComments()" /></td>
+	</tr>
+</table>
+</form>
+<div style="background: yellow; margin-left: auto; margin-right: auto"
+	id="status">No action yet.</div>
+<table id="comments">
+	<tr>
+		<td></td>
+	</tr>
+</table>
+</div>
+</div>
+
+</body>
+</html>

Added: incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/WEB-INF/web.xml?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/WEB-INF/web.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/WEB-INF/web.xml Tue Jun 23 05:33:31 2009
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you 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.
+  -->
+
+	<!--
+		This program may be used, executed, copied, modified and distributed
+		without royalty for the purpose of developing, using, marketing, or
+		distributing.
+	-->
+<web-app id="WebApp_ID" version="2.5"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+	<servlet>
+		<servlet-name>Guestbook</servlet-name>
+		<servlet-class> com.ibm.ws.jaxrs.web.RESTServlet </servlet-class>
+		<init-param>
+			<param-name>javax.ws.rs.Application</param-name>
+			<param-value>com.ibm.rest.sample.guestbook.GuestbookApplication</param-value>
+		</init-param>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>Guestbook</servlet-name>
+		<url-pattern>/*</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/Comment.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/Comment.java?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/Comment.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/Comment.java Tue Jun 23 05:33:31 2009
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.ibm.rest.sample.guestbook;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "comment")
+public class Comment {
+
+    private Integer id;
+
+    private String message;
+
+    private String author;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    @XmlElement(nillable = false)
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public String getAuthor() {
+        return author;
+    }
+
+    public void setAuthor(String author) {
+        this.author = author;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/CommentError.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/CommentError.java?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/CommentError.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/CommentError.java Tue Jun 23 05:33:31 2009
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.ibm.rest.sample.guestbook;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "commenterror")
+public class CommentError {
+
+    private String errorMessage;
+
+    public String getErrorMessage() {
+        return errorMessage;
+    }
+
+    @XmlElement(name = "message")
+    public void setErrorMessage(String errorMessage) {
+        this.errorMessage = errorMessage;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/CommentList.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/CommentList.java?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/CommentList.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/CommentList.java Tue Jun 23 05:33:31 2009
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.ibm.rest.sample.guestbook;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "comments")
+public class CommentList {
+
+    private List<Comment> comments = new ArrayList<Comment>();
+
+    @XmlElement(name = "comment")
+    public List<Comment> getComments() {
+        return comments;
+    }
+
+    public void setComments(List<Comment> comments) {
+        this.comments = comments;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/GuestbookApplication.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/GuestbookApplication.java?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/GuestbookApplication.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/GuestbookApplication.java Tue Jun 23 05:33:31 2009
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.ibm.rest.sample.guestbook;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.core.Application;
+
+/**
+ * The JAX-RS Application config class.
+ */
+public class GuestbookApplication extends Application {
+
+    @Override
+    public Set<Class<?>> getClasses() {
+        Set<Class<?>> classes = new HashSet<Class<?>>();
+        classes.add(GuestbookResource.class);
+        classes.add(NullPointerExceptionMapper.class);
+        return classes;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/GuestbookDatabase.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/GuestbookDatabase.java?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/GuestbookDatabase.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/GuestbookDatabase.java Tue Jun 23 05:33:31 2009
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.ibm.rest.sample.guestbook;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A simple in-memory data store.
+ */
+public class GuestbookDatabase {
+
+    private static GuestbookDatabase guestbook = new GuestbookDatabase();
+
+    private Map<Integer, Comment> comments = Collections
+            .synchronizedMap(new HashMap<Integer, Comment>());
+
+    private GuestbookDatabase() {
+        /* private singleton constructor */
+    }
+
+    public static GuestbookDatabase getGuestbook() {
+        return guestbook;
+    }
+
+    public Comment getComment(Integer id) {
+        return comments.get(id);
+    }
+
+    public void storeComment(Comment msg) {
+        comments.put(msg.getId(), msg);
+    }
+
+    public Collection<Integer> getCommentKeys() {
+        return comments.keySet();
+    }
+
+    public void deleteComment(Integer id) {
+        comments.remove(id);
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/GuestbookException.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/GuestbookException.java?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/GuestbookException.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/GuestbookException.java Tue Jun 23 05:33:31 2009
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.ibm.rest.sample.guestbook;
+
+public class GuestbookException extends Exception {
+
+    private static final long serialVersionUID = -1975560538784455458L;
+
+    public GuestbookException() {
+        super();
+    }
+
+    public GuestbookException(String message) {
+        super(message);
+    }
+
+    public GuestbookException(Throwable cause) {
+        super(cause);
+    }
+
+    public GuestbookException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/GuestbookResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/GuestbookResource.java?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/GuestbookResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/GuestbookResource.java Tue Jun 23 05:33:31 2009
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.ibm.rest.sample.guestbook;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+/**
+ * The main JAX-RS resource.
+ */
+@Path("guestbook")
+public class GuestbookResource {
+
+    /**
+     * Adds a new message to the database.
+     *
+     * @return HTTP status 200
+     */
+    @POST
+    @Produces("text/xml")
+    @Consumes("text/xml")
+    public Response createComment(Comment aComment, @Context UriInfo uriInfo) {
+        /*
+         * If no comment data was sent, then return a bad request.
+         */
+        if (aComment == null) {
+            throw new WebApplicationException(Response.Status.BAD_REQUEST);
+        }
+
+        if (aComment.getId() == null || aComment.getMessage() == null
+                || aComment.getAuthor() == null) {
+            CommentError commentError = new CommentError();
+            commentError
+                    .setErrorMessage("Please include a comment ID, a message, and your name.");
+            Response resp = Response.status(Response.Status.BAD_REQUEST)
+                    .entity(commentError).build();
+            throw new WebApplicationException(resp);
+        }
+
+        GuestbookDatabase.getGuestbook().storeComment(aComment);
+        try {
+            return Response
+                    .created(
+                            new URI(uriInfo.getAbsolutePath() + "/"
+                                    + aComment.getId())).entity(aComment)
+                    .build();
+        } catch (URISyntaxException e) {
+            e.printStackTrace();
+            throw new WebApplicationException(e);
+        }
+    }
+
+    @PUT
+    @Path("{id}")
+    @Produces("text/xml")
+    @Consumes("text/xml")
+    public Response updateComment(Comment aComment, @PathParam("id") String commentId)
+            throws GuestbookException {
+        if (aComment.getId() == null
+                || !Integer.valueOf(commentId).equals(aComment.getId())) {
+            throw new GuestbookException("Unexpected ID.");
+        }
+
+        Comment existingComment = GuestbookDatabase.getGuestbook().getComment(
+                Integer.valueOf(commentId));
+        if (existingComment == null) {
+            throw new GuestbookException(
+                    "Cannot find existing comment to update.");
+        }
+        GuestbookDatabase.getGuestbook().storeComment(aComment);
+        return Response.ok(aComment).build();
+    }
+
+    @GET
+    @Path("{id}")
+    @Produces("text/xml")
+    public Response readComment(@PathParam("id") String commentId) {
+        Comment msg = GuestbookDatabase.getGuestbook().getComment(
+                Integer.valueOf(commentId));
+        if (msg == null) {
+            return Response.status(404).build();
+        }
+
+        return Response.ok(msg).build();
+    }
+
+    @GET
+    @Produces("text/xml")
+    public Response listComments() {
+        Collection<Integer> commentKeys = GuestbookDatabase.getGuestbook()
+                .getCommentKeys();
+        List<Comment> comments = new ArrayList<Comment>();
+        for (Integer key : commentKeys) {
+            Comment c = GuestbookDatabase.getGuestbook().getComment(key);
+            comments.add(c);
+        }
+        CommentList list = new CommentList();
+        list.setComments(comments);
+        return Response.ok(list).build();
+    }
+
+    @DELETE
+    @Path("{id}")
+    @Produces("text/xml")
+    public Response deleteComment(@PathParam("id") String commentId) {
+        GuestbookDatabase.getGuestbook().deleteComment(
+                Integer.valueOf(commentId));
+        return Response.noContent().build();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/NullPointerExceptionMapper.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/NullPointerExceptionMapper.java?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/NullPointerExceptionMapper.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/NullPointerExceptionMapper.java Tue Jun 23 05:33:31 2009
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.ibm.rest.sample.guestbook;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class NullPointerExceptionMapper implements ExceptionMapper<NullPointerException> {
+
+    public Response toResponse(NullPointerException arg0) {
+        CommentError commentError = new CommentError();
+        commentError.setErrorMessage("Someone forgot a null check.");
+        return Response.serverError().entity(commentError).build();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/ObjectFactory.java?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/ObjectFactory.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/guestbook/server/src/com/ibm/rest/sample/guestbook/ObjectFactory.java Tue Jun 23 05:33:31 2009
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.ibm.rest.sample.guestbook;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+@XmlRegistry
+public class ObjectFactory {
+
+    public CommentError createCommentError() {
+        return new CommentError();
+    }
+
+    public Comment createComment() {
+        return new Comment();
+    }
+
+    public CommentList createCommentList() {
+        return new CommentList();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/samples/helloWorld/build.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/helloWorld/build.xml?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/helloWorld/build.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/helloWorld/build.xml Tue Jun 23 05:33:31 2009
@@ -0,0 +1,170 @@
+<project name="helloworld" default="all">
+
+	<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you 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.
+  -->
+
+	<dirname file="${ant.file.helloworld}" property="sample.base.dir" />
+	<property name="sample.build.dir" location="${sample.base.dir}/build" />
+	<property name="sample.compile.dir" location="${sample.build.dir}/classes" />
+	<property name="sample.work.dir" location="${sample.build.dir}/work" />
+	<property name="sample.dist.dir" location="${sample.base.dir}/dist" />
+
+	<property name="sample.runtime.dir" location="${sample.base.dir}/runtime" />
+	<available file="${sample.runtime.dir}" type="dir" property="sample.runtime.dir.exists" />
+
+	<property name="sample.server.src.dir" location="${sample.base.dir}/server/src" />
+	<property name="sample.server.build.dir" location="${sample.compile.dir}/server/" />
+
+	<!-- Get the current directory name.  This is needed to label
+	     the sample WAR, JAR, etc.  -->
+	<basename property="archiveName" file="${sample.base.dir}" />
+
+	<!-- Classpath to compile with -->
+	<path id="sample.compile.classpath">
+		<path refid="${samples.compile.classpathref}" />
+		<pathelement path="${classpath}" />
+	</path>
+
+	<target name="init">
+	</target>
+
+	<target name="clean" description="Cleans all built artifacts." depends="init">
+		<delete dir="${sample.build.dir}" includeemptydirs="true" failonerror="false" />
+		<mkdir dir="${sample.build.dir}" />
+		<mkdir dir="${sample.compile.dir}" />
+		<mkdir dir="${sample.work.dir}" />
+
+		<delete dir="${sample.dist.dir}" includeemptydirs="true" failonerror="false" />
+		<mkdir dir="${sample.dist.dir}" />
+	</target>
+
+	<!-- Just does the compile of sample src.  -->
+	<target name="compileServer" depends="init, clean">
+		<echo>-------------------------------------------</echo>
+		<echo>Compiling Server Side Sample - ${archiveName}</echo>
+		<echo>-------------------------------------------</echo>
+
+		<mkdir dir="${sample.server.build.dir}" />
+		<javac srcdir="${sample.server.src.dir}" destdir="${sample.server.build.dir}" debug="on">
+			<classpath refid="${samples.compile.classpathref}" />
+		</javac>
+	</target>
+
+	<target name="compile" description="Compiles all source code.">
+		<antcall target="compileServer">
+		</antcall>
+	</target>
+
+	<!-- Get the current directory name.  This is needed to label
+	     the sample WAR, JAR, etc.  -->
+	<basename property="archiveName" file="${basedir}" />
+
+	<target name="distServer">
+		<war destfile="${sample.dist.dir}/${archiveName}_server.war" webxml="${sample.base.dir}/server/WEB-INF/web.xml">
+			<fileset dir="." includes="server/src/**" />
+			<classes dir="${sample.server.build.dir}" />
+			<lib refid="${samples.filesetref}" />
+			<lib refid="${samples.runtime.filesetref}" />
+		</war>
+	</target>
+
+	<target name="dist" description="Packages the sample for distribution.">
+		<antcall target="distServer">
+		</antcall>
+	</target>
+
+	<target name="all" depends="clean, compile, dist">
+	</target>
+
+	<!-- Magic -->
+	<condition property="samples.compile.classpathref" value="samples.compile.classpath.packaged" else="samples.compile.classpath.dist.runtime">
+		<isset property="sample.runtime.dir.exists" />
+	</condition>
+
+	<condition property="samples.filesetref" value="samples.classpath.packaged.fileset" else="samples.classpath.dist.fileset">
+		<isset property="sample.runtime.dir.exists" />
+	</condition>
+
+	<condition property="samples.runtime.filesetref" value="samples.runtime.packaged.fileset" else="samples.runtime.dist.fileset">
+		<isset property="sample.runtime.dir.exists" />
+	</condition>
+
+	<path id="samples.compile.classpath.packaged">
+		<!-- If this is a sample by itself, expect the JARs to be in a subdirectory. -->
+		<fileset refid="${samples.filesetref}" />
+		<fileset refid="${samples.runtime.filesetref}" />
+	</path>
+
+	<path id="samples.compile.classpath.dist.runtime">
+		<fileset refid="${samples.filesetref}" />
+		<fileset refid="${samples.runtime.filesetref}" />
+	</path>
+
+	<fileset dir="${sample.base.dir}/lib" id="samples.runtime.packaged.fileset">
+		<include name="ibmjaxrs*.jar" />
+	</fileset>
+
+	<fileset dir="${sample.base.dir}/../../build" id="samples.runtime.dist.fileset">
+		<include name="ibmjaxrs*.jar" />
+	</fileset>
+
+	<fileset dir="${sample.runtime.dir}/lib" id="samples.classpath.packaged.fileset">
+		<include name="asm-all-3.1.jar" />
+		<include name="serp-1.13.1.jar" />
+
+		<include name="commons-logging-1.1.1.jar" />
+
+		<include name="abdera-0.4.0-incubating.jar" />
+		<include name="abdera-core-0.4.0-incubating.jar" />
+		<include name="axiom-api-1.2.5.jar" />
+		<include name="axiom-impl-1.2.5.jar" />
+		<include name="commons-codec-1.3.jar" />
+		<include name="jaxen-1.1.1.jar" />
+
+		<include name="xmlbeans-2.3.0.jar" />
+
+		<include name="jsr311-api-0.11.jar" />
+	</fileset>
+
+	<fileset dir="${sample.base.dir}/../../lib" id="samples.classpath.dist.fileset">
+		<include name="asm-all-3.1.jar" />
+		<include name="serp-1.13.1.jar" />
+
+		<include name="commons-logging-1.1.1.jar" />
+
+		<include name="abdera-0.4.0-incubating.jar" />
+		<include name="abdera-core-0.4.0-incubating.jar" />
+		<include name="axiom-api-1.2.5.jar" />
+		<include name="axiom-impl-1.2.5.jar" />
+		<include name="commons-codec-1.3.jar" />
+		<include name="jaxen-1.1.1.jar" />
+
+		<include name="xmlbeans-2.3.0.jar" />
+
+		<include name="jsr311-api-0.11.jar" />
+	</fileset>
+
+	<target name="packageSampleOnly">
+		<mkdir dir="${sample.runtime.dir}/lib" />
+		<copy todir="${sample.runtime.dir}/lib">
+			<fileset refid="samples.classpath.dist.fileset">
+			</fileset>
+		</copy>
+	</target>
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/samples/helloWorld/server/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/helloWorld/server/WEB-INF/web.xml?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/helloWorld/server/WEB-INF/web.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/helloWorld/server/WEB-INF/web.xml Tue Jun 23 05:33:31 2009
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you 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.
+  -->
+
+	<!--
+		This program may be used, executed, copied, modified and distributed
+		without royalty for the purpose of developing, using, marketing, or
+		distributing.
+	-->
+<web-app id="WebApp_ID" version="2.5"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+	<servlet>
+		<servlet-name>HelloWorld</servlet-name>
+		<servlet-class>com.ibm.ws.jaxrs.web.RESTServlet</servlet-class>
+		<init-param>
+			<param-name>javax.ws.rs.Application</param-name>
+			<param-value>com.ibm.jaxrs.sample.helloworld.HelloWorldApplication</param-value>
+		</init-param>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>HelloWorld</servlet-name>
+		<url-pattern>/*</url-pattern>
+	</servlet-mapping>
+</web-app>

Added: incubator/wink/contrib/ibm-jaxrs/samples/helloWorld/server/src/com/ibm/jaxrs/sample/helloworld/HelloWorldApplication.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/helloWorld/server/src/com/ibm/jaxrs/sample/helloworld/HelloWorldApplication.java?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/helloWorld/server/src/com/ibm/jaxrs/sample/helloworld/HelloWorldApplication.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/helloWorld/server/src/com/ibm/jaxrs/sample/helloworld/HelloWorldApplication.java Tue Jun 23 05:33:31 2009
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.ibm.jaxrs.sample.helloworld;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.core.Application;
+
+public class HelloWorldApplication extends Application {
+
+    @Override
+    public Set<Class<?>> getClasses() {
+        Set<Class<?>> classes = new HashSet<Class<?>>();
+        classes.add(HelloWorldResource.class);
+        return classes;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/samples/helloWorld/server/src/com/ibm/jaxrs/sample/helloworld/HelloWorldResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/samples/helloWorld/server/src/com/ibm/jaxrs/sample/helloworld/HelloWorldResource.java?rev=787552&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/samples/helloWorld/server/src/com/ibm/jaxrs/sample/helloworld/HelloWorldResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/samples/helloWorld/server/src/com/ibm/jaxrs/sample/helloworld/HelloWorldResource.java Tue Jun 23 05:33:31 2009
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.ibm.jaxrs.sample.helloworld;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+@Path("helloworld")
+public class HelloWorldResource {
+
+    @GET
+    public String helloWorld() {
+        return "Hello, World!";
+    }
+}