REpresentational State Transfer (REST) Web Service

Download Report

Transcript REpresentational State Transfer (REST) Web Service

0
An End-to-End Overview of a
RESTful Web Service
Behzad Samin
1
Agenda
 Overview


jQuery, Jersey, JDO (Behzad)
Google App Engine (David and Cory)
 Demo


(45 minutes)
(45 minutes)
Showing a sample application (Behzad).
Highlighting some of the Google App Engine
features to make development and support easier
(David and Cory).
 Q&A
(30 minutes)
2
Objectives
This is a presentation to explore a RESTful web
service end to end leveraging the following
technologies:
 jQuery (internationalization, list grid, context menu )
 Jersey
 JDO
 Google App Engine (cloud to virtualize application
server & data store)
3
jQuery a JavaScript Library
Simplifies HTML document traversing, event handling,
animating, and Ajax
interactions for rapid web development.




Cross-browser
CSS Compliant
Lightweight Footprint
And more…
To explore the features check out:
http://visualjquery.com/
4
internationalization
jQuery.i18n.properties is a lightweight jQuery plugin for
providing internationalization to javascript from ‘.properties’
files, just like in Java Resource Bundles.



Include plugin in your main page.
Load resource bundles based on browser or user
choice.
Get values per keys e.g. $.i18n.prop(’title')
5
list grid
dataTable is a plug-in for the jQuery Javascript library. It
is a flexible tool which will add advanced interaction
controls to any HTML table.
 Include plugin in your main page.
 Create an html table.
 Initialize the dataTable for the table.
 Enable and disable features per your
requirements.
6
context menu
contextMenu is a lightweight jQuery plugin that lets you
selectively override the browser's right-click menu with
a custom one of your own.




Include plugin in your main page.
Create an html list
Initialize the contextMenu for the list.
Bind a function for each contextMenu item select event.
7
REST vs. SOAP
8
Simple Object Access Protocol (SOAP) Web Service
9
REpresentational State Transfer (REST) Web Service
10
Building RESTful Web Services in
Jersey
Jersey is an open source, JAX-RS (JSR 311) Reference
Implementation for building RESTful Web services.
Jersey is more than a Reference Implementation because it
provides an API so that developers may extend Jersey to
suit their needs.
Getting Started:
http://jersey.java.net/nonav/documentation/latest/index.html
 A Good Example
http://www.vogella.de/articles/REST/article.html#rest

11
Java Data Objects (JDO)
To handle Data Access and Persistence, you can use
JDO, a standardised persistence API.
With JDO you can develop plain old java objects
(POJOs) and persist them as they are transparently.
 This requires very little work from the developer. It
allows persistence to any type of datastore in principle,
being designed with flexibility and datastore agnosticity
in mind.
 A good example of Defining Data Classes with JDO
http://code.google.com/appengine/docs/java/datastore/jdo
/dataclasses.html

12
Demo: Suggestion Entry System
13
Google App Engine
Run your web apps on Google's infrastructure:



Easy to build
Easy to maintain
Easy to scale
Focus on your app, leave the rest to Google


Zero to sixty: App Engine enables your application to scale automatically
without worrying about managing machines.
You're in control: The simple, web-based dashboard makes it easy to
manage your application without having to babysit it.
Google offers a Eclipse plugin that provides both Google App Engine
and GWT development capabilities. Install the plugins from
http://dl.google.com/eclipse/plugin/3.7 via the Eclipse update
manager.
14
Run Applications Locally
The Eclipse Plugin allows to run applications for the
Google App Engine
locally in an environment which simulates the
environment on the App Engine.
You also have a local admin console
(http://localhost:8888/_ah/admin/ ) which
allows you to see:



your local datastore
the task queue,
inbound email and XMPP traffic.
15
Run Applications in Google Cloud
To create an application on the Google App Engine, create an
application on
the Google App Engine website (https://appengine.google.com/ ).
Afterwards you can locally create an web application and upload
this
application to the created application on the Google App Engine.

To create an application on the App Engine press the button
"Create an application" and select an application name. You have to
choose one which is still available.