Java Code Examples for javax.portlet.RenderRequest#getParameter()
The following examples show how to use
javax.portlet.RenderRequest#getParameter() .
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: FilterTests_EventFilter_ApiEventFilter_event.java From portals-pluto with Apache License 2.0 | 6 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails(); portletResp.setContentType("text/html"); PrintWriter writer = portletResp.getWriter(); writer.write("<h3>Event Companion Portlet </h3>\n"); writer.write("<p>FilterTests_EventFilter_ApiEventFilter_event</p>\n"); String msg = (String) portletReq.getPortletSession().getAttribute( RESULT_ATTR_PREFIX + "FilterTests_EventFilter_ApiEventFilter", APPLICATION_SCOPE); msg = (msg == null) ? "Not ready. click test case link." : msg; writer.write("<p>" + msg + "</p>\n"); if (portletReq.getParameter("tr8") != null && portletReq.getParameter("tr8").equals("true")) { TestResult tr8 = tcd.getTestResultFailed("V2FilterTests_EventFilter_ApiEventFilter_doFilterExamine"); tr8.setTcSuccess(true); tr8.writeTo(writer); } }
Example 2
Source File: AddlFilterTests_SPEC2_20_Event_event.java From portals-pluto with Apache License 2.0 | 6 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails(); portletResp.setContentType("text/html"); PrintWriter writer = portletResp.getWriter(); writer.write("<h3>Event Companion Portlet </h3>\n"); writer.write("<p>AddlFilterTests_SPEC2_20_Event_event</p>\n"); if (portletReq.getParameter("tr12") != null && portletReq.getParameter("tr12").equals("true")) { TestResult tr12 = tcd.getTestResultFailed(V2ADDLFILTERTESTS_SPEC2_20_EVENT_FILTERWRAPPER4); tr12.setTcSuccess(true); tr12.writeTo(writer); } String msg = (String) portletReq.getPortletSession() .getAttribute(RESULT_ATTR_PREFIX + "AddlFilterTests_SPEC2_20_Event", APPLICATION_SCOPE); msg = (msg == null) ? "Not ready. click test case link." : msg; writer.write("<p>" + msg + "</p>\n"); }
Example 3
Source File: TestModule2_CompanionPortlet.java From portals-pluto with Apache License 2.0 | 6 votes |
@Override public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException { LOGGER.trace("render: Entry"); PrintWriter writer = response.getWriter(); TestResult tr = null; // Test: TestModule2_PublicRenderParameterCanBeSetThroughUrl // The link with the public render parameter is generated // by the main portlet. String parm = request.getParameter("publicRenderParameter1"); if (parm != null) { // test was executed so generate results tr = tcd.getTestResultSucceeded(TEST4); tr.writeTo(writer); } else { // test not executed yet, or was not correctly executed TestMessage tm = new TestMessage(TEST4, "Waiting for publicRenderParameter1 to be set."); tm.writeTo(writer); } }
Example 4
Source File: XssPortlet.java From Android_Code_Arbiter with GNU Lesser General Public License v3.0 | 5 votes |
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException { response.setContentType("text/html"); PrintWriter writer = response.getWriter(); String user = request.getParameter("user"); writer.println("<h1>Hello "+user+"!</h1>"); }
Example 5
Source File: SimpleRSSPortlet.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Custom mode handler for EDIT view */ protected void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException { log.debug("Simple RSS doEdit()"); //if we have an error message, replay the form String errorMessage = request.getParameter("errorMessage"); if(StringUtils.isNotBlank(errorMessage)) { //PORT-672 replay data from the request so it is preserved request.setAttribute("portletTitle", request.getParameter("portletTitle")); request.setAttribute("feedUrl", request.getParameter("feedUrl")); request.setAttribute("maxItems", request.getParameter("maxItems")); } else { //get it from the preferences request.setAttribute("portletTitle", getConfiguredPortletTitle(request)); request.setAttribute("feedUrl", getConfiguredFeedUrl(request)); request.setAttribute("maxItems", getConfiguredMaxItems(request)); } //check permissions request.setAttribute("feedUrlIsLocked", isPrefLocked(request, PREF_FEED_URL)); request.setAttribute("portletTitleIsLocked", isPrefLocked(request, PREF_PORTLET_TITLE)); //cancel url request.setAttribute("cancelUrl", getPortletModeUrl(response, PortletMode.VIEW)); //get any error message that is in the request and pass it on request.setAttribute("errorMessage", request.getParameter("errorMessage")); dispatch(request, response, editUrl); }
Example 6
Source File: PageAdminPortlet.java From portals-pluto with Apache License 2.0 | 5 votes |
public String getHelpPage(RenderRequest request) { String incPage = HELP_PAGE; String page = request.getParameter("helpPage"); if (page != null) { incPage = JSP_DIR + page; } return incPage; }
Example 7
Source File: FilterTests_ActionFilter_ApiActionFilter2.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails(); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); PrintWriter writer = portletResp.getWriter(); /* TestCase: V2FilterTests_ActionFilter_ApiActionFilter_doFilterBlock */ /* Details: "If the doFilter(ActionRequest, ActionResponse, */ /* FilterChain): method does not invoke the next filter, */ /* processAction is not called" */ if (portletReq.getParameter("tr5_success") != null && portletReq.getParameter("tr5_success").equals("true")) { TestResult tr5 = tcd.getTestResultFailed(V2FILTERTESTS_ACTIONFILTER_APIACTIONFILTER_DOFILTERBLOCK); if (portletReq.getParameter("tr5") == null) { tr5.setTcSuccess(true); } else { tr5.appendTcDetail( "Failed because processAction was executed which set the tr5 parameter value to " + portletReq.getParameter("tr5")); } tr5.writeTo(writer); } else { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton(V2FILTERTESTS_ACTIONFILTER_APIACTIONFILTER_DOFILTERBLOCK, aurl); tb.writeTo(writer); } }
Example 8
Source File: FilterTests_EventFilter_ApiEventFilter_event2.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails(); portletResp.setContentType("text/html"); PrintWriter writer = portletResp.getWriter(); /* TestCase: V2FilterTests_EventFilter_ApiEventFilter_doFilterBlock */ /* Details: "If the doFilter(EventRequest, EventResponse, */ /* FilterChain): method does not invoke the next filter, processEvent */ /* is not called" */ if (portletReq.getParameter("tr5_success") != null && portletReq.getParameter("tr5_success").equals("true")) { TestResult tr5 = tcd.getTestResultFailed(V2FILTERTESTS_EVENTFILTER_APIEVENTFILTER_DOFILTERBLOCK); if (portletReq.getParameter("tr5") == null) { tr5.setTcSuccess(true); } else { tr5.appendTcDetail( "Failed because processEvent was executed which set the tr5 parameter value to " + portletReq.getParameter("tr5")); } tr5.writeTo(writer); } }
Example 9
Source File: AddlRequestTests_SPEC2_11_Event_event.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(); writer.write("<h3>Event Companion Portlet </h3>\n"); writer.write("<p>AddlRequestTests_SPEC2_11_Event_event</p>\n"); /* TestCase: V2AddlRequestTests_SPEC2_11_Event_parameters12 */ /* Details: "If a portlet receives an event that is the result of a */ /* client request targeted to another portlet in the portal page, the */ /* parameters should be the same parameters as of the previous render */ /* request from this client" */ if (portletReq.getParameter("tr3") == null) { PortletURL rurl = portletResp.createRenderURL(); rurl.setParameters(portletReq.getPrivateParameterMap()); rurl.setParameter("tr3", "true"); TestSetupLink tb = new TestSetupLink(V2ADDLREQUESTTESTS_SPEC2_11_EVENT_PARAMETERS12, rurl); tb.writeTo(writer); } String msg = (String) portletReq.getPortletSession() .getAttribute(RESULT_ATTR_PREFIX + "AddlRequestTests_SPEC2_11_Event", APPLICATION_SCOPE) + (String) portletReq.getPortletSession().getAttribute( RESULT_ATTR_PREFIX + "AddlRequestTests_SPEC2_11_Event_event", APPLICATION_SCOPE); msg = (msg.equals("nullnull")) ? "Not ready. click test case link." : msg; writer.write("<p>" + msg + "</p>\n"); }
Example 10
Source File: AddlPortletTests_SPEC2_8_PortletModes.java From portals-pluto with Apache License 2.0 | 5 votes |
@RenderMode(name = "custom1") public void doView(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); PrintWriter writer = portletResp.getWriter(); JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails(); /* TestCase: V2AddlPortletTests_SPEC2_8_PortletModes_declaringPortletModes7 */ /* Details: "A custom portlet mode with */ /* <portal-managed>false</portal-managed> corresponds to */ /* the VIEW mode from the portal point of view" */ if (portletReq.getParameter("tr6") != null && portletReq.getParameter("tr6").equals("true")) { TestResult tr6 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_8_PORTLETMODES_DECLARINGPORTLETMODES7); if (portletReq.getPortletMode().equals(new PortletMode("custom1"))) { tr6.setTcSuccess(true); } else { tr6.appendTcDetail("Failed because portlet mode is not VIEW but " + portletReq.getPortletMode().toString()); } tr6.writeTo(writer); } }
Example 11
Source File: TestCompanionPortlet.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException { response.setContentType("text/html"); String eventInfo = request.getParameter(EVENT_INFO_PARAM); request.setAttribute("eventInfo", eventInfo); getPortletContext() .getRequestDispatcher("/jsp/TestCompanionPortlet.jsp") .include(request, response); }
Example 12
Source File: SimpleRSSPortlet.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Custom mode handler for EDIT view */ protected void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException { log.debug("Simple RSS doEdit()"); //if we have an error message, replay the form String errorMessage = request.getParameter("errorMessage"); if(StringUtils.isNotBlank(errorMessage)) { //PORT-672 replay data from the request so it is preserved request.setAttribute("portletTitle", request.getParameter("portletTitle")); request.setAttribute("feedUrl", request.getParameter("feedUrl")); request.setAttribute("maxItems", request.getParameter("maxItems")); } else { //get it from the preferences request.setAttribute("portletTitle", getConfiguredPortletTitle(request)); request.setAttribute("feedUrl", getConfiguredFeedUrl(request)); request.setAttribute("maxItems", getConfiguredMaxItems(request)); } //check permissions request.setAttribute("feedUrlIsLocked", isPrefLocked(request, PREF_FEED_URL)); request.setAttribute("portletTitleIsLocked", isPrefLocked(request, PREF_PORTLET_TITLE)); //cancel url request.setAttribute("cancelUrl", getPortletModeUrl(response, PortletMode.VIEW)); //get any error message that is in the request and pass it on request.setAttribute("errorMessage", request.getParameter("errorMessage")); dispatch(request, response, editUrl); }
Example 13
Source File: RequestParameters.java From journaldev with MIT License | 5 votes |
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException { // Check if the loggedIn is null for initial state if(request.getParameter("loggedIn") == null){ response.getWriter().println("<form action="+response.createActionURL()+">" + "Enter Username : <input type='text' id='username' name='username'/>" + "Enter Password : <input type='password' id='password' name='password'/>" + "<input type='submit' value='Login'/>" + "</form>"); } else { // Get loggedIn value from the request parameter boolean loggedIn = Boolean.parseBoolean(request.getParameter("loggedIn")); if(loggedIn){ response.getWriter().println("<form action="+response.createActionURL()+">" + "<p>You're logged in</p>" + "</form>"); } else { response.getWriter().println("<form action="+response.createActionURL()+">" + "<span style='color:red'>Try another</span><br/>" + "Enter Username : <input type='text' id='username' name='username'/>" + "Enter Password : <input type='password' id='password' name='password'/>" + "<input type='submit' value='Login By the Portlet'/>" + "<input type='submit' value='Login By Servlet'/>" + "</form>"); } } }
Example 14
Source File: AddlPortletTests_SPEC2_15_EventEventHandling_event.java From portals-pluto with Apache License 2.0 | 4 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails(); portletResp.setContentType("text/html"); PrintWriter writer = portletResp.getWriter(); writer.write("<h3>Event Companion Portlet </h3>\n"); writer.write("<p>AddlPortletTests_SPEC2_15_EventEventHandling_event</p>\n"); String msg = (String) portletReq.getPortletSession().getAttribute( RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_15_EventEventHandling_event", APPLICATION_SCOPE) + (String) portletReq.getPortletSession().getAttribute( RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_15_EventEventHandling", APPLICATION_SCOPE); msg = (msg.equals("nullnull")) ? "Not ready. click test case link." : msg; portletReq.getPortletSession().setAttribute( RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_15_EventEventHandling_event", null, APPLICATION_SCOPE); portletReq.getPortletSession().setAttribute( RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_15_EventEventHandling", null, APPLICATION_SCOPE); /* TestCase: V2AddlPortletTests_SPEC2_15_EventEventHandling_event15 */ /* Details: "If a portlet throws an exception in the processEvent */ /* method, all operations on the EventResponse must be ignored" */ TestResult tr7 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_15_EVENTEVENTHANDLING_EVENT15); String dataInEventResponse = (String) portletReq.getPortletSession().getAttribute( RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_15_EventEventHandling_exception", APPLICATION_SCOPE); if (dataInEventResponse != null && dataInEventResponse.equals("true") && portletReq.getParameter("tr7") == null) { tr7.setTcSuccess(true); } else { tr7.appendTcDetail("Failed because data is set in EventResponse: " + dataInEventResponse); } msg = msg + tr7.toString(); /* TestCase: V2AddlPortletTests_SPEC2_15_EventEventHandling_event16 */ /* Details: "If a portlet throws a permanent UnavailableException */ /* during event processing, the portlet container must remove the */ /* portlet from service immediately, call the portlet's destroy */ /* method, and release the portlet object" */ TestResult tr8 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_15_EVENTEVENTHANDLING_EVENT16); if (AddlPortletTests_SPEC2_15_EventEventHandling_event.tr8) { tr8.setTcSuccess(true); } else { tr8.appendTcDetail( "Failed because AddlPortletTests_SPEC2_15_EventEventHandling_unavailableException not destroyed"); } msg = msg + tr8.toString(); writer.write("<p>" + msg + "</p>\n"); }
Example 15
Source File: AddlPortletTests_SPEC2_5_EventHandling_event.java From portals-pluto with Apache License 2.0 | 4 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails(); portletResp.setContentType("text/html"); PrintWriter writer = portletResp.getWriter(); writer.write("<h3>Event Companion Portlet </h3>\n"); writer.write("<p>AddlPortletTests_SPEC2_5_EventHandling_event</p>\n"); /* TestCase: V2AddlPortletTests_SPEC2_5_EventHandling_exception4 */ /* Details: "If the portlet throws an PortletException in */ /* processEvent, all operations on the EventResponse, including set */ /* events, must be ignored" */ TestResult tr0 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_EVENTHANDLING_EXCEPTION4); String dataInEventResponse_tr0 = (String) portletReq.getPortletSession().getAttribute( RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_EventHandling_portletException", APPLICATION_SCOPE); if (dataInEventResponse_tr0 != null && dataInEventResponse_tr0.equals("true") && portletReq.getParameter("tr0") == null) { tr0.setTcSuccess(true); } else { tr0.appendTcDetail("Failed because data is set in EventResponse: " + dataInEventResponse_tr0); } String msg = tr0.toString(); /* TestCase: V2AddlPortletTests_SPEC2_5_EventHandling_exception5 */ /* Details: "If the portlet throws a RuntimeException in */ /* processEvent, all operations on the EventResponse, including set */ /* events, must be ignored" */ TestResult tr1 = tcd.getTestResultFailed(V2ADDLPORTLETTESTS_SPEC2_5_EVENTHANDLING_EXCEPTION5); String dataInEventResponse_tr1 = (String) portletReq.getPortletSession().getAttribute( RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_EventHandling_runtimeException", APPLICATION_SCOPE); if (dataInEventResponse_tr1 != null && dataInEventResponse_tr1.equals("true") && portletReq.getParameter("tr1") == null) { tr1.setTcSuccess(true); } else { tr1.appendTcDetail("Failed because data is set in EventResponse: " + dataInEventResponse_tr1); } msg = msg + tr1.toString(); writer.write("<p>" + msg + "</p>\n"); }
Example 16
Source File: AddlResponseTests_SPEC2_12_Event_event.java From portals-pluto with Apache License 2.0 | 4 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails(); portletResp.setContentType("text/html"); PrintWriter writer = portletResp.getWriter(); writer.write("<h3>Event Companion Portlet </h3>\n"); writer.write("<p>AddlResponseTests_SPEC2_12_Event_event</p>\n"); String msg = (String) portletReq.getPortletSession() .getAttribute(RESULT_ATTR_PREFIX + "AddlResponseTests_SPEC2_12_Event", APPLICATION_SCOPE); msg = (msg == null) ? "Not ready. click test case link." : msg; writer.write("<p>" + msg + "</p>\n"); if (portletReq.getParameter("tr0") != null && portletReq.getParameter("tr0").equals("true")) { Cookie[] cookies = portletReq.getCookies(); StringBuilder txt = new StringBuilder(128); txt.append("<p>Debug info:"); txt.append("<br>"); txt.append("# Cookies: ").append(cookies.length).append("<br>"); TestResult tr0 = tcd.getTestResultFailed(V2ADDLRESPONSETESTS_SPEC2_12_EVENT_COOKIE5); for (Cookie c : cookies) { txt.append("Name: ").append(c.getName()); txt.append(", Value: ").append(c.getValue()).append("<br>"); if (c.getName().equals("event_tr0_cookie") && c.getValue().equals("true")) { txt.append("<br>").append("Found my cookie!").append("<br>"); c.setMaxAge(0); c.setValue(""); tr0.setTcSuccess(true); } } tr0.writeTo(writer); txt.append("</p>"); writer.append(txt.toString()); } if (portletReq.getParameter("tr1") != null && portletReq.getParameter("tr1").equals("true")) { writer.write("<div id=\"AddlResponseTests_SPEC2_11_Event\">no resource output.</div>\n"); ResourceURL resurl = portletResp.createResourceURL(); resurl.setCacheability(PAGE); writer.write("<script>\n"); writer.write("(function () {\n"); writer.write(" var xhr = new XMLHttpRequest();\n"); writer.write(" xhr.onreadystatechange=function() {\n"); writer.write(" if (xhr.readyState==4 && xhr.status==200) {\n"); writer.write( " document.getElementById(\"AddlResponseTests_SPEC2_11_Event\").innerHTML=xhr.responseText;\n"); writer.write(" }\n"); writer.write(" };\n"); writer.write(" xhr.open(\"GET\",\"" + resurl.toString() + "\",true);\n"); writer.write(" xhr.send();\n"); writer.write("})();\n"); writer.write("</script>\n"); } }
Example 17
Source File: AddlEnvironmentTests_SPEC2_18_Sessions2.java From portals-pluto with Apache License 2.0 | 4 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(); JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails(); // Create result objects for the tests /* TestCase: V2AddlEnvironmentTests_SPEC2_18_Sessions_scope2 */ /* Details: "The portlet container must not share the PortletSession */ /* object or the attributes stored in it among different portlet */ /* applications or among different user sessions" */ TestResult tr1 = tcd.getTestResultFailed(V2ADDLENVIRONMENTTESTS_SPEC2_18_SESSIONS_SCOPE2); String tr1_success = (String) portletReq.getPortletSession().getAttribute(Constants.RESULT_ATTR_PREFIX + "AddlEnvironmentTests_SPEC2_18_Sessions_tr1", PORTLET_SCOPE); if (tr1_success == null) { tr1.setTcSuccess(true); } else { tr1.appendTcDetail("Failed becuase AddlEnvironmentTests_SPEC2_18_Sessions_tr1 is found " + "even though it was saved by another portlet in PORTLET_SCOPE"); } tr1.writeTo(writer); /* TestCase: V2AddlEnvironmentTests_SPEC2_18_Sessions_scope3 */ /* Details: "Any object stored in the session using the */ /* APPLICATION_SCOPE is available to any portlet that belongs to the */ /* same portlet application and that handles a request in the same */ /* session" */ { String tc = portletReq.getParameter(BUTTON_PARAM_NAME); if (tc != null && tc.equals(V2ADDLENVIRONMENTTESTS_SPEC2_18_SESSIONS_SCOPE3)) { TestResult tr2 = tcd.getTestResultFailed(V2ADDLENVIRONMENTTESTS_SPEC2_18_SESSIONS_SCOPE3); String val = (String) portletReq.getPortletSession().getAttribute(V2ADDLENVIRONMENTTESTS_SPEC2_18_SESSIONS_SCOPE3, APPLICATION_SCOPE); if (val != null && val.equals("true")) { tr2.setTcSuccess(true); } else { StringBuilder txt = new StringBuilder(128); txt.append("Failed, Attribute ").append(V2ADDLENVIRONMENTTESTS_SPEC2_18_SESSIONS_SCOPE3).append(" value: "); txt.append((val == null) ? "null" : val); tr2.appendTcDetail(txt.toString()); } tr2.writeTo(writer); } else { PortletURL rurl = portletResp.createRenderURL(); rurl.setParameter(BUTTON_PARAM_NAME, V2ADDLENVIRONMENTTESTS_SPEC2_18_SESSIONS_SCOPE3); TestLink link = new TestLink(V2ADDLENVIRONMENTTESTS_SPEC2_18_SESSIONS_SCOPE3, rurl); link.writeTo(writer); } } /* TestCase: V2AddlEnvironmentTests_SPEC2_18_Sessions_scope4 */ /* Details: "Any Object stored in the session using the PORTLET_SCOPE */ /* must be available to the portlet during requests for the same */ /* portlet window that stored the object" */ TestResult tr3 = tcd.getTestResultFailed(V2ADDLENVIRONMENTTESTS_SPEC2_18_SESSIONS_SCOPE4); String tr3_success = (String) portletReq.getPortletSession().getAttribute(Constants.RESULT_ATTR_PREFIX + "AddlEnvironmentTests_SPEC2_18_Sessions_tr3", PORTLET_SCOPE); if (tr3_success == null) { tr3.setTcSuccess(true); } else { tr3.appendTcDetail("Failed becuase AddlEnvironmentTests_SPEC2_18_Sessions_tr3 is found " + "even though it was saved by another portlet in PORTLET_SCOPE"); } tr3.writeTo(writer); /* TestCase: V2AddlEnvironmentTests_SPEC2_18_Sessions_httpSession5 */ /* Details: "If the PortletSession object is invalidated by a */ /* portlet, the portlet container must invalidate the associated */ /* HttpSession object" */ PortletRequestDispatcher rd = portletConfig.getPortletContext().getNamedDispatcher("AddlEnvironmentTests_SPEC2_18_Sessions_invalidate2"); rd.include(portletReq, portletResp); }
Example 18
Source File: AddlRequestTests_SPEC2_11_Render_parameter11.java From portals-pluto with Apache License 2.0 | 4 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails(); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); PrintWriter writer = portletResp.getWriter(); /* TestCase: V2AddlRequestTests_SPEC2_11_Render_parameters11 */ /* Details: "If a portlet receives a render request that is the */ /* result of a client request targeted to another portlet in the */ /* portal page, the parameters should be the same parameters as of */ /* the previous render request from this client" */ if (portletReq.getParameter("tr1") == null) { PortletURL rurl = portletResp.createRenderURL(); rurl.setParameters(portletReq.getPrivateParameterMap()); rurl.setParameter("tr1", "true"); TestSetupLink tb = new TestSetupLink(V2ADDLREQUESTTESTS_SPEC2_11_RENDER_PARAMETERS11, rurl); tb.writeTo(writer); } else { TestResult tr1 = tcd.getTestResultFailed(V2ADDLREQUESTTESTS_SPEC2_11_RENDER_PARAMETERS11); if (portletReq.getParameter("tr1_ready") != null && portletReq.getParameter("tr1_ready").equals("true")) { /* TestCase: V2AddlRequestTests_SPEC2_11_Render_parameters11 */ /* Details: "If a portlet receives a render request that is the */ /* result of a client request targeted to another portlet in the */ /* portal page, the parameters should be the same parameters as of */ /* the previous render request from this client" */ if (portletReq.getParameter("tr1") != null && portletReq.getParameter("tr1").equals("true")) { tr1.setTcSuccess(true); } else { tr1.appendTcDetail( "Test case failed as render parameter of this client didn't remain same after recieving render request from another portlet"); } } else { tr1.appendTcDetail( "Test case failed as public parameter tr1_ready is not set by V2AddlRequestTests_SPEC2_11_Render portlet"); } tr1.writeTo(writer); } }
Example 19
Source File: ComplexPortletApplicationContext.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse response) throws Exception { return new ModelAndView(request.getParameter("param")); }
Example 20
Source File: LookupDossierResult.java From opencps-v2 with GNU Affero General Public License v3.0 | 4 votes |
@Override public void render( RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); String portletId = portletDisplay.getId(); JSONObject urlObject = JSONFactoryUtil.createJSONObject(); JSONObject apiObject = JSONFactoryUtil.createJSONObject(); // url PortletURL dossierInfoURL = PortletURLFactoryUtil.create( renderRequest, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); dossierInfoURL.setPortletMode(PortletMode.VIEW); dossierInfoURL.setWindowState(LiferayWindowState.EXCLUSIVE); dossierInfoURL.setParameter( "mvcPath", "/templates/lookup_dossier/dossierinfo.ftl"); urlObject.put("dossierinfo", dossierInfoURL.toString()); // api apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2"); apiObject.put( "portletNamespace", themeDisplay.getPortletDisplay().getNamespace()); // get variable request String keyword = ParamUtil.getString(renderRequest, "keyword"); // set varible String secretKey = renderRequest.getParameter("secretKey"); renderRequest.setAttribute("secretKey", secretKey); renderRequest.setAttribute("ajax", urlObject); renderRequest.setAttribute("api", apiObject); renderRequest.setAttribute("keyword", keyword); super.render(renderRequest, renderResponse); }