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.
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.
RestRequestBuilder.of(Void.class, SampleObject.class, "list-books-request")
.get()
.withPath("/library/books")
.accepts(MediaType.APPLICATION_JSON)
.produces(MediaType.APPLICATION_JSON)
.withResponseReader(response -> SampleObject_MapperImpl.INSTANCE.read(response.getBodyAsString()))
.build()
.onSuccess(response -> LOGGER.info(response.toString()))
.onFailed(failedResponse -> LOGGER.error("Failed to execute request", failedResponse.getThrowable()))
.onComplete(() -> LOGGER.info("Request completed"))
.send();
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.
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import org.dominokit.rest.shared.request.service.annotations.RequestFactory;
@RequestFactory
@Path("/library")
public interface GenericResponseResource {
@GET
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
Response ready();
}
Then using the generated request factory:
GenericResponseResourceFactory.INSTANCE
.ready()
.onSuccess(wrapper -> LOGGER.info(wrapper.getResponse().getStatusCode() +" : "+wrapper.getResponse().getStatusText()))
.onFailed(failedResponse -> LOGGER.error("Failed to execute request", failedResponse.getThrowable()))
.onComplete(() -> LOGGER.info("Request completed"))
.send();
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.