Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jaxrs-dev] Request for extension with Application interface

Hi Ron,
 

  1. One question is: How common in practice is it for a WAR to contain more than one Application? In the RESTEasy issue I mentioned, "Same JAX-RS Application instance injected across applications" (https://issues.jboss.org/browse/RESTEASY-1709), the reporter said, when asked for sample code, "I'll try to put together something simpler, for a number of reasons: not supposed to post internal code publicly, too large and complex etc.". That suggests that the question arose from a real application. I'm sure there are people on this mailing list that have some sense of the answer.

In one of my current projects I'm also using two JAX-RS applications within a single WAR. Mostly because there are two different types of resources:
  • There is an API called from another Java application with exposes data and enforces a special kind of stateless authentication
  • And there are resources for the _javascript_-based frontend which require session-based authentication.
As I need different exception mappers and filters for both kinds of resources, it was the easiest solution to use two Application subclasses and list the corresponding resources/providers via Application.getClasses().

  2. If, in fact, it is somewhat common, then some people would be unhappy if the JAX-RS spec ruled it out. I guess the only options would be

    A. Leave things as they are

    B. Formalize the whole thing


What about (C)? Making it optional by saying: "JAX-RS implementations MAY support more than one JAX-RS application within a single deployment unit" 
 

  3. If the decision is to formalize multiple Applications in a WAR, then I think it would require defining a "JAX-RS Application Scope" as per section 2.4.2 "Defining new scope types" of JSR 365 Contexts and Dependency Injection for Java 2.0.

Agreed.

Christian


--

Back to the top