<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>indiWiz.com &#187; rest</title>
	<atom:link href="http://indiwiz.com/tag/rest/feed/" rel="self" type="application/rss+xml" />
	<link>http://indiwiz.com</link>
	<description>Subhash&#039;s Tech Log</description>
	<lastBuildDate>Sun, 29 Apr 2012 15:11:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Accessing RESTful WebServices with Prototype.js</title>
		<link>http://indiwiz.com/2009/07/22/accessing-restful-webservices-with-prototype-js/</link>
		<comments>http://indiwiz.com/2009/07/22/accessing-restful-webservices-with-prototype-js/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 07:30:14 +0000</pubDate>
		<dc:creator>Subhash Chandran</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://indiwiz.com/?p=396</guid>
		<description><![CDATA[We can make Ajax requests using Prototype.js (version 1.6.0.3) thus: While working on this code, we found out that the method parameter accepted only GET or POST requests. When we give any other request type like DELETE or PUT, the Prototype.js library converted the request to POST. Arun Jeganath found this post where the same [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop --><!-- End Shareaholic LikeButtonSetTop --><p>We can make Ajax requests using <a href="http://www.prototypejs.org/">Prototype.js</a> (version 1.6.0.3) thus:</p>
<pre class="brush: jscript; title: ; notranslate">
var url = ...;
new Ajax.Request(
            url,
            {
               method:'DELETE',
               onComplete:function doMessage(response){
                   alert(response.status);
               }
            });
</pre>
<p>While working on this code, we found out that the <tt>method</tt> parameter accepted only GET or POST requests. When we give any other request type like DELETE or PUT, the Prototype.js library converted the request to POST.</p>
<p><a href="http://www.linkedin.com/in/arunjeganath">Arun Jeganath</a> found <a href="https://prototype.lighthouseapp.com/projects/8886/tickets/289-allow-put-delete-and-other-http-methods-on-ajax-requests">this post</a> where the same issue is discussed. The problem was solved when we commented these lines from the Prototype.js code:</p>
<pre>
      if (!['get', 'post'].include(this.method)) {
        //simulate other verbs over post
        params['_method'] = this.method;
        this.method = 'post';
      }
</pre>
<div class="shr-publisher-396"></div><!-- Start Shareaholic LikeButtonSetBottom --><!-- End Shareaholic LikeButtonSetBottom -->]]></content:encoded>
			<wfw:commentRss>http://indiwiz.com/2009/07/22/accessing-restful-webservices-with-prototype-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with JBoss RESTEasy 1.0</title>
		<link>http://indiwiz.com/2009/01/26/getting-started-with-jboss-resteasy-10/</link>
		<comments>http://indiwiz.com/2009/01/26/getting-started-with-jboss-resteasy-10/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 11:07:43 +0000</pubDate>
		<dc:creator>Subhash Chandran</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[jax-rs]]></category>
		<category><![CDATA[rest]]></category>

		<guid isPermaLink="false">http://indiwiz.com/?p=176</guid>
		<description><![CDATA[So ready to jump start into JBoss RESTEasy? Dive! Writing the JAX-RS Class The first step, let us write a simple echo service using JAX-RS: Adding the JBoss RESTEasy dependency to Maven project If you are using Maven to build your projects, add the dependency for RESTEasy: Also remember to add the JBoss repository to [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop --><!-- End Shareaholic LikeButtonSetTop --><p>So ready to jump start into <a href="http://www.jboss.org/resteasy/">JBoss RESTEasy</a>? Dive!</p>
<h3>Writing the JAX-RS Class</h3>
<p>The first step, let us write a simple echo service using JAX-RS:</p>
<pre class="brush: java; title: ; notranslate">
package testpackage;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;

@Path(&quot;/echo&quot;)
public class Echo {
    @GET
    @Path(&quot;/{message}&quot;)
    public Response echoService(@PathParam(&quot;message&quot;) String message){
        return Response.status(200).entity(message).build();
    }
}
</pre>
<h3>Adding the JBoss RESTEasy dependency to Maven project</h3>
<p>If you are using Maven to build your projects, add the dependency for RESTEasy:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;dependency&gt;
    &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt;
    &lt;artifactId&gt;resteasy-jaxrs&lt;/artifactId&gt;
    &lt;version&gt;1.0.0.GA&lt;/version&gt;
&lt;/dependency&gt;
</pre>
<p>Also remember to add the JBoss repository to the <tt>pom.xml</tt> (RESTEasy is not available in Maven public repository):</p>
<pre class="brush: xml; title: ; notranslate">
&lt;repository&gt;
    &lt;id&gt;jboss&lt;/id&gt;
    &lt;url&gt;http://repository.jboss.com/maven2/&lt;/url&gt;
    &lt;releases&gt;
        &lt;enabled&gt;true&lt;/enabled&gt;
    &lt;/releases&gt;
    &lt;snapshots&gt;
        &lt;enabled&gt;false&lt;/enabled&gt;
    &lt;/snapshots&gt;
&lt;/repository&gt;
</pre>
<h3>Configuring web.xml</h3>
<p>The bare minimum needed to have RESTEasy running is:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;web-app ...&gt;
    ...
    &lt;listener&gt;
        &lt;listener-class&gt;org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap&lt;/listener-class&gt;
    &lt;/listener&gt;

    &lt;servlet&gt;
        &lt;servlet-name&gt;Resteasy&lt;/servlet-name&gt;
        &lt;servlet-class&gt;org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher&lt;/servlet-class&gt;
    &lt;/servlet&gt;

    &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;Resteasy&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    ...
&lt;/web-app&gt;
</pre>
<p>Above, we have just added the RESTEasy servlet and listener. Now we have to make it load our JAX-RS class. This can be done in two ways. One, just let RESTEasy scan the CLASSPATH to identify and load JAX-RS resources:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;web-app ...&gt;
    ...
    &lt;context-param&gt;
        &lt;param-name&gt;resteasy.scan&lt;/param-name&gt;
        &lt;param-value&gt;true&lt;/param-value&gt;
    &lt;/context-param&gt;
    ...
&lt;/web-app&gt;
</pre>
<p>The other option is to specify the resources manually (use CSV format):</p>
<pre class="brush: xml; title: ; notranslate">
&lt;web-app ...&gt;
    ...
    &lt;context-param&gt;
        &lt;param-name&gt;resteasy.resources&lt;/param-name&gt;
        &lt;param-value&gt;testpackage.Echo&lt;/param-value&gt;
    &lt;/context-param&gt;
    ...
&lt;/web-app&gt;
</pre>
<p>After deploying this, you may access your application (if your are using default Tomcat/Jetty installation): <a href="http://localhost:8080/resteasytest/echo/hello,world">http://localhost:8080/resteasytest/echo/hello,world</a> (assumes your application is deployed as <tt>resteasytest.war</tt>)</p>
<div class="shr-publisher-176"></div><!-- Start Shareaholic LikeButtonSetBottom --><!-- End Shareaholic LikeButtonSetBottom -->]]></content:encoded>
			<wfw:commentRss>http://indiwiz.com/2009/01/26/getting-started-with-jboss-resteasy-10/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

