# Lite RESTful Webservlet

**URL:** <https://www.ruby-forum.com/t/lite-restful-webservlet/82993>\
**Category:** Ruby\
**Created:** [January 22, 2007, 11:00pm UTC](https://www.ruby-forum.com/t/lite-restful-webservlet/82993 "2007-01-22T23:00:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/dfb087/32.png) [@Trans](https://www.ruby-forum.com/u/Trans)\
**Post date:** [January 22, 2007, 11:00pm UTC](https://www.ruby-forum.com/t/lite-restful-webservlet/82993/1 "2007-01-22T23:00:54Z")

</div>

Can anyone give me a quick and dirty account of creating a light-weight  
RESTful web-servlet that can be used to pass data and a file or two to  
a server. (I’m thinking webrick and maybe JSON could be used?)  
Anything to get my mind moving in the right direction…

Thanks,  
T.

---

<div class="post-metadata">

**Author:** ![Trans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/dfb087/32.png) [@Trans](https://www.ruby-forum.com/u/Trans)\
**Post date:** [January 22, 2007, 11:29pm UTC](https://www.ruby-forum.com/t/lite-restful-webservlet/82993/2 "2007-01-22T23:29:03Z")

</div>

On 22 Jan 2007, at 22:00, Trans wrote:

> Can anyone give me a quick and dirty account of creating a light-  
> weight  
> RESTful web-servlet that can be used to pass data and a file or two to  
> a server. (I’m thinking webrick and maybe JSON could be used?)  
> Anything to get my mind moving in the right direction…

I’m playing with webrick to try out AJAX at the moment (sans XML). It  
sounds like about the right thing for you. Here’s the tutorial I’m  
following:

[http://microjet.ath.cx/WebWiki/WEBrick.html](http://microjet.ath.cx/WebWiki/WEBrick.html)

I’m intrigued by Tofu and DIV, but the only docs I’ve found these are  
either Japanese, or hilarious but unenlightening Google translations 🙂

---

<div class="post-metadata">

**Author:** ![Trans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/dfb087/32.png) [@Trans](https://www.ruby-forum.com/u/Trans)\
**Post date:** [January 23, 2007, 6:03am UTC](https://www.ruby-forum.com/t/lite-restful-webservlet/82993/3 "2007-01-23T06:03:51Z")

</div>

Benjohn B. wrote:

> following:
> 
> [http://microjet.ath.cx/WebWiki/WEBrick.html](http://microjet.ath.cx/WebWiki/WEBrick.html)
> 
> I’m intrigued by Tofu and DIV, but the only docs I’ve found these are  
> either Japanese, or hilarious but unenlightening Google translations 🙂

Thanks, that was helpful. I got most of what I want in place, but I’m  
stuck the upload servlet part. Right now I have the whole file coming  
across in a cgi parameter and the file’s name as another cgi parameter,  
I know that can’t be right. I think I need multipart form data?

T.

---

<div class="post-metadata">

**Author:** ![Trans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/dfb087/32.png) [@Trans](https://www.ruby-forum.com/u/Trans)\
**Post date:** [January 23, 2007, 2:43pm UTC](https://www.ruby-forum.com/t/lite-restful-webservlet/82993/4 "2007-01-23T14:43:27Z")

</div>

Trans - Camping sounds like a good match for this type of thing.

[http://code.whytheluckystiff.net/camping](http://code.whytheluckystiff.net/camping)

I used it recently to produce a very simple web service, taking a few  
parameters, and passing back valid XML (via Builder).

I’d be happy to discuss it further if you’re interested.

---

<div class="post-metadata">

**Author:** ![Trans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/dfb087/32.png) [@Trans](https://www.ruby-forum.com/u/Trans)\
**Post date:** [January 23, 2007, 3:32pm UTC](https://www.ruby-forum.com/t/lite-restful-webservlet/82993/5 "2007-01-23T15:32:38Z")

</div>

Michael G. wrote:

> Trans - Camping sounds like a good match for this type of thing.
> 
> [http://code.whytheluckystiff.net/camping](http://code.whytheluckystiff.net/camping)
> 
> I used it recently to produce a very simple web service, taking a few  
> parameters, and passing back valid XML (via Builder).
> 
> I’d be happy to discuss it further if you’re interested.

Hmm. That’s a though, but how lite is Camping? I realease the main  
script is pretty small, but what dependencies does it have? Right now  
I’m using Webrick, and since that comes with Ruby that’s pretty lite  
😉

T.

---

<div class="post-metadata">

**Author:** ![Trans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/dfb087/32.png) [@Trans](https://www.ruby-forum.com/u/Trans)\
**Post date:** [January 23, 2007, 6:39pm UTC](https://www.ruby-forum.com/t/lite-restful-webservlet/82993/6 "2007-01-23T18:39:32Z")

</div>

Trans wrote:

> Hmm. That’s a though, but how lite is Camping? I realease the main  
> script is pretty small, but what dependencies does it have? Right now  
> I’m using Webrick, and since that comes with Ruby that’s pretty lite  
> 😉

s/though/thought/  
s/realease/realize/

gracious,  
T.

---

<div class="post-metadata">

**Author:** ![Trans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/dfb087/32.png) [@Trans](https://www.ruby-forum.com/u/Trans)\
**Post date:** [January 23, 2007, 10:25pm UTC](https://www.ruby-forum.com/t/lite-restful-webservlet/82993/7 "2007-01-23T22:25:32Z")

</div>

Trans wrote:

> Trans wrote:
> 
> > Hmm. That’s a though, but how lite is Camping? I realease the main  
> > script is pretty small, but what dependencies does it have? Right now  
> > I’m using Webrick, and since that comes with Ruby that’s pretty lite  
> > 😉
> 
> s/though/thought/  
> s/realease/realize/

Since nobody’s replied, this is the first expression of camping:

%w[active\_support markaby tempfile uri].map{|l|require l}

There are no other requires, so I guess it’s only active\_support and  
markaby to worry about.
