dev@jsr311.java.net

Registering Resource Classes (bootstrap)

From: Dhanji R. Prasanna <dhanji_at_gmail.com>
Date: Fri, 18 May 2007 15:18:20 -0700

Hi

This may not sound like an immediate concern, but a lot of discussion around
the ordering/overriding of resources and sub-resources have started so I
thought it useful to start a thread on how the runtime recognizes resource
classes and bootstraps itself.

Common wisdom suggests an xml descriptor with properties and a list of
resource classes in order. I suggest we abstract that with the optional use
of a builder:

Jaxrs.configure(props)
      .addPackage("com.wideplay.webservices")
      .addConfiguration(XmlConfigurer.class, "atomservices.xml") //via a
user-provided builder

      .addResource(Account.class) //override
      .addResource(Client.class) //extend, etc.
      .buildRuntime()
      .start();

An xml parser layer (or any other configuration mechanism) could be added
easily. Thoughts, comments?

Dhanji.