protected void bindOperation(OperationInfo op, Method method) { try { // Find the Async method which returns a Response Method responseMethod = ReflectionUtil.getDeclaredMethod(method.getDeclaringClass(), method.getName() + "Async", method.getParameterTypes()); // Find the Async method whic has a Future & AsyncResultHandler List<Class<?>> asyncHandlerParams = Arrays.asList(method.getParameterTypes()); //copy it to may it non-readonly asyncHandlerParams = new ArrayList<>(asyncHandlerParams); asyncHandlerParams.add(AsyncHandler.class); Method futureMethod = ReflectionUtil .getDeclaredMethod(method.getDeclaringClass(), method.getName() + "Async", asyncHandlerParams.toArray(new Class<?>[0])); getMethodDispatcher().bind(op, method, responseMethod, futureMethod); } catch (SecurityException e) { throw new ServiceConstructionException(e); } catch (NoSuchMethodException e) { getMethodDispatcher().bind(op, method); } }
Method m = ReflectionUtil.getDeclaredMethod(ClassLoader.class, "defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE);
private static void setContextualNamespaceDecls(Object mapper, Map<String, String> nsctxt) { try { Method m = ReflectionUtil.getDeclaredMethod(mapper.getClass(), "setContextualNamespaceDecls", new Class<?>[]{String[].class}); String[] args = new String[nsctxt.size() * 2]; int ai = 0; for (Entry<String, String> nsp : nsctxt.entrySet()) { args[ai++] = nsp.getValue(); args[ai++] = nsp.getKey(); } m.invoke(mapper, new Object[]{args}); } catch (Exception e) { // ignore LOG.log(Level.WARNING, "Failed to set the contextual namespace map", e); } }
protected void bindOperation(OperationInfo op, Method method) { try { // Find the Async method which returns a Response Method responseMethod = ReflectionUtil.getDeclaredMethod(method.getDeclaringClass(), method.getName() + "Async", method.getParameterTypes()); // Find the Async method whic has a Future & AsyncResultHandler List<Class<?>> asyncHandlerParams = Arrays.asList(method.getParameterTypes()); //copy it to may it non-readonly asyncHandlerParams = new ArrayList<>(asyncHandlerParams); asyncHandlerParams.add(AsyncHandler.class); Method futureMethod = ReflectionUtil .getDeclaredMethod(method.getDeclaringClass(), method.getName() + "Async", asyncHandlerParams.toArray(new Class<?>[0])); getMethodDispatcher().bind(op, method, responseMethod, futureMethod); } catch (SecurityException e) { throw new ServiceConstructionException(e); } catch (NoSuchMethodException e) { getMethodDispatcher().bind(op, method); } }
Method get = ReflectionUtil.getDeclaredMethod(SessionHandler.class, "getSessionManager"); Method set = ReflectionUtil.getDeclaredMethod(SessionHandler.class, "setSessionManager", get.getReturnType()); if (this.getSessionTimeout() >= 0) { Method setMaxInactiveInterval = ReflectionUtil .getDeclaredMethod(get.getReturnType(), "setMaxInactiveInterval", int.class); ReflectionUtil.setAccessible(setMaxInactiveInterval) .invoke(ReflectionUtil.setAccessible(get).invoke(sessionHandler), 20); if (this.getSessionTimeout() >= 0) { Method setMaxInactiveInterval = ReflectionUtil .getDeclaredMethod(SessionHandler.class, "setMaxInactiveInterval", int.class); ReflectionUtil.setAccessible(setMaxInactiveInterval).invoke(sh, 20);
Method get = ReflectionUtil.getDeclaredMethod(SessionHandler.class, "getSessionManager"); Method set = ReflectionUtil.getDeclaredMethod(SessionHandler.class, "setSessionManager", get.getReturnType()); if (this.getSessionTimeout() >= 0) { Method setMaxInactiveInterval = ReflectionUtil .getDeclaredMethod(get.getReturnType(), "setMaxInactiveInterval", int.class); ReflectionUtil.setAccessible(setMaxInactiveInterval) .invoke(ReflectionUtil.setAccessible(get).invoke(sessionHandler), 20); if (this.getSessionTimeout() >= 0) { Method setMaxInactiveInterval = ReflectionUtil .getDeclaredMethod(SessionHandler.class, "setMaxInactiveInterval", int.class); ReflectionUtil.setAccessible(setMaxInactiveInterval).invoke(sh, 20);
Method m = ReflectionUtil.getDeclaredMethod(ClassLoader.class, "defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE);