public static HttpSession createProxy(HttpServletRequest request, String portletWindowNamespace) { HttpSession servletSession = request.getSession(); HashSet interfaces = new HashSet(); interfaces.add(HttpSession.class); Class current = servletSession.getClass(); while (current != null) { try { Class[] currentInterfaces = current.getInterfaces(); for (int i = 0; i < currentInterfaces.length; i++) { interfaces.add(currentInterfaces[i]); } current = current.getSuperclass(); } catch (Exception e) { current = null; } } Object proxy = Proxy.newProxyInstance(servletSession.getClass().getClassLoader(), (Class[])interfaces.toArray(new Class[interfaces.size()]), new ServletPortletSessionProxy(request.getSession(), portletWindowNamespace)); return (HttpSession)proxy; }
(Class[])interfaces.toArray(new Class[interfaces.size()]), new ServletPortletSessionProxy(request.getSession(), portletWindowNamespace)); return (HttpSession)proxy;