Este contenido no está disponible en el idioma seleccionado.
Chapter 25. Configuring Individual JAX-RS Resource Beans
When you scan your path for JAX-RS annotated resource beans, your beans are registered in per-request mode. This means that an instance will be created for every HTTP request served. You will usually require information from your environment. If you run a
WAR
in a Servlet container with Beta 2 or lower, you can only use JNDI lookups to obtain references to Java EE resources and configuration information. In this case, define your EE configuration (that is, ejb-ref
, env-entry
, persistence-context-ref
, etc.) in the web.xml
of your RESTEasy WAR
file. Then, within your code, perform JNDI lookups in the java:comp
namespace. For example:
web.xml
Resource Code:
You can also configure and register your beans manually through the Registry. In a
WAR
-based deployment, you must write a specific ServletContextListener
to do this. The listener lets you obtain a reference to the Registry, like so:
We recommend investigating Spring Integration and the Embedded Container's Spring Integration for a full understanding of this process.