Home Documentation
Download Report a Bug/Github About Contact

Create a new RDAP-renderer implementation

RedDog RDAP Server allows to generate new implementations to render the result of a user request.

To generate a new implementation it is necessary to implement the interface mx.nic.rdap.renderer.Renderer found in the project rdap-renderer-api

It is necessary to implement all the functions of the interface. Each function serves to render a server response type, and if the function does not exist, the server could throw an exception or even display a blank response to the user.

Each function receives as a parameter a result, which can be of type RequestResponse<T>, SearchResponse<T>, ExceptionResponse and HelpResponse, in addition it receives a PrintWriter.

For example, if a user needs the result of an object to be printed in HTML, the implementer is responsible for writing HTML in the PrintWriter using Java code, and in this way the result can be interpreted in HTML.

Unit testing of Renderer implementation.

To verify and validate that an implementation does not throw exceptions on the server, a project called rdap-renderer-test-api was generated.

The idea of rdap-renderer-test-api is to generate unit tests on rdap-renderer-api implementations.

rdap-renderer-test-api helps in generating responses, in a way the server would do it.

The response is generated with test values, and every time a value or an object is added the response is rendered, this also serves to see the renderer behavior against null objects and null values, and prevent the server from throwing exceptions of type NullPointerException when rendering a response.

In the following links you can see how unit tests were implemented on renderer implementations, using the rdap-renderer-test-api.