Spiffy UI - GWT made simple
This sample shows you how to create, read, update, and delete with Spiffy UI forms. It includes a simple REST server running on Java with Jersey.
Everything starts with a REST bean named User.java
. This bean handles the CRUD operations of our application. The UI is handled in Index.java
.
This application shows you how to make the full range of REST requests and build complex form layouts with Spiffy UI. All data is stored in memory on the server so there's no additional setup. Just build it and run it and you'll get an application that looks like this:
This project is built with Apache Maven.
Go to your project's root directory and run the following command:
mvn package jetty:run
This will download the required libraries, build your project, and run it. You can access the running application here:
http://localhost:8080
See Spiffy UI's GWT Dev Mode page for more information.
This application exposes a simple REST API for editing users:
GET /api/users - Get a list of users including user details.
[
{
"birthday": "-11995200000",
"lastName": "Addams",
"userID": "aadams",
"desc": "Alice Addams is just some girl",
"email": "aadams@amazon.com",
"gender": "female",
"firstName": "Alice",
"password": "aaa"
},
{
"birthday": "269582400000",
"lastName": "Brown",
"userID": "bbrown",
"desc": "Bob Brown is just some guy",
"email": "bbrown@bn.com",
"gender": "male",
"firstName": "Bob",
"password": "b0bpass"
}
]
*GET /api/users/ - Get the data about the specified user.
{
"birthday": "-11995200000",
"lastName": "Addams",
"userID": "aadams",
"desc": "Alice Addams is just some girl",
"email": "aadams@amazon.com",
"gender": "female",
"firstName": "Alice",
"password": "aaa"
}
Returns a 404 if the specified user ID doesn't exist
*POST /api/users/ - Add the specified user.
Input:
{
"birthday": "-11995200000",
"lastName": "Addams",
"userID": "aadams",
"desc": "Alice Addams is just some girl",
"email": "aadams@amazon.com",
"gender": "female",
"firstName": "Alice",
"password": "aaa"
}
Output:
{"success": true}
*PUT /api/users/ - Update information about the specified user.
Input:
{
"birthday": "-11995200000",
"lastName": "Addams",
"userID": "aadams",
"desc": "Alice Addams is just some girl",
"email": "aadams@amazon.com",
"gender": "female",
"firstName": "Alice",
"password": "aaa"
}
Output:
{"success": true}
*DELETE /api/users/ - Delete the specified user from the system
Output:
{"success": true}
Returns a 404 if the specified user ID doesn't exist
Spiffy UI is available under the Apache License, Version 2.0.