Hi,

We use Jetty 2.5.1 in our service.
Our application create some information(ex request id, flag, etc) at a
pre-matching filter.
This information is read  by a filter, resource, interceptor, exception
mapper and entity reader/writer.

So, I set this info to ContainerRequestContext that I think it is suitable
for.

First, I wrote @Context annotation at field variable of a interceptor.
But error writing below happened.

  |1. java.lang.IllegalStateException: Not inside a request scope.

So, I use @Context to inject ResourceContext and get
ContainerRequestContext from it.
In version 2.3,1, this implement is work well, but in 2.5.1 is not.
Too frequently Full GC is happened(is it bug??).

Our understanding is the request scope is begin at first filter and end
with last filter.
WriterInterceptor,RederInterceptor,MessageBodyReader, ExceptionMapper and
MessageBodyWriter is in a request scope.

I think below code should be work well, without throwing exception by
jersey.
(But now, occur exception. Other class in mail title is as well.)

 @Provider
 public class Interceptor implements WriterInterceptor {

    @Context
    ContainerRequestContext requestContext;

    @Override
    public void aroundWriteTo(WriterInterceptorContext context) throws
IOException, WebApplicationException {

    }
 }

If this code is bad.. that is,  not match JAX-RS spec or jersey design
policy,
I hope that someone would give me other idea.

Thanks.

//Michitaka
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to