Mike
Mike

Reputation: 932

JAX-RS EJB container

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?

Upvotes: 0

Views: 69

Answers (1)

Paul Samsotha
Paul Samsotha

Reputation: 208944

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?

Upvotes: 1

Related Questions