Coding in REST JERSEY Basics

1. ) In the class declaration, the @PATH annotation is declared.
this path will be the corresponding to this class will process.
example:

@PATH (“/login”)
public class Login(){

2. ) the methods will have the annotation if what is its type,
what it produces, or what it consumes. Also the sub path is included.

example method annotation types are:
@GET, @PUT, @DELETE

example of @Produces are:
application/json, application/xml, text/plain, text/html

here a sample code:

@GET @Path(“/user”)
@Produces(“application/json”)
public Login getUser() { … }

See 3.3 Sub-resources section of this link below:

https://jersey.java.net/nonav/documentation/latest/user-guide.html#d0e1746

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s