Java Code Examples for javax.portlet.RenderResponse#createActionURL()
The following examples show how to use
javax.portlet.RenderResponse#createActionURL() .
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: PortletUrlBuilder.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
public String getActionUrl(HttpServletRequest aHttpServletRequest, Map parameters) { logger.debug("IN"); RenderResponse renderResponse =(RenderResponse)aHttpServletRequest.getAttribute("javax.portlet.response"); PortletURL aPortletURL = renderResponse.createActionURL(); if (parameters != null){ Iterator keysIt = parameters.keySet().iterator(); String paramName = null; Object paramValue = null; while (keysIt.hasNext()){ paramName = (String)keysIt.next(); paramValue = parameters.get(paramName); if (paramValue == null) { logger.warn("Parameter with name " + paramName + " has null value. This parameter will be not considered."); continue; } aPortletURL.setParameter(paramName, paramValue.toString()); } } String url = aPortletURL.toString(); logger.debug("OUT"); return url; }
Example 2
Source File: DispatcherTests4_SPEC2_19_ForwardJSPEvent.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(); /* TestCase: V2DispatcherTests4_SPEC2_19_ForwardJSPEvent_invoke3 */ /* Details: "Parameters to the forward method for a target servlet */ /* can be wrapped request and response classes from the portlet */ /* lifecyle method initiating the include" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton(V2DISPATCHERTESTS4_SPEC2_19_FORWARDJSPEVENT_INVOKE3, aurl); tb.writeTo(writer); } }
Example 3
Source File: AddlPortletTests_SPEC2_15_Event.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(); /* TestCase: V2AddlPortletTests_SPEC2_15_Event_event1 */ /* Details: "Event names are defined in the deployment descriptor" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton(V2ADDLPORTLETTESTS_SPEC2_15_EVENT_EVENT1, aurl); tb.writeTo(writer); } }
Example 4
Source File: DispatcherTests3S_SPEC2_19_ForwardServletEvent.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(); /* TestCase: V2DispatcherTests3S_SPEC2_19_ForwardServletEvent_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_FORWARDSERVLETEVENT_DISPATCH4, aurl); tb.writeTo(writer); } }
Example 5
Source File: AnnotationPortletAppConfigOverrideTests_SPEC1_28_EventConfiguration1.java From portals-pluto with Apache License 2.0 | 6 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { PrintWriter writer = portletResp.getWriter(); ModuleTestCaseDetails tcd = new ModuleTestCaseDetails(); RenderParameters renderParams = portletReq.getRenderParameters(); /* TestCase: V3AnnotationPortletAppConfigOverrideTests_SPEC1_28_EventConfiguration1_declaringEvents3 */ /* Details: "Same event declared in @PortletApplication and deployment * descriptor portlet.xml is overridden by deployment descriptor" */ if(renderParams.getValue("tr0")!=null && renderParams.getValue("tr0").equals("true")){ TestResult result = tcd.getTestResultFailed(V3ANNOTATIONPORTLETAPPCONFIGOVERRIDETESTS_SPEC1_28_EVENTCONFIGURATION1_DECLARINGEVENTS3); result.setTcSuccess(true); result.writeTo(writer); } else { ActionURL aurl = portletResp.createActionURL(); TestButton tb = new TestButton( V3ANNOTATIONPORTLETAPPCONFIGOVERRIDETESTS_SPEC1_28_EVENTCONFIGURATION1_DECLARINGEVENTS3, aurl); tb.writeTo(writer); } }
Example 6
Source File: AnnotationPortletAppConfigOverrideTests_SPEC1_28_EventConfiguration2.java From portals-pluto with Apache License 2.0 | 6 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { PrintWriter writer = portletResp.getWriter(); ModuleTestCaseDetails tcd = new ModuleTestCaseDetails(); RenderParameters renderParams = portletReq.getRenderParameters(); /* TestCase: V3AnnotationPortletAppConfigOverrideTests_SPEC1_28_EventConfiguration2_declaringEvents4 */ /* Details: "The portlet container merges the events declared in the */ /* @PortletApplication annotation and deployment descriptor portlet.xml" */ if(renderParams.getValue("tr0_a")!=null && renderParams.getValue("tr0_a").equals("true") && renderParams.getValue("tr0_b")!=null && renderParams.getValue("tr0_b").equals("true")){ TestResult result = tcd.getTestResultFailed(V3ANNOTATIONPORTLETAPPCONFIGOVERRIDETESTS_SPEC1_28_EVENTCONFIGURATION2_DECLARINGEVENTS4); result.setTcSuccess(true); result.writeTo(writer); } else { ActionURL aurl = portletResp.createActionURL(); TestButton tb = new TestButton( V3ANNOTATIONPORTLETAPPCONFIGOVERRIDETESTS_SPEC1_28_EVENTCONFIGURATION2_DECLARINGEVENTS4, aurl); tb.writeTo(writer); } }
Example 7
Source File: AnnotationPortletConfigTests_SPEC2_28_EventDeclaration.java From portals-pluto with Apache License 2.0 | 6 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { PrintWriter writer = portletResp.getWriter(); ModuleTestCaseDetails tcd = new ModuleTestCaseDetails(); RenderParameters renderParams = portletReq.getRenderParameters(); /* TestCase: V3AnnotationPortletConfigTests_SPEC2_28_EventDeclaration_eventEventDeclaration1 */ /* Details: "An event can be fired from another event method configured with */ /* @EventMethod annotation - publishingEvents attribute." */ if(renderParams.getValue("tr0")!=null && renderParams.getValue("tr0").equals("true")){ TestResult result = tcd.getTestResultFailed(V3ANNOTATIONPORTLETCONFIGTESTS_SPEC2_28_EVENTDECLARATION_EVENTEVENTDECLARATION1); result.setTcSuccess(true); result.writeTo(writer); } else { ActionURL aurl = portletResp.createActionURL(); TestButton tb = new TestButton( V3ANNOTATIONPORTLETCONFIGTESTS_SPEC2_28_EVENTDECLARATION_EVENTEVENTDECLARATION1, aurl); tb.writeTo(writer); } }
Example 8
Source File: DispatcherTests3S_SPEC2_19_ForwardJSPEvent.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(); /* TestCase: V2DispatcherTests3S_SPEC2_19_ForwardJSPEvent_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_FORWARDJSPEVENT_DISPATCH4, aurl); tb.writeTo(writer); } }
Example 9
Source File: PortletTests_EventPortlet_ApiEvent.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(); /* TestCase: V2PortletTests_EventPortlet_ApiEvent_processEvent */ /* Details: "Method processEvent(EventRequest, EventResponse): is */ /* called when an event is targeted to the portlet" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameters(portletReq.getPrivateParameterMap()); TestButton tb = new TestButton( V2PORTLETTESTS_EVENTPORTLET_APIEVENT_PROCESSEVENT, aurl); tb.writeTo(writer); } }
Example 10
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 11
Source File: DispatcherTests3S_SPEC2_19_IncludeServletEvent.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(); /* TestCase: V2DispatcherTests3S_SPEC2_19_IncludeServletEvent_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_INCLUDESERVLETEVENT_DISPATCH4, aurl); tb.writeTo(writer); } }
Example 12
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 13
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 14
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 15
Source File: AnnotationPortletAppConfigOverrideTests_SPEC1_28_PublicRenderParameters2.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { PrintWriter writer = portletResp.getWriter(); ModuleTestCaseDetails tcd = new ModuleTestCaseDetails(); RenderParameters renderParams = portletReq.getRenderParameters(); /* TestCase: V3AnnotationPortletAppConfigOverrideTests_SPEC1_28_PublicRenderParameters2_declaringPRP3 */ /* Details: "A public render parameters declared using @PortletApplication */ /* annotation in one portlet and deployment descriptor portlet.xml in another */ /* portlet can be shared with each other." */ if(renderParams.isPublic("tr2_public") && renderParams.getValue("tr2_public")!=null && renderParams.getValue("tr2_public").equals("true")){ TestResult result = tcd.getTestResultFailed(V3ANNOTATIONPORTLETAPPCONFIGOVERRIDETESTS_SPEC1_28_PUBLICRENDERPARAMETERS2_DECLARINGPRP3); result.setTcSuccess(true); result.writeTo(writer); } else { ActionURL aurl = portletResp.createActionURL(); TestButton tb = new TestButton( V3ANNOTATIONPORTLETAPPCONFIGOVERRIDETESTS_SPEC1_28_PUBLICRENDERPARAMETERS2_DECLARINGPRP3, aurl); tb.writeTo(writer); } }
Example 16
Source File: AnnotationTests_ProcessAction_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 + "AnnotationTests_ProcessAction_ApiAction", APPLICATION_SCOPE); if (msg != null) { writer.write("<p>" + msg + "</p><br/>\n"); ps.removeAttribute(RESULT_ATTR_PREFIX + "AnnotationTests_ProcessAction_ApiAction", APPLICATION_SCOPE); } /* TestCase: V2AnnotationTests_ProcessAction_ApiAction_name */ /* Details: "Method name(): On an action request, the method is */ /* executed if the parameter \"javax.portlet.action\" matches the */ /* name field" */ { PortletURL aurl = portletResp.createActionURL(); aurl.setParameter(ActionRequest.ACTION_NAME, V2ANNOTATIONTESTS_PROCESSACTION_APIACTION_NAME); TestButton tb = new TestButton(V2ANNOTATIONTESTS_PROCESSACTION_APIACTION_NAME, aurl); tb.writeTo(writer); } }
Example 17
Source File: SakaiIFrame.java From sakai with Educational Community License v2.0 | 4 votes |
public void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String title = getTitleString(request); if ( title != null ) response.setTitle(title); Context context = new VelocityContext(); context.put("tlang", rb); context.put("validator", formattedText); sendAlert(request,context); PortletURL url = response.createActionURL(); context.put("actionUrl", url.toString()); context.put("doCancel", "sakai.cancel"); context.put("doUpdate", "sakai.update"); // get current site Placement placement = ToolManager.getCurrentPlacement(); String siteId = ""; // find the right LTIContent object for this page String source = placement.getPlacementConfig().getProperty(SOURCE); Long key = getContentIdFromSource(source); if ( key == null ) { out.println(rb.getString("get.info.notconfig")); log.warn("Cannot find content id placement={} source={}", placement.getId(), source); return; } Map<String, Object> content = m_ltiService.getContent(key, placement.getContext()); if ( content == null ) { out.println(rb.getString("get.info.notconfig")); log.warn("Cannot find content item placement={} key={}", placement.getId(), key); return; } // attach the ltiToolId to each model attribute, so that we could have the tool configuration page for multiple tools String foundLtiToolId = content.get(m_ltiService.LTI_TOOL_ID).toString(); Map<String, Object> tool = m_ltiService.getTool(Long.valueOf(foundLtiToolId), placement.getContext()); if ( tool == null ) { out.println(rb.getString("get.info.notconfig")); log.warn("Cannot find tool placement={} key={}", placement.getId(), foundLtiToolId); return; } String[] contentToolModel = m_ltiService.getContentModelIfConfigurable(Long.valueOf(foundLtiToolId), placement.getContext()); if (contentToolModel != null) { String formInput = m_ltiService.formInput(content, contentToolModel); context.put("formInput", formInput); } else { String noCustomizations = rb.getString("gen.info.nocustom"); context.put("noCustomizations", noCustomizations); } vHelper.doTemplate(vengine, "/vm/edit.vm", context, out); }
Example 18
Source File: RedirectPortlet.java From portals-pluto with Apache License 2.0 | 3 votes |
protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, IOException { resp.setContentType("text/html"); // provide an action URL to the JSP as a workaround, since the tag library is still JSR 286 ActionURL aurl = resp.createActionURL(ALL); req.setAttribute(ATTRIB_ACTURL, aurl.toString()); PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/view-rdp.jsp"); rd.include(req, resp); }
Example 19
Source File: UserRenderController.java From portals-pluto with Apache License 2.0 | 3 votes |
@RenderMethod(portletNames = {"portlet1"}) @ValidateOnExecution(type = ExecutableType.NONE) public String prepareView(RenderRequest renderRequest, RenderResponse renderResponse) { String viewName = viewEngineContext.getView(); if (viewName == null) { viewName = "user.jspx"; User user = (User) models.get("user"); if (user == null) { user = new User(); models.put("user", user); } ActionURL actionURL = renderResponse.createActionURL(); MutableActionParameters actionParameters = actionURL.getActionParameters(); actionParameters.setValue(ActionRequest.ACTION_NAME, "submitUser"); models.put("submitUserActionURL", actionURL.toString()); } logger.debug("[RENDER_PHASE] prepared model for viewName: {}", viewName); return viewName; }
Example 20
Source File: PortletUtilities.java From Knowage-Server with GNU Affero General Public License v3.0 | 3 votes |
/** * Starting from the original URL and the request, creates a string representing the * Portlet URL. * * @param aHttpServletRequest The request object at input * @param originalURL The starting original URL * * @return A String representing the Portlet URL */ public static String createPortletURL(HttpServletRequest aHttpServletRequest, String originalURL){ RenderResponse renderResponse =(RenderResponse)aHttpServletRequest.getAttribute("javax.portlet.response"); PortletURL aPortletURL = renderResponse.createActionURL(); logger.debug("Original URL.... " + originalURL + "indexOf ? is " + originalURL.indexOf("?")); String parameters = originalURL.substring(originalURL.indexOf("?")+1); StringTokenizer st = new StringTokenizer(parameters, "&", false); String parameterToken = null; String parameterName = null; String parameterValue = null; while (st.hasMoreTokens()){ parameterToken = st.nextToken(); logger.debug("Parameter Token [" + parameterToken +"]"); parameterName = parameterToken.substring(0, parameterToken.indexOf("=")); parameterValue = parameterToken.substring(parameterToken.indexOf("=") + 1); logger.debug("Parameter Name [" + parameterName +"]"); logger.debug("Parameter Value [" + parameterValue +"]"); aPortletURL.setParameter(parameterName, parameterValue); } return aPortletURL.toString(); }