1. Domino REST
  2. Rest clients
  3. Generic Request/Response

Generic Request/Response

Beyond generated clients, Domino REST lets you build and send ad-hoc requests without declaring an interface. And when you do not need a strongly typed response, you can receive a raw jakarta.ws.rs.core.Response instead.

Generic Request

Use RestRequestBuilder to assemble a request step by step, setting the required parts until you call build(). The result behaves like a generated request class, and you can still tweak it before sending.

Example

			@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
    @SuccessCodes({200})
    void updateMovie(@beanParam @RequestBody Movie movie);
}

		

Generic Response

When all you need is the status or the shape of the response varies, return jakarta.ws.rs.core.Response. Domino REST will skip object mapping and hand you the raw response in onSuccess, so you can inspect headers, status, or payload as needed.

Example

			MoviesServiceFactory.INSTANCE
    .getMovieByName("hulk")
    .onSuccess(movie ->{})
    .send();

		

Then using the generated request factory:

			@Path("second-root-path")
public interface SecondService {
    @Path("second-path")
    SomeResponse secondRequest();
}

		

The response metadata you can inspect includes the resource interface, HTTP method, request class, response class, Consumes/Produces headers, and all parameters: header, query, path, matrix, fragment, and meta.

We are a group of passionate people who love what we do

Donate & Support Us