Java Code Examples for javax.portlet.RenderRequest#getPortletSession()
The following examples show how to use
javax.portlet.RenderRequest#getPortletSession() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DispatcherTests3S_SPEC2_19_IncludeServletAction.java From portals-pluto with Apache License 2.0 | 6 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { 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 + V2DISPATCHERTESTS3S_SPEC2_19_INCLUDESERVLETACTION_DISPATCH4); if (msg != null) { writer.write("<p>" + msg + "</p><br/>\n"); ps.removeAttribute(RESULT_ATTR_PREFIX + V2DISPATCHERTESTS3S_SPEC2_19_INCLUDESERVLETACTION_DISPATCH4); } /* TestCase: V2DispatcherTests3S_SPEC2_19_IncludeServletAction_dispatch4 */ /* Details: "The parameters associated with a request dispatcher are */ /* scoped only for the duration of the include or forward call" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton(V2DISPATCHERTESTS3S_SPEC2_19_INCLUDESERVLETACTION_DISPATCH4, aurl); tb.writeTo(writer); } }
Example 2
Source File: AbstractController.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Override public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse response) throws Exception { // If the portlet is minimized and we don't want to render then return null. if (WindowState.MINIMIZED.equals(request.getWindowState()) && !this.renderWhenMinimized) { return null; } // Delegate to PortletContentGenerator for checking and preparing. checkAndPrepare(request, response); // Execute in synchronized block if required. if (this.synchronizeOnSession) { PortletSession session = request.getPortletSession(false); if (session != null) { Object mutex = PortletUtils.getSessionMutex(session); synchronized (mutex) { return handleRenderRequestInternal(request, response); } } } return handleRenderRequestInternal(request, response); }
Example 3
Source File: RequestTests_ActionRequest_ApiAction.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { LOGGER.trace("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 + "RequestTests_ActionRequest_ApiAction", APPLICATION_SCOPE); if (msg != null) { writer.write("<p>" + msg + "</p><br/>\n"); ps.removeAttribute(RESULT_ATTR_PREFIX + "RequestTests_ActionRequest_ApiAction", APPLICATION_SCOPE); } /* TestCase: V2RequestTests_ActionRequest_ApiAction_fieldACTION_NAME */ /* Details: "Has String field ACTION_NAME with value of */ /* \"javax.portlet.action\" " */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton(V2REQUESTTESTS_ACTIONREQUEST_APIACTION_FIELDACTION_NAME, aurl); tb.writeTo(writer); } }
Example 4
Source File: DispatcherTests3S_SPEC2_19_IncludeJSPAction.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { 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 + V2DISPATCHERTESTS3S_SPEC2_19_INCLUDEJSPACTION_DISPATCH4, APPLICATION_SCOPE); if (msg != null) { writer.write("<p>" + msg + "</p><br/>\n"); ps.removeAttribute(RESULT_ATTR_PREFIX + V2DISPATCHERTESTS3S_SPEC2_19_INCLUDEJSPACTION_DISPATCH4, APPLICATION_SCOPE); } /* TestCase: V2DispatcherTests3S_SPEC2_19_IncludeJSPAction_dispatch4 */ /* Details: "The parameters associated with a request dispatcher are */ /* scoped only for the duration of the include or forward call" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton(V2DISPATCHERTESTS3S_SPEC2_19_INCLUDEJSPACTION_DISPATCH4, aurl); tb.writeTo(writer); } }
Example 5
Source File: IMSBLTIPortlet.java From sakai with Educational Community License v2.0 | 5 votes |
public void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException { response.setContentType("text/html"); log.debug("==== doEdit called ===="); PortletSession pSession = request.getPortletSession(true); String title = getTitleString(request); if ( title != null ) response.setTitle(title); // Debug String inputData = (String) pSession.getAttribute("sakai.descriptor"); if ( inputData != null ) log.debug("descriptor.length()={}", inputData.length()); String url = (String) pSession.getAttribute("sakai.url"); log.debug("sakai.url={}", url); String view = (String) pSession.getAttribute("sakai.view"); log.debug("sakai.view={}", view); if ( "edit.reset".equals(view) ) { sendToJSP(request, response, "/editreset.jsp"); } else { prepareEdit(request); sendToJSP(request, response, "/edit.jsp"); } clearErrorMessage(request); log.debug("==== doEdit called ===="); }
Example 6
Source File: DispatcherTests3S_SPEC2_19_ForwardServletAction.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { 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 + V2DISPATCHERTESTS3S_SPEC2_19_FORWARDSERVLETACTION_DISPATCH4, APPLICATION_SCOPE); if (msg != null) { writer.write("<p>" + msg + "</p><br/>\n"); ps.removeAttribute(RESULT_ATTR_PREFIX + V2DISPATCHERTESTS3S_SPEC2_19_FORWARDSERVLETACTION_DISPATCH4, APPLICATION_SCOPE); } /* TestCase: V2DispatcherTests3S_SPEC2_19_ForwardServletAction_dispatch4 */ /* Details: "The parameters associated with a request dispatcher are */ /* scoped only for the duration of the include or forward call" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton(V2DISPATCHERTESTS3S_SPEC2_19_FORWARDSERVLETACTION_DISPATCH4, aurl); tb.writeTo(writer); } }
Example 7
Source File: ApplicantRenderController.java From portals-pluto with Apache License 2.0 | 5 votes |
@RenderMethod(portletNames = { "portlet1" }) @ValidateOnExecution(type = ExecutableType.NONE) public String prepareView(RenderRequest renderRequest, RenderResponse renderResponse) { String viewName = viewEngineContext.getView(); if (viewName == null) { viewName = "applicant.jspx"; Applicant applicant = (Applicant) models.get("applicant"); if (applicant == null) { applicant = new Applicant(); models.put("applicant", applicant); } PortletSession portletSession = renderRequest.getPortletSession(); List<Attachment> attachments = attachmentManager.getAttachments(portletSession.getId()); applicant.setAttachments(attachments); String datePattern = portletPreferences.getValue("datePattern", null); models.put("jQueryDatePattern", _getJQueryDatePattern(datePattern)); models.put("provinces", provinceService.getAllProvinces()); CDI<Object> currentCDI = CDI.current(); BeanManager beanManager = currentCDI.getBeanManager(); Class<? extends BeanManager> beanManagerClass = beanManager.getClass(); Package beanManagerPackage = beanManagerClass.getPackage(); models.put("weldVersion", beanManagerPackage.getImplementationVersion()); } return viewName; }
Example 8
Source File: PortletTests_Portlet_ApiAction.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { 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 + "PortletTests_Portlet_ApiAction", APPLICATION_SCOPE); if (msg != null) { writer.write("<p>" + msg + "</p><br/>\n"); ps.removeAttribute(RESULT_ATTR_PREFIX + "PortletTests_Portlet_ApiAction", APPLICATION_SCOPE); } /* TestCase: V2PortletTests_Portlet_ApiAction_processAction */ /* Details: "Method processAction(ActionRequest, ActionResponse): is */ /* called when an action URL for the portlet is triggered" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton(V2PORTLETTESTS_PORTLET_APIACTION_PROCESSACTION, aurl); tb.writeTo(writer); } }
Example 9
Source File: RenderStateTests_SPEC2_12_MutableRenderState2.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { portletResp.setContentType("text/html"); PrintWriter writer = portletResp.getWriter(); PortletSession ps = portletReq.getPortletSession(); String msg = (String) ps.getAttribute(Constants.RESULT_ATTR_PREFIX + "RenderStateTests_SPEC2_12_MutableRenderState2"); ps.removeAttribute(Constants.RESULT_ATTR_PREFIX + "RenderStateTests_SPEC2_12_MutableRenderState2"); if (msg != null && msg.length() > 0) { writer.write("<p>" + msg + "</p>\n"); } /* * TestCase: * V3RenderStateTests_SPEC2_12_MutableRenderState_getRenderParameters3 */ /* * Details: * "If no render parameters are available, the object will be empty." */ { ActionURL actionURL = portletResp.createActionURL(); MutableActionParameters mutableActionParams = actionURL .getActionParameters(); mutableActionParams.clear(); TestButton tb = new TestButton( V3RENDERSTATETESTS_SPEC2_12_MUTABLERENDERSTATE_GETRENDERPARAMETERS3, actionURL); tb.writeTo(writer); } }
Example 10
Source File: DispatcherTests3S_SPEC2_19_ForwardJSPAction.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { 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 + V2DISPATCHERTESTS3S_SPEC2_19_FORWARDJSPACTION_DISPATCH4, APPLICATION_SCOPE); if (msg != null) { writer.write("<p>" + msg + "</p><br/>\n"); ps.removeAttribute(RESULT_ATTR_PREFIX + V2DISPATCHERTESTS3S_SPEC2_19_FORWARDJSPACTION_DISPATCH4, APPLICATION_SCOPE); } /* TestCase: V2DispatcherTests3S_SPEC2_19_ForwardJSPAction_dispatch4 */ /* Details: "The parameters associated with a request dispatcher are */ /* scoped only for the duration of the include or forward call" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton(V2DISPATCHERTESTS3S_SPEC2_19_FORWARDJSPACTION_DISPATCH4, aurl); tb.writeTo(writer); } }
Example 11
Source File: DispatcherReqRespTests5S_SPEC2_19_ForwardServletActionResponse.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { 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 + "DispatcherReqRespTests5S_SPEC2_19_ForwardServletActionResponse", APPLICATION_SCOPE); if (msg != null) { writer.write("<p>" + msg + "</p><br/>\n"); ps.removeAttribute(RESULT_ATTR_PREFIX + "DispatcherReqRespTests5S_SPEC2_19_ForwardServletActionResponse", APPLICATION_SCOPE); } /* TestCase: V2DispatcherReqRespTests5S_SPEC2_19_ForwardServletActionResponse_sendRedirect */ /* Details: "In a target servlet of a forward in the Action phase, */ /* the method HttpServletResponse.sendRedirect must provide the same */ /* functionality as ActionResponse.sendRedirect" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton(V2DISPATCHERREQRESPTESTS5S_SPEC2_19_FORWARDSERVLETACTIONRESPONSE_SENDREDIRECT, aurl); tb.writeTo(writer); } }
Example 12
Source File: IMSBLTIPortlet.java From sakai with Educational Community License v2.0 | 5 votes |
public void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException { response.setContentType("text/html"); log.debug("==== doEdit called ===="); PortletSession pSession = request.getPortletSession(true); String title = getTitleString(request); if ( title != null ) response.setTitle(title); // Debug String inputData = (String) pSession.getAttribute("sakai.descriptor"); if ( inputData != null ) log.debug("descriptor.length()={}", inputData.length()); String url = (String) pSession.getAttribute("sakai.url"); log.debug("sakai.url={}", url); String view = (String) pSession.getAttribute("sakai.view"); log.debug("sakai.view={}", view); if ( "edit.reset".equals(view) ) { sendToJSP(request, response, "/editreset.jsp"); } else { prepareEdit(request); sendToJSP(request, response, "/edit.jsp"); } clearErrorMessage(request); log.debug("==== doEdit called ===="); }
Example 13
Source File: DispatcherReqRespTests5S_SPEC2_19_ForwardJSPActionResponse.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { 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 + "DispatcherReqRespTests5S_SPEC2_19_ForwardJSPActionResponse", APPLICATION_SCOPE); if (msg != null) { writer.write("<p>" + msg + "</p><br/>\n"); ps.removeAttribute(RESULT_ATTR_PREFIX + "DispatcherReqRespTests5S_SPEC2_19_ForwardJSPActionResponse", APPLICATION_SCOPE); } /* TestCase: V2DispatcherReqRespTests5S_SPEC2_19_ForwardJSPActionResponse_sendRedirect */ /* Details: "In a target jsp of a forward in the Action phase, the */ /* method HttpServletResponse.sendRedirect must provide the same */ /* functionality as ActionResponse.sendRedirect" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton(V2DISPATCHERREQRESPTESTS5S_SPEC2_19_FORWARDJSPACTIONRESPONSE_SENDREDIRECT, aurl); tb.writeTo(writer); } }
Example 14
Source File: SakaiIFrame.java From sakai with Educational Community License v2.0 | 4 votes |
private void sendAlert(RenderRequest request, Context context) { PortletSession pSession = request.getPortletSession(true); String str = (String) pSession.getAttribute(ALERT_MESSAGE); pSession.removeAttribute(ALERT_MESSAGE); if ( str != null && str.length() > 0 ) context.put("alertMessage", formattedText.escapeHtml(str, false)); }
Example 15
Source File: PortletIFrame.java From sakai with Educational Community License v2.0 | 4 votes |
private void sendAlert(RenderRequest request, Context context) { PortletSession pSession = request.getPortletSession(true); String str = (String) pSession.getAttribute(ALERT_MESSAGE); pSession.removeAttribute(ALERT_MESSAGE); if ( str != null && str.length() > 0 ) context.put("alertMessage", formattedText.escapeHtml(str, false)); }
Example 16
Source File: EnvironmentTests_PortletRequestDispatcher_ApiRender.java From portals-pluto with Apache License 2.0 | 4 votes |
@Override public void render(RenderRequest renderReq, RenderResponse renderResp) throws PortletException, IOException { long tid = Thread.currentThread().getId(); renderReq.setAttribute(THREADID_ATTR, tid); PrintWriter writer = renderResp.getWriter(); PortletSession ps = renderReq.getPortletSession(); String msg = (String) ps.getAttribute( RESULT_ATTR_PREFIX + "V2EnvironmentTests_PortletRequestDispatcher_ApiRender_forward1", APPLICATION_SCOPE); if (msg != null) { writer.write("<p>" + msg + "</p><br/>\n"); ps.removeAttribute( RESULT_ATTR_PREFIX + "V2EnvironmentTests_PortletRequestDispatcher_ApiRender_forward1", APPLICATION_SCOPE); } // Create result objects for the tests PortletRequest portletReq = renderReq; PortletResponse portletResp = renderResp; /* TestCase: V2EnvironmentTests_PortletRequestDispatcher_ApiRender_includeA1 */ /* Details: "Method include(PortletRequest, PortletResponse): */ /* Includes the content of a JSP page in the response" */ String target_tr0 = JSP_PREFIX + "V2EnvironmentTests_PortletRequestDispatcher_ApiRender_includeA1" + JSP_SUFFIX + "?" + QUERY_STRING; PortletRequestDispatcher rd_tr0 = portletConfig.getPortletContext().getRequestDispatcher(target_tr0); rd_tr0.include(portletReq, portletResp); /* TestCase: V2EnvironmentTests_PortletRequestDispatcher_ApiRender_includeA2 */ /* Details: "Method include(PortletRequest, PortletResponse): */ /* Includes the content of a HTML Page in the response" */ String target_tr1 = HTML_PREFIX + "V2EnvironmentTests_PortletRequestDispatcher_ApiRender_includeA2" + HTML_SUFFIX; PortletRequestDispatcher rd_tr1 = portletConfig.getPortletContext().getRequestDispatcher(target_tr1); rd_tr1.include(portletReq, portletResp); /* TestCase: V2EnvironmentTests_PortletRequestDispatcher_ApiRender_includeA3 */ /* Details: "Method include(PortletRequest, PortletResponse): The */ /* included servlet cannot change the status code. The attempt is */ /* ignored" */ String target_tr2 = SERVLET_PREFIX + "V2EnvironmentTests_PortletRequestDispatcher_ApiRender_PortletRequest_Include" + SERVLET_SUFFIX; PortletRequestDispatcher rd_tr2 = portletConfig.getPortletContext().getRequestDispatcher(target_tr2); rd_tr2.include(portletReq, portletResp); /* TestCase: V2EnvironmentTests_PortletRequestDispatcher_ApiRender_includeB1 */ /* Details: "Method include(RenderRequest, RenderResponse): Includes */ /* the content of a JSP page in the response" */ String target_tr3 = JSP_PREFIX + "V2EnvironmentTests_PortletRequestDispatcher_ApiRender_includeB1" + JSP_SUFFIX + "?" + QUERY_STRING; PortletRequestDispatcher rd_tr3 = portletConfig.getPortletContext().getRequestDispatcher(target_tr3); rd_tr3.include(portletReq, portletResp); /* TestCase: V2EnvironmentTests_PortletRequestDispatcher_ApiRender_includeB2 */ /* Details: "Method include(RenderRequest, RenderResponse): Includes */ /* the content of a HTML Page in the response" */ String target_tr4 = HTML_PREFIX + "V2EnvironmentTests_PortletRequestDispatcher_ApiRender_includeB2" + HTML_SUFFIX; PortletRequestDispatcher rd_tr4 = portletConfig.getPortletContext().getRequestDispatcher(target_tr4); rd_tr4.include(portletReq, portletResp); /* TestCase: V2EnvironmentTests_PortletRequestDispatcher_ApiRender_includeB3 */ /* Details: "Method include(RenderRequest, RenderResponse): The */ /* included servlet cannot change the status code. The attempt is */ /* ignored" */ String target_tr5 = SERVLET_PREFIX + "V2EnvironmentTests_PortletRequestDispatcher_ApiRender_RenderRequest_Include" + SERVLET_SUFFIX; PortletRequestDispatcher rd_tr5 = portletConfig.getPortletContext().getRequestDispatcher(target_tr5); rd_tr5.include(portletReq, portletResp); }
Example 17
Source File: ApplicantRenderController.java From portals-pluto with Apache License 2.0 | 4 votes |
@RenderMethod(portletNames = { "portlet1" }) @ValidateOnExecution(type = ExecutableType.NONE) public String prepareView(RenderRequest renderRequest, RenderResponse renderResponse) { String viewName = viewEngineContext.getView(); if (viewName == null) { viewName = "applicant.html"; Applicant applicant = (Applicant) models.get("applicant"); if (applicant == null) { applicant = new Applicant(); models.put("applicant", applicant); } PortletSession portletSession = renderRequest.getPortletSession(); List<Attachment> attachments = attachmentManager.getAttachments(portletSession.getId()); applicant.setAttachments(attachments); String datePattern = portletPreferences.getValue("datePattern", null); models.put("jQueryDatePattern", _getJQueryDatePattern(datePattern)); models.put("provinces", provinceService.getAllProvinces()); CDI<Object> currentCDI = CDI.current(); BeanManager beanManager = currentCDI.getBeanManager(); Class<? extends BeanManager> beanManagerClass = beanManager.getClass(); Package beanManagerPackage = beanManagerClass.getPackage(); models.put("weldVersion", beanManagerPackage.getImplementationVersion()); // Thymeleaf models.put("autoFillResourceURL", ControllerUtil.createResourceURL(renderResponse, "autoFill")); models.put("deleteFileResourceURL", ControllerUtil.createResourceURL(renderResponse, "deleteFile")); models.put("mainFormActionURL", renderResponse.createActionURL()); models.put("viewTermsResourceURL", ControllerUtil.createResourceURL(renderResponse, "viewTerms")); models.put("uploadFilesResourceURL", ControllerUtil.createResourceURL(renderResponse, "uploadFiles")); } return viewName; }
Example 18
Source File: TestPortlet.java From portals-pluto with Apache License 2.0 | 4 votes |
/** * Serves up the <code>view</code> mode. * TODO: more javadoc. * * @param request the protlet request. * @param response the portlet response. */ @Override public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException { // Get the current test ID, the test instance and its config. String testId = getTestId(request); TestConfig testConfig = null; PortletTest test = null; if (testId != null) { testConfig = (TestConfig) testConfigs.get(Integer.parseInt(testId)); test = (PortletTest) tests.get(testId); } if (LOG.isDebugEnabled()) { for (Entry<String, String[]> e : request.getParameterMap().entrySet()) { LOG.debug(e.getKey() + " => " + Arrays.asList(e.getValue())); } LOG.debug("Test ID: " + testId); LOG.debug("Test Config: " + testConfig); if (testConfig != null) { LOG.debug("Test config view: " + testConfig.getDisplayURI()); } } // For non-ActionTest, run test and save results in request. if (test != null) { TestResults results = test.doTest(getPortletConfig(), getPortletContext(), request, response); PortletSession session = request.getPortletSession(); TestResults existing = (TestResults) session.getAttribute( test.getClass().getName()); if (existing != null) { for (TestResult result : results.getCollection()) { existing.add(result); } request.setAttribute("results", existing); session.setAttribute(test.getClass().getName(), null); } else { request.setAttribute("results", results); } } if (testId == null) { request.setAttribute("testConfigs", testConfigs); } else { TestConfig nextTestConfig = null; TestConfig prevTestConfig = null; int index = testConfigs.indexOf(test.getConfig()); if (index == 0) { prevTestConfig = (TestConfig) testConfigs.get(testConfigs.size() - 1); nextTestConfig = (TestConfig) testConfigs.get(index + 1); } else if (index == testConfigs.size() - 1) { prevTestConfig = (TestConfig) testConfigs.get(index - 1); nextTestConfig = (TestConfig) testConfigs.get(0); } else { prevTestConfig = (TestConfig) testConfigs.get(index - 1); nextTestConfig = (TestConfig) testConfigs.get(index + 1); } request.setAttribute("prevTest", prevTestConfig); request.setAttribute("nextTest", nextTestConfig); request.setAttribute("testId", new Integer(testId)); request.setAttribute("test", test); } // Set content type for render response, and dispatch to JSP. response.setContentType("text/html"); String displayUri = null; if (testConfig != null) { displayUri = testConfig.getDisplayURI(); } else { displayUri = "/jsp/introduction.jsp"; } PortletRequestDispatcher dispatcher = getPortletContext() .getRequestDispatcher(displayUri); dispatcher.include(request, response); }
Example 19
Source File: SakaiIFrame.java From sakai with Educational Community License v2.0 | 4 votes |
private void sendAlert(RenderRequest request, Context context) { PortletSession pSession = request.getPortletSession(true); String str = (String) pSession.getAttribute(ALERT_MESSAGE); pSession.removeAttribute(ALERT_MESSAGE); if ( str != null && str.length() > 0 ) context.put("alertMessage", formattedText.escapeHtml(str, false)); }
Example 20
Source File: PortletIFrame.java From sakai with Educational Community License v2.0 | 4 votes |
private void sendAlert(RenderRequest request, Context context) { PortletSession pSession = request.getPortletSession(true); String str = (String) pSession.getAttribute(ALERT_MESSAGE); pSession.removeAttribute(ALERT_MESSAGE); if ( str != null && str.length() > 0 ) context.put("alertMessage", formattedText.escapeHtml(str, false)); }