0

I've been doing this JAX-RS project and I have a question about queries. Let's say I want to add Users to my WEB application. I would create an entity from my database, then get information with DAO class and create controller for user. It should look something like this:

@Path("user")
public class UserController {

@GET
@Produces(MediaType.TEXT_PLAIN)
public String getIt() {
    return "GOT IT";
}
}

So, my question is when I start the server on localhost, how do I listen on .../user on my machine?

  • What do you mean by "listen"? The one component that does the listening is the actual server, on the specified port. The container forwards the request to the JAX-RS application, which forwards the request to the matching URI (among other matching parameters). Is there something not working for you that caused you to ask this question? – Paul Samsotha Jul 21 '15 at 03:49
  • I guess he is asking how to register the JAX-RS bean. – dngfng Jul 23 '15 at 08:25
  • possible duplicate of [How to set up JAX-RS Application using annotations only (no web.xml)?](http://stackoverflow.com/questions/9373081/how-to-set-up-jax-rs-application-using-annotations-only-no-web-xml) – dngfng Jul 23 '15 at 08:31

0 Answers0