/** * Get SessionBean. * * @param request PortletRequest * @return Vlado2PortletSessionBean */ private static Vlado2PortletSessionBean getSessionBean(PortletRequest request) { PortletSession session = request.getPortletSession(); if (session == null) return null; Vlado2PortletSessionBean sessionBean = (Vlado2PortletSessionBean) session.getAttribute(SESSION_BEAN); if (sessionBean == null) { sessionBean = new Vlado2PortletSessionBean(); session.setAttribute(SESSION_BEAN, sessionBean); } return sessionBean; }
public void addListener(SessionListener sessionListener) { ServletExternalContext.SessionListeners listeners = (ServletExternalContext.SessionListeners) portletSession.getAttribute( ServletExternalContext.SESSION_LISTENERS, PortletSession.APPLICATION_SCOPE); if (listeners == null) { listeners = new ServletExternalContext.SessionListeners(); portletSession.setAttribute( ServletExternalContext.SESSION_LISTENERS, listeners, PortletSession.APPLICATION_SCOPE); } listeners.addListener(sessionListener); }
public void removeListener(SessionListener sessionListener) { final ServletExternalContext.SessionListeners listeners = (ServletExternalContext.SessionListeners) portletSession.getAttribute( ServletExternalContext.SESSION_LISTENERS, PortletSession.APPLICATION_SCOPE); if (listeners != null) listeners.removeListener(sessionListener); }
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { LOGGER.entering(LOG_CLASS, "main portlet render entry"); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); PrintWriter writer = portletResp.getWriter(); PortletSession ps = portletReq.getPortletSession(); String msg = (String) ps.getAttribute( RESULT_ATTR_PREFIX + "DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse", APPLICATION_SCOPE); if (msg != null) { writer.write("<p>" + msg + "</p><br/>\n"); ps.removeAttribute( RESULT_ATTR_PREFIX + "DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse", APPLICATION_SCOPE); } /* TestCase: V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_containsHeader */ /* Details: "In a target jsp of a include in the Action phase, the */ /* method HttpServletResponse.containsHeader must return false" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton( "V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_containsHeader", aurl); tb.writeTo(writer); } /* TestCase: V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_encodeRedirectURL1 */ /* Details: "In a target jsp of a include in the Action phase, the */ /* method HttpServletResponse.encodeRedirectURL must return null" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton( "V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_encodeRedirectURL1", aurl); tb.writeTo(writer); } /* TestCase: V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_encodeRedirectUrl */ /* Details: "In a target jsp of a include in the Action phase, the */ /* method HttpServletResponse.encodeRedirectUrl must return null" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton( "V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_encodeRedirectUrl", aurl); tb.writeTo(writer); } /* TestCase: V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_encodeURL1 */ /* Details: "In a target jsp of a include in the Action phase, the */ /* method HttpServletResponse.encodeURL must provide the same */ /* functionality as ActionResponse.encodeURL" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton( "V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_encodeURL1", aurl); tb.writeTo(writer); } /* TestCase: V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_encodeUrl */ /* Details: "In a target jsp of a include in the Action phase, the */ /* method HttpServletResponse.encodeUrl must provide the same */ /* functionality as ActionResponse.encodeURL" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton( "V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_encodeUrl", aurl); tb.writeTo(writer); } /* TestCase: V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_getBufferSize */ /* Details: "In a target jsp of a include in the Action phase, the */ /* method HttpServletResponse.getBufferSize must return 0" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton( "V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_getBufferSize", aurl); tb.writeTo(writer); } /* TestCase: V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_getCharacterEncoding */ /* Details: "In a target jsp of a include in the Action phase, the */ /* method HttpServletResponse.getCharacterEncoding must return null" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton( "V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_getCharacterEncoding", aurl); tb.writeTo(writer); } /* TestCase: V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_getContentType */ /* Details: "In a target jsp of a include in the Action phase, the */ /* method HttpServletResponse.getContentType must return null" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton( "V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_getContentType", aurl); tb.writeTo(writer); } /* TestCase: V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_getLocale */ /* Details: "In a target jsp of a include in the Action phase, the */ /* method HttpServletResponse.getLocale must return null" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton( "V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_getLocale", aurl); tb.writeTo(writer); } /* TestCase: V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_isCommitted */ /* Details: "In a target jsp of a include in the Action phase, the */ /* method HttpServletResponse.isCommitted must return true" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton( "V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPActionResponse_isCommitted", aurl); tb.writeTo(writer); } }
public void setMaxInactiveInterval(int interval) { portletSession.setMaxInactiveInterval(interval); }
public void invalidate() { portletSession.invalidate(); }
public boolean isNew() { return portletSession.isNew(); }
public int getMaxInactiveInterval() { return portletSession.getMaxInactiveInterval(); }
public long getLastAccessedTime() { return portletSession.getLastAccessedTime(); }
public String getId() { return portletSession.getId(); }
public long getCreationTime() { return portletSession.getCreationTime(); }
public void sessionInvalidate() { PortletSession session = portletRequest.getPortletSession(false); if (session != null) session.invalidate(); }