Eclipse Jersey is a REST framework that provides a JAX-RS (JSR-370) implementation
Developing RESTful Web services that seamlessly support exposing your data in a variety of representation media types and abstract away the low-level details of the client-server communication is not an easy task without a good toolkit. In order to simplify development of RESTful Web services and their clients in Java, a standard and portable JAX-RS API has been designed. Jersey RESTful Web Services framework is open source, production quality, framework for developing RESTful Web Services in Java that provides support for JAX-RS APIs and serves as a JAX-RS (JSR 311 & JSR 339) Reference Implementation.
Before going to configure Tomcat Server on your system donwload latest version of it and extract files from. Click here to donwload latest version of Tomcat 9.0.x
Go To IntelliJ Welcome screen and click On Configure
- Open the Settings/Preferences dialog Ctrl+Alt+S
- In the left-hand pane, in the Build, Execution, Deployment category, select Application Servers.
- Select the server that you are going to use( Choose Tomcat Server for now).
- Put the path of tomcat server installation directory under Tomcat_Home or just browse to select it.
- Click Create New Project on the Welcome screen. Otherwise, select File | New | Project from the main menu.
- Select Maven from the options on the left.
- Click on Create from archetype and then choose jersey.quickstart.webapp for this project and click Next.
if you don't find jersey.quickstart.webapp then add this by clicking add archetype. and putGroupId : org.glassfish.jersey.archetypes ArtifactId : jersey-quickstart-webapp Version : 2.16
Click Ok. 4. Provide GroupId,ArtifactId for your project and click Next and then if you want to change project directory then change it and click Finish.
Build Application
Go to terminal by clicking terminal option in intelliJ
mvn clean install
- Open the Run/Debug Configurations dialog (for example, Run | Edit Configurations).
- Click + , select the server of interest (for example, Tomcat Server) and, if available, select Local
- Choose the Deployment tab, clicking “+”, and choosing Artifact…
- Select Artifact listed then choose Apply and finally OK.
Run Application
Exposed REST End Point's
http://localhost:8080/jerseyimplementation_war/webapi/api/
Add a Student(GET)
http://localhost:8080/jerseyimplementation_war/webapi/api/add?name=Alex&roll=10003&marks=70&course=Software%20System
GET List Of All Students(GET)
http://localhost:8080/jerseyimplementation_war/webapi/api/getAll
Add a Student(Post)
http://localhost:8080/jerseyimplementation_war/webapi/api/addStudent
Request Body
{
"course":"Software System",
"marks":73.0,
"name":"Amit",
"roll":10023
}