01: /*
02: * SharedEventsPortlet.java
03: *
04: * This is just an wrapper for Community Search.
05: * The events added to the database contain the portlet URL as displayURL.
06: * When it is selected it is handled by this class.
07: * With out this wrapper the jsf may redirect it to eventsList/event.jsp.
08: * This wrapper makes sure it goes to the displayURL ( happens to be eventsList) only,
09: * where it is displayed.
10: */
11:
12: package com.sun.portal.app.sharedevents.faces;
13:
14: import com.sun.faces.portlet.FacesPortlet;
15: import com.sun.portal.app.sharedevents.util.SharedConstants;
16: import com.sun.portal.log.common.PortalLogger;
17: import com.sun.portal.portlet.impl.PortletRequestConstants;
18: import javax.servlet.http.HttpServletRequest;
19: import javax.portlet.*;
20: import java.io.IOException;
21: import java.util.logging.Logger;
22:
23: /**
24: *
25: *
26: */
27: public final class SharedEventsPortlet extends FacesPortlet implements
28: Portlet {
29:
30: private static final String CLASS_NAME = "SharedEventsPortlet";
31: private Logger logger = PortalLogger
32: .getLogger(SharedEventsPortlet.class);
33:
34: /** Creates a new instance of SharedEventsPortlet */
35: public SharedEventsPortlet() {
36: logger.entering(CLASS_NAME, "SharedEventsPortlet");
37:
38: logger.exiting(CLASS_NAME, "SharedEventsPortlet");
39: }
40:
41: public void processAction(ActionRequest req, ActionResponse res)
42: throws PortletException, IOException {
43: logger.entering(CLASS_NAME, "processAction");
44: String id = req
45: .getParameter(SharedConstants.URL_COMM_SEARCH_EVENT_UID);
46: if (id != null) {
47: logger.fine(SharedConstants.URL_COMM_SEARCH_EVENT_UID + "="
48: + id);
49: PortletSession session = req.getPortletSession();
50: session.setAttribute(
51: SharedConstants.SESSION_COMMUNITY_EVENT_SEARCH,
52: String.valueOf(true));
53:
54: session.setAttribute(
55: SharedConstants.SESSION_CURR_EVENT_UID, id);
56: session
57: .removeAttribute(SharedConstants.SESSION_CURR_EVENT_RID);
58:
59: String reqRid = req
60: .getParameter(SharedConstants.URL_CURR_EVENT_RID);
61: if (reqRid != null && reqRid.length() > 0
62: && !reqRid.equalsIgnoreCase("null")) {
63: session.setAttribute(
64: SharedConstants.SESSION_CURR_EVENT_RID, reqRid);
65: }
66: String redirectURL = req.getPreferences().getValue(
67: SharedConstants.VISIBLE_URL, null);
68: logger
69: .fine(" processAction() , redirectURL="
70: + redirectURL);
71: HttpServletRequest httpReq = (HttpServletRequest) req
72: .getAttribute(PortletRequestConstants.HTTP_SERVLET_REQUEST);
73: if (redirectURL != null
74: && !redirectURL
75: .equalsIgnoreCase(SharedConstants.DUMMY)) {
76: res.sendRedirect(httpReq.getRequestURI() + redirectURL);
77: }
78: } else {
79: super .processAction(req, res);
80: }
81: logger.exiting(CLASS_NAME, "processAction");
82: }
83:
84: }
|