public static HttpSession createProxy(HttpServletRequest request) { HttpSession servletSession = request.getSession(); PortletRequest portletRequest = (PortletRequest) request.getAttribute("javax.portlet.request"); if (portletRequest != null) { PortletSession portletSession = portletRequest.getPortletSession(); servletSession = (HttpSession)createProxy(request, "javax.portlet.p."+PortletWindowUtils.getPortletWindowId(portletSession)); } return servletSession; }
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; }
/** * Constructor which will attempt to discover the portlet window id to use as the portlet name * space and delegate construction to * {@link ServletPortletSessionProxy#createProxy(HttpServletRequest, String)}. * * @param request * @return */ public static HttpSession createProxy(HttpServletRequest request) { HttpSession servletSession = request.getSession(); PortletRequest portletRequest = (PortletRequest) request.getAttribute("javax.portlet.request"); if (portletRequest != null) { PortletSession portletSession = portletRequest.getPortletSession(); servletSession = (HttpSession)createProxy(request, "javax.portlet.p."+PortletWindowUtils.getPortletWindowId(portletSession)); } return servletSession; }
(Class[])interfaces.toArray(new Class[interfaces.size()]), new ServletPortletSessionProxy(request.getSession(), portletWindowNamespace)); return (HttpSession)proxy;
filterRequestContext.setRequest(new PortletServletRequestWrapper(config .getServletContext(), filterRequestContext.getRequest(), ServletPortletSessionProxy.createProxy(filterRequestContext.getRequest()), filterPath)); if (WicketPortlet.ACTION_REQUEST.equals(filterRequestContext.getRequest().getAttribute( if (portletWindowId != null) HttpSession proxiedSession = ServletPortletSessionProxy.createProxy(request, portletWindowId); pathInfo = stripWindowIdFromPathInfo(pathInfo);