0

I have an .jar application (using ejbs) deployed as part of an .ear archive. Inside this .jar application I have classes annotated with @Path and @Stateless.

My question is: Are my JAX-RS resources going to be deployed inside an EJB container or inside WEB (Servlet) container? Do I need to define web.xml and to put servlet definition inside of it?

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
Mike
  • 812
  • 9
  • 25

1 Answers1

1

Are my JAX-RS resources going to be deployed inside an EJB container or inside WEB (Servlet) container?

It will be deployed to the servlet container of your EE server.

Do I need to define web.xml and to put servlet definition inside of it?

Not necessarily. You can configure a JAX-RS application simply by having an empty Application subclass annotated with @ApplicationPath1.

@ApplicationPath("/api")
public class RestApplication extends Application {}

If you want to use a web.xml, you can instead of this class. If you do want to, just look for a tutorial to show you how to do it. But this class is all that is needed for the most basic configuration.


Footnotes

  1. See How to use Jersey as JAX-RS implementation without web.xml?
Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720