code

Html page to call the REST service

index.html

  • The calling html page is a simple page with 2 inputs and a submit button

Number Service

NumberService.xml

  • Most of the configuration is done via annotations itself. The code just does the business logic (i.e to add 2 numbers)
  • Path("/number/") annotation specifies the relative URI path that this class will serve is /number/

Spring configuration

config.xml

  • The spring configuration is a simple one line to read all the configuration settings through annotations
  • RestApp - spring configuration file

Walk through the code

Now that the application is running, let's walk through the code.

web.xml

Launch the application

  • After the code is built launch the application by running mvn jetty:run
  • Once the application comes up you can access the application by accessing the url http://localhost
  • RestApp - Access application in browser
  • It is just a simple application that adds 2 numbers and prints their sum
  • Change some number and click submit, to see the results

Build the code

  • Now that the code is checked out, let's build it
  • From command line go into the simple-rest-app folder and run the Maven build command - mvn clean install
  • RestApp - Build code using Maven

Checkout the code

  • Using any gitclient checkout the source code from git://github.com/perusworld/simple-rest-app.git
  • I am checking out using the command line - git clone git://github.com/perusworld/simple-rest-app.git
  • RestApp - Checkout code from subversion

Who's online

There are currently 0 users and 1 guest online.

Who's new

  • rajupmani
  • micmaria_li
  • krishna
  • Saravana Peruma...

Syndicate content