-
Notifications
You must be signed in to change notification settings - Fork 105
Support specifying resources per application #26
Comments
Hi, After a short look into the code, I came up with the idea to add some kind of a filter annotation to the spring beans and then using that filter in ResteasyEmbedededServletInitializer#createApplicationServlet to only pass the matching beans to the given Application class. I'm not sure if this will work, but if you are interested I would give it a try and submit a pull request if it works. |
Hello Christian, Thanks for offering to contribute to this project. I have to say also that I have actually already started working on this issue a long time ago, but I didn't finished it, I got side tracked. Anyways, thanks for offering to contribute. |
Hi, |
Cool, thanks! |
Hi Fabio, ConstructorArgumentValues values = new ConstructorArgumentValues();
values.addIndexedArgumentValue(0, applicationClass.getName());
values.addIndexedArgumentValue(1, path);
values.addIndexedArgumentValue(2, Collections.emptySet());
values.addIndexedArgumentValue(3, Collections.emptySet());
applicationServletBean.setConstructorArgumentValues(values); I started some digging into the code and as far as I currently understand, it's the SpringBeanProcessor from resteasy itself where the "magic" happens. You mentioned you started with this issue yourself some time ago. Do you remember your approach or do you have some code left? From my point of view the code from resteasy itself is not that easy to read :), and I'm not sure if I am on the right track. |
Hello Christian, Yes, unfortunately all of this is not straightforward. I believe the unfinished solution I had was on the right track though, but it's been a while. The only problem though is that right now I am working with two other issues in parallel, so I am little busy. But, hopefully sometime this week I will have some time to push my unfinished changes to that branch, so we can go from there. I still have it in my laptop, I just need to merge it properly, since its base code is old. Does that sound like a good plan? Have a good week. |
Hi, |
Hello, I believe I finished implementing this feature (at least to make it functional). Here is the commit (not in the main development branch yet). There are some pending tasks to complete it entirely, I documented them the commit. Here they are:
There is one more that is important: fully understand the usage for Christian, I plan to keep working on this issue and conclude it. But feel free to take a look at it if you want. Fábio. |
Hi Fabio, |
Cool. If you work on it, please continue out of this issue_26 branch and my latest changes on it. |
Hi Fabio, based on your latest changes on issue_26 branch I created a small test case to show you the problem I also faced with my implementation.
If I understand the spec you quoted above correctly the EchoV2 Endpoint must not be reachable for the given JaxRS-Application because it is not defined in getClasses. But unfortunately it is. I attached a small patch file with my changes. I haven't yet fully understand why this is the case. But I think the SpringBeanProcessor from resteasy is the right place to start looking. I will keep you informed if I find something. _26__current_implementation_does_not_fulfill_the_JAX_RS_spec.zip |
Thanks Christian, Yes, everything you said makes sense to me, that is how I understand it too. Thanks! |
Support specifying JAX-RS resources per JAX-RS application, based on section 2.3.2 in the JAX-RS 2.0 specification.
"If either
getClasses
orgetSingletons
returns a non-empty collection then only those classes or singletons returned MUST be included in the published JAX-RS application"That must be respected even in the case of multiple JAX-RS applications.
Important note: this only applies to resources (not providers). Specific providers registration per resource can be achieved by using JAX-RS DynamicFeature.
The text was updated successfully, but these errors were encountered: