@SuppressWarnings("unchecked") public static void injectContextMethods(Object requestObject, AbstractResourceInfo cri, Message message) { for (Map.Entry<Class<?>, Method> entry : cri.getContextMethods().entrySet()) { Method method = entry.getValue(); if (VALUE_CONTEXTS.contains(method.getParameterTypes()[0].getName()) && cri.isSingleton()) { continue; } Object o = JAXRSUtils.createContextValue(message, method.getGenericParameterTypes()[0], entry.getKey()); if (o != null) { if (!cri.isSingleton()) { InjectionUtils.injectThroughMethod(requestObject, method, o, message); } else { ThreadLocalProxy<Object> proxy = (ThreadLocalProxy<Object>)cri.getContextSetterProxy(method); if (proxy != null) { proxy.set(o); } } } } }
@SuppressWarnings("unchecked") public static void injectContextMethods(Object requestObject, AbstractResourceInfo cri, Message message) { for (Map.Entry<Class<?>, Method> entry : cri.getContextMethods().entrySet()) { Method method = entry.getValue(); if (method.getParameterTypes()[0] == Application.class && cri.isSingleton()) { continue; } Object o = JAXRSUtils.createContextValue(message, method.getGenericParameterTypes()[0], entry.getKey()); if (o != null) { if (!cri.isSingleton()) { InjectionUtils.injectThroughMethod(requestObject, method, o, message); } else { ThreadLocalProxy<Object> proxy = (ThreadLocalProxy<Object>)cri.getContextSetterProxy(method); if (proxy != null) { proxy.set(o); } } } } }
protected void injectApplicationIntoFeature(Feature feature) { if (application != null) { AbstractResourceInfo info = new AbstractResourceInfo(feature.getClass(), ClassHelper.getRealClass(feature), true, true, getBus()) { @Override public boolean isSingleton() { return false; } }; Method contextMethod = info.getContextMethods().get(Application.class); if (contextMethod != null) { InjectionUtils.injectThroughMethod(feature, contextMethod, application.getProvider()); return; } for (Field contextField : info.getContextFields()) { if (Application.class == contextField.getType()) { InjectionUtils.injectContextField(info, contextField, feature, application.getProvider()); break; } } } }
for (Map.Entry<Class<?>, Method> entry : cri.getContextMethods().entrySet()) { Method method = entry.getValue(); Object value = null;
for (Map.Entry<Class<?>, Method> entry : cri.getContextMethods().entrySet()) { Method method = entry.getValue(); Object value = method.getParameterTypes()[0] == Application.class