Java Code Examples for javax.portlet.RenderRequest#getAttribute()
The following examples show how to use
javax.portlet.RenderRequest#getAttribute() .
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: ComplexPortletApplicationContext.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public void postHandleRender( RenderRequest request, RenderResponse response, Object handler, ModelAndView modelAndView) throws PortletException { if ("true".equals(request.getParameter("noView"))) { modelAndView.clear(); } if (request.getAttribute("test1-remove-post") == null) { throw new PortletException("Wrong interceptor order"); } if (!"test2-remove-post".equals(request.getAttribute("test2-remove-post"))) { throw new PortletException("Incorrect request attribute"); } request.removeAttribute("test2-remove-post"); }
Example 2
Source File: HeaderPortletTests_SPEC14_RenderState_ApiHeader.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException { PrintWriter writer = renderResponse.getWriter(); String msg = (String) renderRequest.getAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC14_RenderState_ApiHeader"); writer.write("<p>" + msg + "</p>\n"); renderRequest.removeAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC14_RenderState_ApiHeader"); }
Example 3
Source File: HeaderPortletTests_SPEC14_HeaderReq.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException { PrintWriter writer = renderResponse.getWriter(); String msg = (String) renderRequest.getAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC14_HeaderReq"); writer.write("<p>" + msg + "</p>\n"); renderRequest.removeAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC14_HeaderReq"); }
Example 4
Source File: HeaderPortletTests_SPEC14_PortletRequest_ApiHeader2.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException { PrintWriter writer = renderResponse.getWriter(); String msg = (String) renderRequest.getAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC14_PortletRequest_ApiHeader2"); writer.write("<p>" + msg + "</p>\n"); renderRequest.removeAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC14_PortletRequest_ApiHeader2"); }
Example 5
Source File: HeaderPortletTests_SPEC3_6_4_HeaderPortlet.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException { PrintWriter writer = renderResponse.getWriter(); ModuleTestCaseDetails tcd = new ModuleTestCaseDetails(); /* TestCase: V3HeaderPortletTests_SPEC3_6_4_HeaderPortlet_renderHeaders */ /* * Details: "renderHeaders() method is called before render() method if * the portlet implements HeaderPortlet interface." */ { TestResult result = tcd.getTestResultFailed( V3HEADERPORTLETTESTS_SPEC3_6_4_HEADERPORTLET_RENDERHEADERS); result.setTcSuccess(tr0_success); result.writeTo(writer); tr0_success = false; } String msg = (String) renderRequest.getAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC3_6_4_HeaderPortlet"); writer.write("<p>" + msg + "</p>\n"); renderRequest.removeAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC3_6_4_HeaderPortlet"); }
Example 6
Source File: HeaderPortletTests_SPEC14_HeaderAttr.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException { PrintWriter writer = renderResponse.getWriter(); String msg = (String) renderRequest.getAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC14_HeaderAttr"); writer.write("<p>" + msg + "</p>\n"); renderRequest.removeAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC14_HeaderAttr"); }
Example 7
Source File: HeaderPortletTests_SPEC7_14_RenderRequest.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException { PrintWriter writer = renderResponse.getWriter(); String msg = (String) renderRequest.getAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC7_14_RenderRequest"); writer.write("<p>" + msg + "</p>\n"); renderRequest.removeAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC7_14_RenderRequest"); }
Example 8
Source File: ComplexPortletApplicationContext.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public void afterRenderCompletion( RenderRequest request, RenderResponse response, Object handler, Exception ex) throws Exception { if (request.getAttribute("test1-remove-after") == null) { throw new PortletException("Wrong interceptor order"); } request.removeAttribute("test2-remove-after"); }
Example 9
Source File: ComplexPortletApplicationContext.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public boolean preHandleRender(RenderRequest request, RenderResponse response, Object handler) throws PortletException { if (request.getAttribute("test1-remove-post") == null) { throw new PortletException("Wrong interceptor order"); } if ("true".equals(request.getParameter("abort"))) { return false; } request.setAttribute("test2-remove-never", "test2-remove-never"); request.setAttribute("test2-remove-post", "test2-remove-post"); request.setAttribute("test2-remove-after", "test2-remove-after"); return true; }
Example 10
Source File: ComplexPortletApplicationContext.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public void afterRenderCompletion( RenderRequest request, RenderResponse response, Object handler, Exception ex) throws PortletException { if (request.getAttribute("test2-remove-after") != null) { throw new PortletException("Wrong interceptor order"); } request.removeAttribute("test1-remove-after"); }
Example 11
Source File: ComplexPortletApplicationContext.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public void postHandleRender( RenderRequest request, RenderResponse response, Object handler, ModelAndView modelAndView) throws PortletException { if (request.getAttribute("test2-remove-post") != null) { throw new PortletException("Wrong interceptor order"); } if (!"test1-remove-post".equals(request.getAttribute("test1-remove-post"))) { throw new PortletException("Incorrect request attribute"); } request.removeAttribute("test1-remove-post"); }
Example 12
Source File: ComplexPortletApplicationContext.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public boolean preHandleRender(RenderRequest request, RenderResponse response, Object handler) throws PortletException { if (request.getAttribute("test2-remove-never") != null) { throw new PortletException("Wrong interceptor order"); } request.setAttribute("test1-remove-never", "test1-remove-never"); request.setAttribute("test1-remove-post", "test1-remove-post"); request.setAttribute("test1-remove-after", "test1-remove-after"); return true; }
Example 13
Source File: ConfirmAccountPortlet.java From opencps-v2 with GNU Affero General Public License v3.0 | 5 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 registerResultURL = PortletURLFactoryUtil.create( renderRequest, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); registerResultURL.setPortletMode(PortletMode.VIEW); registerResultURL.setWindowState(LiferayWindowState.EXCLUSIVE); registerResultURL.setParameter( "mvcPath", "/templates/applicant/register_result.ftl"); urlObject.put("register_result", registerResultURL.toString()); // api apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2"); apiObject.put( "portletNamespace", themeDisplay.getPortletDisplay().getNamespace()); // set varible renderRequest.setAttribute("ajax", urlObject); renderRequest.setAttribute("api", apiObject); super.render(renderRequest, renderResponse); }
Example 14
Source File: HeaderPortletTests_SPEC15_PortletResponse_ApiHeader.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException { PrintWriter writer = renderResponse.getWriter(); String msg = (String) renderRequest.getAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC15_PortletResponse_ApiHeader"); writer.write("<p>" + msg + "</p>"); renderRequest.removeAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC15_PortletResponse_ApiHeader"); /* TestCase: V3HeaderPortletTests_SPEC15_PortletResponse_ApiHeader_addPropertyB1 */ /* Details: "Method addProperty(String, org.w3c.dom.Element): Adds an XML DOM */ /* Element to the response for the specified key" */ writer.write("<script type='text/javascript'>"); writer.write("document.addEventListener('DOMContentLoaded', function(event) {"); writer.write(" var scriptTag = document.getElementsByClassName('testProperty1');"); writer.write(" if(scriptTag.length){"); writer.write(" document.getElementById('V3HeaderPortletTests_SPEC15_PortletResponse_ApiHeader_addPropertyB1-result').innerHTML = 'Test Succeeded';"); writer.write(" }"); writer.write("});"); writer.write("</script>"); /* TestCase: V3HeaderPortletTests_SPEC15_PortletResponse_ApiHeader_addPropertyB2 */ /* Details: "Method addProperty(String, org.w3c.dom.Element): If a DOM */ /* Element for the specified key already exists, the new element is added in */ /* addition to the existing element" */ writer.write("<script type='text/javascript'>"); writer.write("document.addEventListener('DOMContentLoaded', function(event) {"); writer.write(" var scriptTag = document.getElementsByClassName('testProperty2');"); writer.write(" if(scriptTag.length){"); writer.write(" document.getElementById('V3HeaderPortletTests_SPEC15_PortletResponse_ApiHeader_addPropertyB2-result').innerHTML = 'Test Succeeded';"); writer.write(" }"); writer.write("});"); writer.write("</script>"); }
Example 15
Source File: ForgottenAccount.java From opencps-v2 with GNU Affero General Public License v3.0 | 5 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 confirmPasswordURL = PortletURLFactoryUtil.create( renderRequest, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); confirmPasswordURL.setPortletMode(PortletMode.VIEW); confirmPasswordURL.setWindowState(LiferayWindowState.EXCLUSIVE); confirmPasswordURL.setParameter( "mvcPath", "/templates/applicant/confirm_password.ftl"); urlObject.put("confirm_password", confirmPasswordURL.toString()); // api apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2"); apiObject.put( "portletNamespace", themeDisplay.getPortletDisplay().getNamespace()); // set varible renderRequest.setAttribute("ajax", urlObject); renderRequest.setAttribute("api", apiObject); super.render(renderRequest, renderResponse); }
Example 16
Source File: AddlRequestTests_SPEC2_11_RenderAttr.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: V2AddlRequestTests_SPEC2_11_RenderAttr_attributes1 */ /* Details: "The portlet can access a map with user information */ /* attributes via the request attribute PortletRequest.USER_INFO" */ TestResult tr0 = tcd.getTestResultFailed(V2ADDLREQUESTTESTS_SPEC2_11_RENDERATTR_ATTRIBUTES1); if (portletReq.getAttribute(PortletRequest.USER_INFO) != null) { tr0.setTcSuccess(true); } tr0.writeTo(writer); /* TestCase: V2AddlRequestTests_SPEC2_11_RenderAttr_attributes2 */ /* Details: "The PortletRequest.CCPP_PROFILE request attribute must */ /* return a javax.ccpp.Profile based on the current portlet request" */ TestResult tr1 = tcd.getTestResultFailed(V2ADDLREQUESTTESTS_SPEC2_11_RENDERATTR_ATTRIBUTES2); if (portletReq.getAttribute(PortletRequest.CCPP_PROFILE) != null) { tr1.setTcSuccess(true); } tr1.writeTo(writer); /* TestCase: V2AddlRequestTests_SPEC2_11_RenderAttr_attributes8 */ /* Details: "During render processing, the LIFECYCLE_PHASE */ /* (\"javax.portlet.lifecycle_phase\") attribute will contain the */ /* string \"RENDER_PHASE\"" */ TestResult tr5 = tcd.getTestResultFailed(V2ADDLREQUESTTESTS_SPEC2_11_RENDERATTR_ATTRIBUTES8); if (portletReq.getAttribute(PortletRequest.LIFECYCLE_PHASE) != null && portletReq.getAttribute(PortletRequest.LIFECYCLE_PHASE).equals("RENDER_PHASE")) { tr5.setTcSuccess(true); } tr5.writeTo(writer); }
Example 17
Source File: HeaderPortletTests_SPEC15_HeaderResponse1.java From portals-pluto with Apache License 2.0 | 4 votes |
@Override public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException { PrintWriter writer = renderResponse.getWriter(); String msg = (String) renderRequest.getAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC15_HeaderResponse1"); writer.write("<p>" + msg + "</p>\n"); renderRequest.removeAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC15_HeaderResponse1"); /* TestCase: V3HeaderPortletTests_SPEC15_HeaderResponse_getWriter */ /* Details: "Data written to the HeaderResponse writer is added to the */ /* aggregated portal document HEAD section." */ writer.write("<script type='text/javascript'>"); writer.write("document.addEventListener('DOMContentLoaded', function(event) {"); writer.write(" var jQueryTag = document.getElementsByClassName('jquery-tag');"); writer.write(" if(jQueryTag.length){"); writer.write(" document.getElementById('V3HeaderPortletTests_SPEC15_HeaderResponse_getWriter-result').innerHTML = 'Test Succeeded';"); writer.write(" }"); writer.write("});"); writer.write("</script>"); /* TestCase: V3HeaderPortletTests_SPEC15_HeaderResponse_addDependency7 */ /* Details: "Method addDependency(String name, String scope, String version, */ /* String markup) - Adds a dependency on a page-level resource that is */ /* managed by the portal and adds a resource for addition to the page for the */ /* dependency." */ writer.write("<script type='text/javascript'>"); writer.write("document.addEventListener('DOMContentLoaded', function(event) {"); writer.write(" var dependencyTag = document.getElementsByClassName('dependency-test');"); writer.write(" if(dependencyTag.length){"); writer.write(" document.getElementById('V3HeaderPortletTests_SPEC15_HeaderResponse_addDependency7-result').innerHTML= 'Test Succeeded';"); writer.write(" }"); writer.write("});"); writer.write("</script>"); /* TestCase: V3HeaderPortletTests_SPEC15_HeaderResponse_addDependency8 */ /* Details: "Method addDependency(String name, String scope, String version, */ /* String markup) - The portal may choose to include the later version of the */ /* resource on the page if 2 same dependencies with different version are */ /* declared." */ writer.write("<script type='text/javascript'>"); writer.write("document.addEventListener('DOMContentLoaded', function(event) {"); writer.write(" var dependencyTag2_1 = document.getElementsByClassName('dependency-test2-1');"); writer.write(" var dependencyTag2_2 = document.getElementsByClassName('dependency-test2-2');"); writer.write(" if(dependencyTag2_1.length==0 && dependencyTag2_2.length>0){"); writer.write(" document.getElementById('V3HeaderPortletTests_SPEC15_HeaderResponse_addDependency8-result').innerHTML= 'Test Succeeded';"); writer.write(" }"); writer.write("});"); writer.write("</script>"); /* TestCase: V3HeaderPortletTests_SPEC15_HeaderResponse_addDependency2 */ /* Details: "Method addDependency(String name, String scope, String version) */ /* - The dependency added by this method can be shared with other portlets." */ writer.write("<script type='text/javascript'>"); writer.write("document.addEventListener('DOMContentLoaded', function(event) {"); writer.write(" if (typeof window.portlet != 'undefined') { "); writer.write(" document.getElementById('V3HeaderPortletTests_SPEC15_HeaderResponse_addDependency2-result').innerHTML= 'Test Succeeded';"); writer.write(" }"); writer.write("});"); writer.write("</script>"); }
Example 18
Source File: HeaderPortletTests_SPEC15_Header.java From portals-pluto with Apache License 2.0 | 4 votes |
@Override public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException { ModuleTestCaseDetails tcd = new ModuleTestCaseDetails(); PrintWriter writer = renderResponse.getWriter(); /* TestCase: V3HeaderPortletTests_SPEC15_Header_cookie8 */ /* * Details: "Cookies set during the Header phase should be available to * the portlet during the Resource phase" */ writer.write( "<div id=\"V3HeaderPortletTests_SPEC15_Header\">no resource output.</div>\n"); ResourceURL resurl = renderResponse.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(\"V3HeaderPortletTests_SPEC15_Header\").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"); /* TestCase: V3HeaderPortletTests_SPEC15_Header_cookie10 */ /* * Details: "Cookies set during the Header phase should be available to * the portlet during a subsequent Render phase" */ Cookie[] cookies = renderRequest.getCookies(); StringBuilder txt = new StringBuilder(128); txt.append("<p>Debug info:"); txt.append("<br>"); txt.append("# Cookies: ").append(cookies.length).append("<br>"); TestResult tr2 = tcd .getTestResultFailed(V3HEADERPORTLETTESTS_SPEC15_HEADER_COOKIE10); for (Cookie c : cookies) { txt.append("Name: ").append(c.getName()); txt.append(", Value: ").append(c.getValue()).append("<br>"); if (c.getName().equals("header_tr2_cookie") && c.getValue().equals("true")) { txt.append("<br>").append("Found my cookie!").append("<br>"); c.setMaxAge(0); c.setValue(""); tr2.setTcSuccess(true); } } tr2.writeTo(writer); txt.append("</p>"); writer.append(txt.toString()); String msg = (String) renderRequest.getAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC15_Header"); writer.write("<p>" + msg + "</p>"); renderRequest.removeAttribute( RESULT_ATTR_PREFIX + "HeaderPortletTests_SPEC15_Header"); }
Example 19
Source File: AddlRequestTests_SPEC2_11_RenderAttr_RenderHeaders.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(); Object renderPartAttribute = portletReq.getAttribute(PortletRequest.RENDER_PART); boolean streamingPortal = (renderPartAttribute != null); /* TestCase: V2AddlRequestTests_SPEC2_11_RenderAttr_attributes3 */ /* Details: "If the portlet container runtime option */ /* javax.portlet.renderHeaders is set to TRUE, the RENDER_PART */ /* attribute will be set when the render method is called" */ TestResult tr2 = tcd.getTestResultFailed(V2ADDLREQUESTTESTS_SPEC2_11_RENDERATTR_ATTRIBUTES3); if (!streamingPortal || "RENDER_MARKUP".equals(renderPartAttribute)) { tr2.setTcSuccess(true); if (!streamingPortal) { tr2.setTcDetail(NON_STREAMING_BUFFERED_PORTAL_DETECTED); } tr2.writeTo(writer); } /* TestCase: V2AddlRequestTests_SPEC2_11_RenderAttr_attributes4 */ /* Details: "If the portlet container runtime option */ /* javax.portlet.renderHeaders is set to TRUE, render method will be */ /* called first with the RENDER_PART attribute set to */ /* \"RENDER_HEADERS\"" */ TestResult tr3 = tcd.getTestResultFailed(V2ADDLREQUESTTESTS_SPEC2_11_RENDERATTR_ATTRIBUTES4); if (streamingPortal) { if ("RENDER_HEADERS".equals(renderPartAttribute)) { successTr3 = true; } else if ("RENDER_MARKUP".equals(renderPartAttribute)) { tr3.setTcSuccess(successTr3); tr3.writeTo(writer); } } else { tr3.setTcSuccess(true); tr3.setTcDetail(NON_STREAMING_BUFFERED_PORTAL_DETECTED); tr3.writeTo(writer); } /* TestCase: V2AddlRequestTests_SPEC2_11_RenderAttr_attributes5 */ /* Details: "If the portlet container runtime option */ /* javax.portlet.renderHeaders is set to TRUE, render method will be */ /* called a second time with the RENDER_PART attribute set to */ /* \"RENDER_MARKUP\"" */ TestResult tr4 = tcd.getTestResultFailed(V2ADDLREQUESTTESTS_SPEC2_11_RENDERATTR_ATTRIBUTES5); if (!streamingPortal || "RENDER_MARKUP".equals(renderPartAttribute)) { tr4.setTcSuccess(true); if (!streamingPortal) { tr4.setTcDetail(NON_STREAMING_BUFFERED_PORTAL_DETECTED); } tr4.writeTo(writer); } }
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); }