Jersey Rest + Angular JS + Bean Validation Webapp Example

This example demonstrates a simple Bean Validation (JSR-349) example with Jersey on the backend and AngularJs on the frontend.
Note: There is no validation on the frontend side, every error displayed is recognized on the backend.

Technologies and tools used

  • Jersey Rest - 2.27
  • IDE - Eclipse Noen
  • Maven - 3.5.3
  • JavaSE - 1.8
  • MySQL - 8.0.13
  • Tomcat - 8.5
  • Angular JS
  • Bootstrap CSS
Clone or download source code from my GitHub repository - bean-validation-webapp

Project Structure


URL Mapping

The mapping of the URI path space is presented in the following table:
URI pathResource classHTTP methodsAllowed values
/api/contactContactCardResourceGET, POST, DELETE
/api/contact/{id}ContactCardResourceGET, DELETEid - positive number
/api/contact/search/{searchType}?q={searchValue}SearchResourceGETsearchType - (name
Application is configured by using web.xml, which registers javax.ws.rs.core.Application descendant to get classes and singletons from it (see class MyApplication). Bean Validation annotations are present on resource classes (see ContactCardResource, SearchResource) as well as on the domain class (see ContactCard).

Running the Example

Once you Clone source code of this example from GitHub. There are three options to run this example:
  1. This is a maven project so you can build it using following command:
mvn clean install
Once build will success then deploy it in external tomcat.
  1. You can build from Eclipse IDE - Right click on project -> Run As -> Maven Build and enter below command in the wizard:
clean install
Once, build successful, then deploy this project in apache tomcat server 8.5. 3. 
  3. You can use jetty maven plugin to build and run the example as follows:
mvn clean package jetty:run
Once the application is up and running, type http://localhost:8080/jersey-helloworld-example/ link in a browser will show below output:
Check out Jersey Tutorial at http://www.javaguides.net/p/jersey-rest.html

Free Spring Boot Tutorial | Full In-depth Course | Learn Spring Boot in 10 Hours


Watch this course on YouTube at Spring Boot Tutorial | Fee 10 Hours Full Course

Comments