HongJun

E-Mail

<hongjun.bj AT gmail DOT com>

Homepage/blog/wiki URL

http://hongjun.bj.googlepages.com/

Country (born / living in)
China
Academic experience
Studying for My Master Degree
Your current occupation
Student
Software projects you have already participated in
  1. An OA (Office Automation) System. This system was implemented in Java, including web skills: HTML, CSS, XML, Ajax, JavaScript, JSON, RSS. I was one of the main programmers.

  2. RealWeather Project, Mashup with Google Map and weather information to provide real weather information, using Java to handle RSS data. It is available at http://code.google.com/p/realweather/

Other stuff you like to tell here
  • A widget demo was implemented in Python, based on TurboGears. It provides weather information on Google Map via Mashup. The demo discription and the code are available at

http://code.google.com/p/mapwidgets/wiki/WeatherMapWidget

Experience Level

Experience in coding in general
started 2002, 1000 hours
Experience in Python coding
started 2006, 120 hours
Experience in HTML
started 2005, 200 hours
Experience in CSS
started 2005, 20 hours
Experience in Javascript
started 2005, 200 hours
Your favourite programming language(s), best first

Python, Java, JavaScript, C

Tools you use for development
Ulipad(for Python), Eclipse(for Java and Python)
Did you already do full day work (8h/5d) over some weeks on some software project yet?
N
If not, is your motivation good enough that you think you can do that for MoinMoin?
Y

MoinMoin RESTful Interface

Foreword

"REST" was coined by Roy Fielding in his Ph.D dissertation to describe an architecture paradigm for web applications that request and manipulate web resources using the standard HTTP methods GET, POST, PUT and DELET. A resource is a URL-addressable entity, and can be represented in different formats like HTML, XML or RSS/Atom. Different from traditional web application, a resource URL does not address a model and its corresponding action, it address only the resource itself.

Why REST?

1. Clean URLs: REST URLs represent resources and not actions. Action is expressed with HTTP verbs.

2. Different Response Formats: The same action can deliver HTML, XML, RSS/Atom, or other data formats, depending on the requirements of the client.

3. CRUD-oriented Controllers: Each controller is responsible for the manipulation of one resource type

4. Clear Application Design: RESTful development results in a conceptually clear and maintainable application design.

5. Less Code. The development of multi-client-capable actions avoids repetitions

My Plan

Summary

The MoinMoin RESTful Interface makes it easy to offer private and public APIs for the general and consistent handling of resources. It gives every resource a unique URI and then use the standard HTTP verbs GET/PUT/DELETE/POST to manipulate them. The HTTP's verbs are directly translated to CRUD (create/read/update/delete) actions. It will simplify data retrieval and modification in a resource-centric architecture and provide model data in formats such as XML, JSON and RSS/Atom with very little custom code.

URL design

Mapping REST Concepts to MoinMoin Interface, HTTP's standard PUT/GET/POST/DELETE verbs translate directly to the Create/Read/Update/Delete features. HTTP Verbs and REST-URLs::

HTTP Verbs

REST-URL

Action

URL without REST

GET

/resources/{id}

read

GET /resources/{id}?action=read

DELETE

/resources/{id}

delete

GET /resources/{id}?action=delete

PUT

/resources/{id}

update

POST /resources/{id}?action=update

POST

/resources

create

POST /resources?action=create

Request Dispatch

Requests can be di spatched to the same URL to different handlers. As the following "dispatch" method defined, request will be dispatched to the CRUD action according to the HTTP's verb.

   def dispatch(self, request, target):
        request_method = request.method()
        if request_method == 'GET':
            return target.read(request)
        elif request_method == 'POST':
            return target.create(request)
        elif request_method == 'PUT':
            return target.update(request)
        elif request_method == 'DELETE':
            return target.delete(request)
        else:
            raise Http4

Action Response

Discussion

Referance

1. Roy Fielding: Architectural Styles and the Design of Network-based Software Architectures, http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm

2. Ralf Wirdemann, Thomas Bauster: RESTful Rails Development, http://www.b-simple.de/documents

MoinMoin: HongJun (last edited 2008-04-06 16:33:50 by 210)