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

Header parameters

With Domino-rest we can set request headers by annotating the method arguments with @HeaderParam and this will automatically set a header in the request 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

And if we check the request we also see that it has the header token: some token

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

Donate & Support Us