Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Latest commit

 

History

History
62 lines (46 loc) · 1.46 KB

README.md

File metadata and controls

62 lines (46 loc) · 1.46 KB

Vraptor Hypermedia relations enhanced!

How to install?

Just add this entry to your pom.xml:

  <dependency>
      <groupId>com.github.filipesperandio.vraptor</groupId>
      <artifactId>vraptor-hypermedia</artifactId>
      <version>3.4.0</version>
  </dependency>

... or download the jar and add it manually to your project:

http://bit.ly/vraptor-hypermedia-enhancement

Update web.xml accordingly:

  <context-param>
    <param-name>br.com.caelum.vraptor.provider</param-name>
    <param-value>com.github.filipesperandio.vraptor.hypermedia.HypermediaProvider</param-value>
  </context-param>

What it does?

It changes the relations model in order to help your javascript code to be more readable an easy to do.

Instead of a json like the following one using RestfulSerializationJSON...

  link : {
    rel : "delete",
    href : "http://host/resource/id"
  }

... you get a JSON like this:

  link : {
    "delete" : {
      method : "DELETE",
      url : "/resource/id"
    }
  }

This model is pretty much complient to all common ajax javascript APIs available. Good examples are Angular and jQuery. Ex.:

  $.ajax(jsmodel.link.delete);

More of it:

You can use it in conjuction to Vraptor Scaffold, there is a fork that extends the scaffold functionality, adds hypermedia-enchancement, angularjs and bootstrapjs, check it out: https://github.com/filipesperandio/vraptor-scaffold