Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@RegisterProvider on a sub-resource #290

Open
mkonzal opened this issue Oct 17, 2020 · 1 comment
Open

@RegisterProvider on a sub-resource #290

mkonzal opened this issue Oct 17, 2020 · 1 comment
Labels
Milestone

Comments

@mkonzal
Copy link

mkonzal commented Oct 17, 2020

I would like to register different Providers on different sub-resources, which take a precedence (have higher priority) over registration on the upper level in case of conflict.

There is no concrete information about it in the MP specification, just general information

In addition to defining providers via the client definition, interfaces may use the @RegisterProvider annotation to define classes to be registered as providers in addition to providers registered via the RestClientBuilder.

Resource proxy

@Path("/foo")
@RegisterProvider(XYZWriter.class)
@RegisterProvider(XYZReader.class)
public interface Foo {
    @POST
    @Consumes("xyz")
    @Produces("xyz")
    FooResponse get(FooContent content);

    @Path("/bar")
    Bar getBar();
}

Sub resource proxy

@RegisterProvider(ABCReader.class)
public interface Bar {
    @POST
    @Produces("abc")
    BarResponse get();
}

Expectation

foo.getBar().get();

will use ABCReader as MessageBodyReader.

Currently on most MP rest client implementations only registrations on the resource proxy are done.

@mkonzal mkonzal changed the title Should @RegisterProvider work on a sub-resource? @RegisterProvider on a sub-resource Oct 19, 2020
@andymc12
Copy link
Contributor

Sorry for the long delayed response. This definitely sounds like a nice feature to add to a future release of the spec. Thanks for opening this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants