public Object intercept(Invocation invocation) throws Throwable { Method method = invocation.getMethod(); String methodName = method.getName(); Object[] args = invocation.getArguments(); if ("getResourcePaths".equals(methodName) && args.length > 0 && ("/WEB-INF/lib".equals(args[0]) || "/WEB-INF/lib/".equals(args[0]))) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader instanceof URLClassLoader) { URL[] urls = ((URLClassLoader) loader).getURLs(); if (urls != null) { Set<String> paths = new HashSet<>(); for (int i = 0; i < urls.length; i++) { String url = urls[i].toString(); paths.add(url); } return paths; } } } else if ("getResourceAsStream".equals(methodName) && args.length > 0 && args[0].toString().startsWith("file:")) { URL url = new URL((String) args[0]); return url.openStream(); } else if ("getResource".equals(methodName) && args.length > 0 && args[0].toString().startsWith("file:")) { URL url = new URL((String) args[0]); return url; } return invocation.proceed(); } };
String methodName = invocation.getMethod().getName(); this.passivated = true; } else if ("logoutSession".equals(methodName)) { Session session = (Session) invocation.getProxy(); ret = userID; } else { ret = invocation.proceed(); ret = super.toString() + " (" + invocation.proceed().toString() + ")"; } else if ("hashCode".equals(methodName)) { ret = invocation.proceed(); } else { if (this.passivated) { if ("isLive".equals(methodName)) { if (poolingRepository.isActive()) { ret = invocation.proceed(); } else { ret = Boolean.FALSE; Session session = (Session) invocation.getProxy(); ret = invocation.proceed(); lastRefreshed = System.currentTimeMillis(); } else if ("localRefresh".equals(methodName)) { Session session = (Session) invocation.getProxy(); if (session instanceof HippoSession) {
@Override public Object intercept(Invocation invocation) throws Throwable { Task jaxrsClientTask = null; try { if (HDC.isStarted()) { jaxrsClientTask = HDC.getCurrentTask().startSubtask("RestProxyServicePlugin"); jaxrsClientTask.setAttribute("class", restServiceApiClass.getName()); jaxrsClientTask.setAttribute("method", invocation.getMethod().getName()); } return invocation.proceed(); } finally { if (jaxrsClientTask != null) { jaxrsClientTask.stop(); } } } }, new Class [] { restServiceApiClass });