1. Domino REST
  2. Rest clients
  3. Path parameters

Path parameters

Sending path parameters with Domino-rest is as easy annotating the method argument with @PathParam and this will automatically replace a path expression with the value of the argument when we make the call. for example having the following service :

			@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);
}

		

Then making a request call like this :

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

		

Then the request will be made to the following endpoint with the provided path param:

http://localhost:8080/service/library/movies/hulk

The expression {name} or :name will be replaced with the movieName argument value.

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

Donate & Support Us