[resteasy-dev] SPI to add JAX-RS annotations dynamically

Alessio Soldano asoldano at redhat.com
Thu Sep 21 08:39:53 EDT 2017


Hi Christian,
I could not find something like what you mentioned, in RESTEasy. AFAICS,
the registry is meant for adding (registering) / removing resource
factories and getting resource invokers. Btw, I suspect it won't be safe to
alter a ResourceMethod metadata once it's been added to the registry. If
that's really the case, you should probably kick in before a resource
(factory) is actually added.
Have you looked at the resteasy-cdi integration btw? I'm wondering if your
scenario could be covered by extending the resteasy-cdi integration,
considering you said that MVC controllers are CDI-based JAX-RS resources.
Cheers
Alessio

On Wed, Sep 20, 2017 at 6:28 AM, Christian Kaltepoth <christian at kaltepoth.de
> wrote:

> Hi Alessio,
>
> thanks a lot for your reply. Yes, I saw the ResourceBuilder class and it
> looks quite interesting. But is there some kind of SPI which allows me to
> alter the resource model that RESTEasy creates for the discovered
> resources? Something like:
>
>     public interface ResourceModelPostProcessorPlugin {
>         void process( ResourceClassBuilder builder );
>     }
>
> Best regards
>
> Christian Kaltepoth
>
>
> 2017-09-19 0:30 GMT+02:00 Alessio Soldano <asoldano at redhat.com>:
>
>> Hi Christian,
>> sorry for the late reply, been on PTO for a couple of weeks.
>> Have you checked https://github.com/resteasy/Re
>> steasy/blob/master/testsuite/unit-tests/src/test/java/org/
>> jboss/resteasy/test/resource/ProgammaticTest.java#L59 ? (produces(..)
>> method). Is that what you're looking for?
>> Cheers
>> Alessio
>>
>> On Fri, Sep 8, 2017 at 5:47 PM, Christian Kaltepoth <
>> christian at kaltepoth.de> wrote:
>>
>>> Hi,
>>>
>>> My name is Christian Kaltepoth and I'm specification lead of JSR 371
>>> (MVC 1.0). As you may know, JSR 371 is about creating an action-based web
>>> framework on top of JAX-RS.
>>>
>>> The reference implementation of JSR 371 was previously only targeted to
>>> support Jersey. But we want to change that. Therefore, we are currently
>>> looking for ways to integrate with other JAX-RS implementations.
>>> Unfortunately there are certain features which cannot be implemented using
>>> the plain JAX-RS API. That's why we are also looking into using JAX-RS
>>> implementation specific SPIs.
>>>
>>> One thing we are currently working on is the following requirement: MVC
>>> controllers (which are just special CDI-based JAX-RS resources) should be
>>> treated as if they are annotated with @Produces("text/html) without the
>>> need to add the annotation manually. The current draft of the specification
>>> states:
>>>
>>> *The semantics of controller methods differ slightly from JAX-RS
>>>> resource methods; [...] Moreover, the default media type for a response is
>>>> assumed to be text/html , but otherwise can be declared using @Produces
>>>> just like in JAX-RS.*
>>>
>>>
>>> Jersey provides a special SPI which allows us to hook into the metadata
>>> for JAX-RS resources:
>>>
>>> https://github.com/jersey/jersey/blob/master/core-server/src
>>> /main/java/org/glassfish/jersey/server/model/ModelProcessor.java#L75
>>>
>>> Is there anything like that in RESTEasy? I looked into the code but
>>> unfortunately didn't find anything like that.
>>>
>>>
>>> Christian
>>>
>>>
>>> --
>>> Christian Kaltepoth
>>> Blog: http://blog.kaltepoth.de/
>>> Twitter: http://twitter.com/chkal
>>> GitHub: https://github.com/chkal
>>>
>>>
>>> _______________________________________________
>>> resteasy-dev mailing list
>>> resteasy-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/resteasy-dev
>>>
>>>
>>
>
>
> --
> Christian Kaltepoth
> Blog: http://blog.kaltepoth.de/
> Twitter: http://twitter.com/chkal
> GitHub: https://github.com/chkal
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/resteasy-dev/attachments/20170921/3b3ed80f/attachment.html 


More information about the resteasy-dev mailing list