Search in sources :

Example 1 with RequestContextProvider

use of org.glassfish.jersey.servlet.internal.spi.RequestContextProvider in project jersey by jersey.

the class RequestResponseWrapperProvider method getRequestScopedInitializerProvider.

@Override
public RequestScopedInitializerProvider getRequestScopedInitializerProvider() {
    return new RequestScopedInitializerProvider() {

        @Override
        public RequestScopedInitializer get(final RequestContextProvider context) {
            return new RequestScopedInitializer() {

                @Override
                public void initialize(InjectionManager injectionManager) {
                    ServiceLocator locator = ((HK2InjectionManager) injectionManager).getServiceLocator();
                    locator.<Ref<HttpServletRequest>>getService(REQUEST_TYPE).set(finalWrap(context.getHttpServletRequest()));
                    locator.<Ref<HttpServletResponse>>getService(RESPONSE_TYPE).set(finalWrap(context.getHttpServletResponse()));
                }
            };
        }
    };
}
Also used : RequestScopedInitializer(org.glassfish.jersey.server.spi.RequestScopedInitializer) ServiceLocator(org.glassfish.hk2.api.ServiceLocator) HttpServletRequest(javax.servlet.http.HttpServletRequest) RequestScopedInitializerProvider(org.glassfish.jersey.servlet.internal.spi.RequestScopedInitializerProvider) HttpServletResponse(javax.servlet.http.HttpServletResponse) HK2InjectionManager(org.glassfish.jersey.hk2.HK2InjectionManager) RequestContextProvider(org.glassfish.jersey.servlet.internal.spi.RequestContextProvider) InjectionManager(org.glassfish.jersey.internal.inject.InjectionManager) HK2InjectionManager(org.glassfish.jersey.hk2.HK2InjectionManager)

Aggregations

HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 ServiceLocator (org.glassfish.hk2.api.ServiceLocator)1 HK2InjectionManager (org.glassfish.jersey.hk2.HK2InjectionManager)1 InjectionManager (org.glassfish.jersey.internal.inject.InjectionManager)1 RequestScopedInitializer (org.glassfish.jersey.server.spi.RequestScopedInitializer)1 RequestContextProvider (org.glassfish.jersey.servlet.internal.spi.RequestContextProvider)1 RequestScopedInitializerProvider (org.glassfish.jersey.servlet.internal.spi.RequestScopedInitializerProvider)1