Skip to: Site menu | Main content


Java REST Annotations

Home Print

Java REST Annotations

The Java REST annotations are annotations to help service creators build REST style services. Frameworks which wish to support REST can reuse these annotations just like the JSR181 & JAX-WS annotations are used across implementations. However, the idea with JRA is that many different frameworks (web, XML/SOAP, etc) may want to expose REST style services.

It is recognized that REST is an architecture not an implementation, and these annotations are geared around HTTP. So technically they should be called the Java HTTP Annotations, but then no one would no what we're talking about, leading us to chose the less correct name instead.

Projects Using JRA

The Annotations


The HttpResource annotation is used to map a bean or method to a resource. For instance:

Or on a bean:


The verb annotations map a method to a specific verb. Continuing on the above examples:

Or on a bean:

Mapping URI parameters

Parameters from the URI can be mapped through URI templating:

Since java does not store the names of method parameters, frameworks will need to use some external means to map parameters to their names. Examples of this would be the attribute from JAX-WS or Paranamer.