Building RESTful Web Services with JAX-RS – Introduction

Post moved to

http://srinichekuri.com/2016/01/17/building-restful-web-services-with-jax-rs-introduction/

**********************************************************************

Introduction to REST:

REST Stands for REpresentational State Transfer. REST  is built to work best in web and uses a stateless communication protocol, typically HTTP. Following principles make RESTful application simple, lightweight and fast.

  • URIs are used to identify resources (services).
  • Uniform Indentification for CRID activities
    • Create – PUT
    • Read – GET
    • Update – POST
    • Delete – DELETE
  • Resources (Services) are decoupled from representation so their content can be accessed in variety of formats. Eg: HTML, Plain Text, XML, JSON etc
  • As Rest Services are Stateless, Stateful interaction can be done by URI rewriting, cookies and hidden fields.

Advantages of REST

  • Better Performance
  • Scalability
  • Modifiability.

Disadvantages of REST

  • Less Secure

<Put in an HelloWorldRest Service here with  text on what annotation means what>

Advertisements

Step by Step guide – Convert to Maven Project in Eclipse

Post moved to:

http://srinichekuri.com/2016/01/15/step-by-step-guide-convert-to-maven-project-in-eclipse/

**********************************************************************

This post is for step by step guide to convert a single project to Maven project in Eclipse. I recommend going through these links before you read any further.

Step 1: Maven Plugin for Eclipse

First you should make sure that you have Maven Plugin installed in your Eclipse. I am using Eclipse Mars for this demo and this version comes with Maven Plugin. If you are using Eclipse doesn’t have this built in feature then try to install a Maven Plugin. I recommend M2Eclipse Plugin.

Step 2: Convert Java/J2ee Project to Maven Project

Right click on Java Eclipse and select Configure -> Convert to Maven Project.

convert_to_Maven_Project_Eclipse

A popup up that will show build parameters that will be published in pom.xml will be shown.

convert_to_Maven_Project_Eclipse_1

Step 3: Add dependencies to pom.xml

Open pom.xml and Click on Dependencies tab.

Lets try to add log4j.jar as a dependency in pom.xml.

convert_to_Maven_Project_Eclipse_3

convert_to_Maven_Project_Eclipse_4

Step 4: Run Maven Build

Run Maven build by right clicking on pom.xml and selecting Run As -> Maven install.

convert_to_Maven_Project_Eclipse_5

Step 5: Verify Build

You will see that folder is created with naming convention <artifactId>-<version> in build folder. Also you will see that all dependencies are saved to build/<artifactId>-<version>/WEB-INF/lib folder. Also you will see all dependecies are placed in build path under Maven Dependencies.

convert_to_Maven_Project_Eclipse_6

 

convert_to_Maven_Project_Eclipse_7

Multiple dependencies can be added in similar fashion.