Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

frevvo provides a very flexible and powerful mechanism for interacting with documents (and the web in general). You can [http://www.frevvo.com/bucket/restlet/RestletCustomerExample.zip download source code and forms] for the discussion below. We strongly recommend that you download the example, [[#Customer_Example|study it]] and use it as a template for integrating with your own web applications.

...

If you enter ID 99 (which does not exist), frevvo will GET .../customers/99, which returns an empty document. The form will be displayed with default values (as entered originally by the designer). When submitted, the resulting XML document will be PUT to .../customers/99. This PUT will create a new customer with ID 99 (the behaviour depends on the implementation on the server - in our example, the PUT creates the customer).==== Example ====

Example

This example is a good way to understand frevvo's handling of document URIs and the powerful capabilities of composing multiple document resources into view resources. You can download the entire example including source code and forms [http://www.frevvo.com/bucket/restlet/RestletCustomerExample.zip by clicking here].

This example follows the principles of REST and uses the [http://www.restlet.org Restlet framework] but you can use any framework or server-side model that you like. As mentioned earlier, frevvo forms can be thought of as View Resources that compose one or more Entity Resources (documents). In this example we have entities Customer and List of Customers. Reproduced here are the methods that they support.

ResourceMethod  
    
    
    
    
    

<table cellpadding="3" cellspacing="0" border="1"> <tr> <th>Resource<<th></th> <th>Method<<th></th> <th>Description</th> <th>Returns</th> </tr> <tr> <td>Customer List</td> <td>GET</td> <td>List of customers (may be criteria based)</td> <td>XML or JSON list of customers</td> </tr> <tr> <td>Customer List</td> <td>POST</td> <td>Create new customer</td> <td>URI of newly created customer</td></tr> <tr> <td>Customer</td> <td>GET</td> <td>Get customer data</td> <td>XML representation of cutsomer</td></tr> <tr> <td>Customer</td> <td>PUT</td> <td>Update customer</td> <td></td></tr> <tr> <td>Customer</td> <td>DELETE</td> <td>Remove customer</td> <td></td></tr> </table>

...