dev@jersey.java.net

Re: ResourceClass scanner <was> Re: I am here again ......

From: Frank Martínez <mnesarco_at_gmail.com>
Date: Thu, 1 Nov 2007 11:10:21 -0500

Hi Paul,

> I can sort out this bit. I don't want to remove it completely until the
> abstract resource model API and impl is ready so that we still have
> WADL generation support for the interim period. But I can remove the
> resource config APT and generation code and do some clean up.
>

Have you considered the possibility of wadl generation on startup time too?

>
> >> For servlet we can then specify features/properties of configuration in
> >> the init-params of servlet and those are passed to the ResourceConfig
> >> impl instantiated. Thus for default behaviour no init-parameters are
> >> required. Overall this is great improvement on what we currently require.
> >>
> >
> > For servlet I scan into WEB-INF/lib, and WEB-INF/classes by default. Do you
> > want to give to the users the ability to change via init params in the web.xml?
> >
>
> I am not sure. I am thinking from the perspective that a user might not
> want to scan some or all of the jars in WEB-INF/lib for performance (or
> security?) reasons.
>

Ok. Now you can override these paths by an init-param of the ServletContainer.

        <init-param>
            <param-name>com.sun.ws.rest.config.property.ResourcePaths</param-name>
            <param-value>/WEB-INF/classes</param-value>
        </init-param>

param-value is a ';' separated list of paths.

>
> See the class:
>
> com.sun.ws.rest.api.container.ContainerFactory
>
> I justed checked the available properties returned from
> System.getProperties() (ironically using the EntityProvider example in
> Jersey to print them out :-) )
>
> So we can get the value of the property "java.class.path" to get the
> list of paths.
>
> Which means we could add the following additional methods to
> ContainerFactory:
>
> // Creates a ASMResourceConfig obtaining the
> // paths from the System property "java.class.path"
> public static <A> A createContainer(Class<A> type)
>
> // Creates a ASMResourceConfig obtaining the
> // paths passed in as a parameter
> public static <A> A createContainer(Class<A> type, String... paths)
>
> Paul.
>

Done. But i am not familiarized with other containers rather than
Servlet. Please help me doing some tests.

-- 
Frank D. Martínez M.
Asimov Technologies Ltda.
Blog: http://www.ibstaff.net/fmartinez/