-2

Im using Jax-rs and Im trying to find a way to access the last parameter of a url.

For example: http://localhost:8080/myproject/api/movie?userid=test

I want to get the value test out of my request.

nanobot
  • 108
  • 5
  • 18
  • 1
    Given that you showed no actual code, I will direct you to [this good MKyong tutorial](https://www.mkyong.com/webservices/jax-rs/jax-rs-queryparam-example/), which shows how to access query parameters in Jax-RS. – Tim Biegeleisen Jan 14 '19 at 06:31
  • thanks this helped me alot! `System.out.println(requestContext.getUriInfo().getQueryParameters().getFirst("userid"));` this did the job for me – nanobot Jan 14 '19 at 06:52

1 Answers1

0

You need to use @QueryParam For your URL

 http://localhost:8080/myproject/api/movie?userid=test

@QueryParam("userid") int userid;

Now you can use the value

System.out.println(userid);
ellipsis
  • 12,049
  • 2
  • 17
  • 33