-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Incompatible with agrest #19
Comments
Hi Tim I was looking for litle code challenge for my vacation so I may be able to help you with this :) posible workaroundFor a quick workaround, and following some of the points Ben's was making in the thread in the tapestry's list, I'd try to wrap the support for @featureAs Ben correctly pointed out in the thread:
For registering But, again as Ben correctly pointed out, Resteasy is registering it internally as a |
Thanks for looking into this. Here is my proof of concept project |
As I wrote on the mailing list, the line
I tried to work on this on our fork, but didn't found the time to actually test it... It shouldn't be the task of tapestry-resteasy to decide what's a provider and what's not. The extra-handling for resources is fine, but the rest of the contributions could be assumed to be provider-compatible. I'm pretty sure that RestEasy itself is checking for eligibility. Our private void processApplication(Application config) {
log.info("Deploying {}: {}", Application.class.getName(), config.getClass());
List<Runnable> registerResources = new ArrayList<>();
List<Runnable> registerProviders = new ArrayList<>();
if (config.getClasses() != null) {
for (Class<?> clazz : config.getClasses()) {
if (GetRestful.isRootResource(clazz)) {
registerResources.add(() -> this.dispatcher.getRegistry().addPerRequestResource(clazz));
}
else {
registerProviders.add(() -> this.providerFactory.registerProvider(clazz));
}
}
}
if (config.getSingletons() != null) {
for (Object obj : config.getSingletons()) {
if (GetRestful.isRootResource(obj.getClass())) {
registerResources.add(() -> this.dispatcher.getRegistry().addSingletonResource(obj));
}
else {
registerProviders.add(() -> this.providerFactory.registerProviderInstance(obj));
}
}
}
registerProviders.forEach(Runnable::run);
registerResources.forEach(Runnable::run);
} We register everything that's contributed as a provider, except resources. |
Trying to use agrest with tapestry-resteasy produces an error in org.tynamo.resteasy.ResteasyRequestFilter
Application.getSingletons() returned unknown class type: io.agrest.runtime.AgRuntime
ResteasyRequestFilter doesn't support all the available types RESTEasy has to offer, so it throws the exception.
Only Resources and Providers are supported, but AgRuntime is a "Feature" type.
Example code using a simple data model from https://github.com/agrestio/agrest-bookstore-example . I can provide full source code if that helps.
http://localhost:8080/tapestry-agrest/rest/category
java.lang.RuntimeException: Exception constructing service 'ResteasyRequestFilter': Error invoking constructor public
org.tynamo.resteasy.ResteasyRequestFilter(java.lang.String,org.slf4j.Logger,org.apache.tapestry5.http.services.ApplicationGlobals,javax.ws.rs.core.Application,org.apache.tapestry5.ioc.services.SymbolSource,boolean,org.apache.tapestry5.ioc.services.UpdateListenerHub,long,long,boolean) throws javax.servlet.ServletException: Application.getSingletons() returned unknown class type: io.agrest.runtime.AgRuntime
The text was updated successfully, but these errors were encountered: