-
Bug
-
Resolution: Done
-
Major
-
3.0.14.Final
-
None
I have a filter that depends on ResourceInfo from the context.
@Provider public static class Filter implements ContainerRequestFilter, ContainerResponseFilter { @Context private ResourceInfo resourceInfo @Override void filter(ContainerRequestContext requestContext) throws IOException { Method method = resourceInfo.resourceMethod println("Got method ${method.name} on request") } @Override void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { Method method = resourceInfo.resourceMethod //<-- fails here when using ReadListener println("Got method ${method.name} on response") } }
The filter works in most cases. However, when using a ReadListener with AsyncResponse as such:
@POST @Path("/asyncresponse/readlistener") public void asyncresponse_ReadListener(@Suspended AsyncResponse async) { ServletInputStream inputStream = request.getInputStream() ByteArrayOutputStream outputStream = new ByteArrayOutputStream() inputStream.readListener = new ReadListener() { @Override public void onDataAvailable() throws IOException { IOUtils.copy(inputStream, outputStream) } @Override public void onAllDataRead() throws IOException { inputStream.close() outputStream.flush() outputStream.close() async.resume(outputStream.toString('UTF-8')) } @Override public void onError(Throwable t) { async.resume(t) } } } }
I get the following exception on the outbound path:
ERROR: RESTEASY002005: Failed executing POST /test/asyncresponse/readlistener org.jboss.resteasy.spi.LoggableFailure: RESTEASY003880: Unable to find contextual data of type: javax.ws.rs.container.ResourceInfo at org.jboss.resteasy.core.ContextParameterInjector$GenericDelegatingProxy.invoke(ContextParameterInjector.java:55) at com.sun.proxy.$Proxy32.getResourceMethod(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at org.codehaus.groovy.runtime.metaclass.MethodMetaProperty$GetBeanMethodMetaProperty.getProperty(MethodMetaProperty.java:76) at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:64) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296) at bug.RestEasyTest$Filter.filter(RestEasyTest.groovy:53)
- is cloned by
-
JBEAP-4701 Unable to find contextual data of type: javax.ws.rs.container.ResourceInfo when using ReadListener
- Closed
- is related to
-
RESTEASY-1225 Jackson serialization after async response results in "Unable to find contextual data of type: javax.ws.rs.ext.Providers"
- Resolved