Open issues

ParamConverters don't work

Description

I was trying use a custom ParamConverter but that doesn't work, I think this has to do the initialization order in the OsgiServletContainerDispatcher

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 for (ApplicationResource resource : applicationService.getResources()) { Object singletonResource = resource.getService(); dispatcher.getRegistry().addSingletonResource(singletonResource); } for (ApplicationExtension extensionService : applicationService.getExtensions()) { Map<Class<?>, Integer> contracts = new HashMap<>(); for (Class contractClass : extensionService.getContracts()) { contracts.put(contractClass, null); } Object providerInstance = extensionService.getService(); providerFactory.registerProviderInstance(providerInstance, contracts, null, false); } processApplication(application);

There resources are added before the extensions (and application) this makes that if a resource depends on a custom provider (the ParamConverterProvider) this has not yet been registered and that results in the exception below:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 java.lang.RuntimeException: RESTEASY003875: Unable to find a constructor that takes a String param or a valueOf() or fromString() method for javax.ws.rs.QueryParam("since") on public javax.ws.rs.core.Response io.summar.lrs.xapi.rest.StatementResource.get(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean,boolean,java.time.Instant,java.time.Instant,int,boolean) for basetype: java.time.Instant at org.jboss.resteasy.core.StringParameterInjector.initialize(StringParameterInjector.java:245) at org.jboss.resteasy.core.StringParameterInjector.<init>(StringParameterInjector.java:83) at org.jboss.resteasy.core.QueryParamInjector.<init>(QueryParamInjector.java:31) at org.jboss.resteasy.core.InjectorFactoryImpl.createParameterExtractor(InjectorFactoryImpl.java:83) at org.jboss.resteasy.core.MethodInjectorImpl.<init>(MethodInjectorImpl.java:44) at org.amdatu.web.rest.resteasy.AmdatuInjectorFactory$AmdatuMethodInjector.<init>(AmdatuInjectorFactory.java:53) at org.amdatu.web.rest.resteasy.AmdatuInjectorFactory.createMethodInjector(AmdatuInjectorFactory.java:146) at org.jboss.resteasy.core.ResourceMethodInvoker.<init>(ResourceMethodInvoker.java:98) at org.jboss.resteasy.core.ResourceMethodRegistry.processMethod(ResourceMethodRegistry.java:303) at org.jboss.resteasy.core.ResourceMethodRegistry.register(ResourceMethodRegistry.java:274) at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:225) at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:197) at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:183) at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:160) at org.jboss.resteasy.core.ResourceMethodRegistry.addSingletonResource(ResourceMethodRegistry.java:100) at org.amdatu.web.rest.resteasy.OsgiServletContainerDispatcher.init(OsgiServletContainerDispatcher.java:75)

Status

Assignee

Unassigned

Reporter

Bram Pouwelse

Labels

None

Priority

Major
Configure