REST Framework for xPages

A couple of weeks ago I wanted to pickup xPages again during my free time. So I created a little app and all worked well. But then for some reason I wanted to add Rest controls again ( as I did a couple of months ago ). This time I wanted to start of easy. First re-explore the workings again and eventually add a java backend to it.

This.. got a little out of hand ;). Instead of creating 1 simple API bean that handles a single type of entrypoint I decided to create a complete framework so that 1 rest control could be used to handle multiple endpoints. I’ve just added the project to github. The framework could do the following

  1. Finds out by itself (using config docs ) depending on the url it was triggered on what class ( ‘servlet’) to load
  2. Load the datastore for it ( IDataService ).
  3. Parses the input.
  4. Depending on the method type ( GET, PUT, POST, DELETE ) validates the input and executes the correct methods
  5. Sets the correct response code and returns data if needed ( with delete/put no data is returned

The great thing about this framework is that also contains simple validation. The framework should not be used in production at the moment but should be used as a bunch of code that shows how you COULD implement a REST API. It’s far from complete ( contains bugs… )

I will blog about the framework in the coming days to explain how it works and how you can modify it to adapt it to your own needs.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.