Domino-rest works in both the browser and in a pure JVM, and the same generated rest-client can be used on both sides, so there is no need to generate different clients for the browser and JVM, this also includes Android applications - for android applications please check out domino-rest-android.
Now assuming we have GWT or J2CL web application that is split into three modules, frontend, backend and a shared module to share code between the other tow, then you can use domino-rest in three different modes, switching between the different modes is a matter of what/where dependencies are defined and where the service definition interface is located :
In this mode the generated rest clients will only be available for the frontend module, and they are not shared with the backend module.
To define the interface and use the generated rest-client from frontend code only define the following dependencies in the frontend module, then define the interface inside the frontend module :
<dependency>
<groupId>org.dominokit</groupId>
<artifactId>domino-rest-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.dominokit</groupId>
<artifactId>domino-rest-processor</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
In this mode the generated rest clients will only be available for the backend module, and they are not shared with the frontend module.
To define the interface and use the generated rest-client from backend code only define the following dependencies in the backend module, then define the interface inside the backend module :
<inherits name="org.dominokit.rest.Rest"/>
In this mode the same generated rest clients will be shared and usable from both modules, the frontend and the backend.
To define the interface and use the generated rest-client from both frontend and backend modules define the dependencies as the following then define the interface inside the shared module :
DominoRestConfig.initDefaults();
@JSONMapper
public class Movie {
@PathParam("name")
private String name;
private int rating;
private String bio;
private String releaseDate;
// setters and getters
}
@RequestFactory
public interface MoviesService {
@Path("library/movies/:movieName")
@GET
Movie getMovieByName(@PathParam("movieName") String movieName);
@Path("library/movies")
@GET
List<Movie> listMovies();
@Path("library/movies/:name")
@PUT
void updateMovie(@BeanParam @RequestBody Movie movie);
}
With this setup as the both the frontend and the backend modules depends on the shared module the generated REST clients in the shred module will be available and usable from both sides.