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

Why custom annotations instead of JAX-RS (JSR-311) ones? #573

Closed
simon-heinen opened this issue Jul 22, 2014 · 4 comments
Closed

Why custom annotations instead of JAX-RS (JSR-311) ones? #573

simon-heinen opened this issue Jul 22, 2014 · 4 comments

Comments

@simon-heinen
Copy link

What was the design decision not to use the JAX-RS (JSR-311) annotations and instead create custom ones?

I would like to share the REST interfaces between my backend and Android frontend to not write them twice but this isn't possible due to the custom annotations or am I wrong?

@JakeWharton
Copy link
Collaborator

Because JAX-RS annotations are specific to configuring a server, not a client. There's all kinds of annotations which don't make sense in the context of a client (@Consumes, @Produces, @Producer, @DefaultValue, @Context, etc.), the regex-based path matching was something we didn't not want to support, none of the annotations deal with serialization, and we didn't want the ability to define @Path parts on types.

I spent a few days researching this over a year ago back before we had our v1.0 and found all of the aforementioned problems. Ultimately the annotations were designed with only the concerns of a server, not a client, in mind.

@tbroyer
Copy link

tbroyer commented Aug 20, 2014

Note that JAX-RS 2.0 repurposed the annotations for use on client side, quite successfully. That doesn't make them a good fit for Retrofit anyway though.

@ghost
Copy link

ghost commented Nov 13, 2015

@simon-heinen did you found a way to reuse the interfaces?

@simon-heinen
Copy link
Author

No but there are some possible ways: What you can do is create a version of retrofit where you modify the parser that it accepts both retrofit annotations and jax rs annotations which might be the best way or you add the retrofit annotations to your jax rs interfaces on the server side (which I wouldn't recommend;)

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

No branches or pull requests

3 participants