users@jersey.java.net

Re: [Jersey] Configure wadl generation

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 30 Jul 2008 16:32:51 +0200

Hi Martin,

Perhaps it would be easier to declare one Java class that has the
configuration information declared in it, rather than a textual syntax.

That way it should be easier to configure via programming and only a
minimal amount of stuff needs to be declared somewhere else e.g. in the
web.xml or in the ResourceConfig.

One could use the builder pattern to make it easy to configure. For example:

   generator(<class>).prop(<name>, <value>).prop(<name>, <value>).add()

in the constructor of the configuration class.

Paul.

Martin Grotzke wrote:
> On Mon, 2008-07-28 at 10:58 +0200, Paul Sandoz wrote:
>> Hi Martin,
>>
>> Can this property be declared as property using ResourceConfig?
>>
>> The WADL code can get the ResourceConfig instance and get the
>> "com.sun.jersey.config.property.wadlGeneratorConfigClass" from that.
>>
>> Such properties will also work when declared as Servlet init-params.
> Ok.
>
> What is the best way if I want to provide a WadlGeneratorConfiguration
> that can be configured via a special servlet init-param?
>
> My WadlGeneratorConfiguration primarily must return a list of
> WadlGeneratorDescriptions. A WadlGeneratorDescription provides the
> class(name) of an implementation of WadlGenerator plus a Properties
> instance that is used to init the WadlGenerator.
>
> Therefore I thought about s.th. like a servlet init-param
> "com.sun.jersey.config.property.wadlGeneratorDescriptions" with a
> possible value like
>
> com.sun.jersey.impl.wadl.generators.WadlGeneratorApplicationDoc[applicationDocsFile=classpath:/src/main/api-doc/application-doc.xml];
> com.sun.jersey.impl.wadl.generators.WadlGeneratorGrammarsSupport[grammarsFile=classpath:/src/main/api-doc/application-grammars.xml];
> ...
>
> This would be interpreted by e.g. a
> ConfigurableWadlGeneratorConfiguration.
>
> What do you think?
>
> Thanx && cheers,
> Martin
>
>
>> Paul.
>>
>> Martin Grotzke wrote:
>>> Hi Paul,
>>>
>>> I want to add some WadlGenerationConfiguration to jersey, so that one
>>> can configure the wadl-generation stuff like the maven-wadl-plugin.
>>> There should be some property like
>>>
>>> com.sun.jersey.config.property.wadlGeneratorConfigClass
>>>
>>> that allows the user to specify some class, that provides the required
>>> configuration properties.
>>>
>>> I would have a look at how PackagesResourceConfig is used. Do you have
>>> another thing that provides a good start for this?
>>>
>>> Cheers,
>>> Martin
>>>
>>>
>

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109