01: /* Copyright 2004 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.container;
07:
08: import java.io.IOException;
09:
10: import javax.portlet.PortletSession;
11: import javax.portlet.PortletRequest;
12: import javax.servlet.ServletException;
13: import javax.servlet.http.HttpServletRequest;
14: import javax.servlet.http.HttpServletResponse;
15:
16: /**
17: * Portlet Wraper servlet
18: * Allow the portal container to monitor PortletSession object by adding
19: * the portletSession as a request attribute
20: * @author Stéphane Bond
21: */
22: public class PortletServlet extends
23: org.apache.pluto.core.PortletServlet {
24:
25: private static final long serialVersionUID = 1L;
26:
27: public final static String SESSION_MONITOR_ATTRIBUTE = "org.jasig.portal.container.PORTLET_SESSION_MONITOR";
28:
29: protected void service(HttpServletRequest request,
30: HttpServletResponse response) throws ServletException,
31: IOException {
32: super .service(request, response);
33: PortletRequest portletRequest = (PortletRequest) request
34: .getAttribute(org.apache.pluto.Constants.PORTLET_REQUEST);
35: if (portletRequest != null) {
36: PortletSession portletSession = portletRequest
37: .getPortletSession(false);
38: if (portletSession != null) {
39: request.setAttribute(SESSION_MONITOR_ATTRIBUTE,
40: portletSession);
41: }
42: }
43: }
44:
45: }
|