jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Feature on server side

From: Bill Burke <bburke_at_redhat.com>
Date: Mon, 20 Aug 2012 12:22:13 -0400

Feature on the server side is a cool idea and glad it is in the spec.

One thing I'd love to be able to do is to have built-in features that
are scanned, registered and then only triggered by config properites.
For one, would it be cool to back the Configurable's properties with the
Servlet Context?
web.xml

<context-param>
   <name>resteasy.server.cache.enabled</name>
   <value>true</value>
</context-param>

<context-param>
   <name>resteasy.server.cache.max.size</name>
   <value>300</value>
</context-param>


So, if Configurable's properties are backed by the ServletContex, my
cache Feature class can check to see if the context param is set before
it enables the specific feature. Also, the cache Feature has an easy
way of obtaining configuration data. Following me?

Another thing that would be cool is to allow Configurable to be @Context
injectable into an Application class? Then the Application class could
be used to initialize things for Features that can't be done in
text-based configuration. i.e.

public class SecureApplication {

   public CacheApplication(@Context Configurable config) {
       KeyStore keyStore = ...;
       config.setProperty("signature.key.store", keyStore);
   }
}



Bill

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com