@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { _log.info("render()"); try { TaskRecord taskRecord = ActionUtil.getTaskRecord(renderRequest); renderRequest.setAttribute(TimetrackerWebKeys.TASK_RECORD, taskRecord); } catch (Exception e) { if (e instanceof NoSuchTaskRecordException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass()); return "/error.jsp"; } else { throw new PortletException(e); } } return getPath(); }
/** * Routes between global configuration editing and tab editing * * @param request The request * @param response The response * @throws PortletException If something goes wrong * @throws IOException If something goes wrong */ @Override protected void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException { // Very, very simple routing. That's all we need, folks. String editModeParam = ParamUtil.get(request, PortletRequestParameter.EDIT_MODE.getName(), StringPool.BLANK); EditMode editMode = EditMode.getEditMode(editModeParam); switch(editMode) { case TAB: this.doEditTab(request, response); break; case FACET: this.doEditFacet(request, response); break; default: this.doEditGlobal(request, response); break; } }
/** * Renders an ADT. * * @param request the request * @param response the response * @param templateCtx the template context * @param templateUUID the UUID of the ADT (DDMTemplate object/table) to render * @throws TemplateNotFoundException if no template having such UUID could be found * @throws CouldNotRenderTemplateException if the template could not be rendered */ public void renderADT(RenderRequest request, RenderResponse response, Map<String, Object> templateCtx, String templateUUID) throws CouldNotRenderTemplateException, TemplateNotFoundException { HttpServletRequest httpServletRequest = this.portal.getHttpServletRequest(request); HttpServletResponse httpServletResponse = this.portal.getHttpServletResponse(response); ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); long companyId = themeDisplay.getCompanyId(); try { List<DDMTemplate> ddmTemplates = this.getDDMTemplateLocalService().getDDMTemplatesByUuidAndCompanyId(templateUUID, companyId); if (ddmTemplates.isEmpty()) { throw new TemplateNotFoundException("No ADT found with companyId ["+companyId+"] and UUID ["+templateUUID+"]"); } String renderedTemplate = this.getPortletDisplayTemplate().renderDDMTemplate(httpServletRequest, httpServletResponse, ddmTemplates.get(0), Collections.emptyList(), templateCtx); response.getWriter().write(renderedTemplate); } catch (Exception e) { throw new CouldNotRenderTemplateException("Could not render from ADT [" + templateUUID + "]", e); } }
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { _log.info("render()"); try { Contact contact = ActionUtil.getContact(renderRequest); renderRequest.setAttribute(ContactManagerWebKeys.CONTACT, contact); } catch (Exception e) { if (e instanceof NoSuchContactException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass()); return "/error.jsp"; } else { throw new PortletException(e); } } return getPath(); }
private JSONObject generateURLJsonObject(RenderResponse renderResponse) throws WindowStateException { JSONObject urlObject = JSONFactoryUtil.createJSONObject(); PortletURL customerRegistrationsDetail = renderResponse.createRenderURL(); customerRegistrationsDetail.setWindowState(LiferayWindowState.EXCLUSIVE); customerRegistrationsDetail.setParameter( "mvcPath", "/templates/registrations_detail.ftl"); urlObject.put("registrations_detail", customerRegistrationsDetail); PortletURL customerRegistrationsMenu = renderResponse.createRenderURL(); customerRegistrationsMenu.setWindowState(LiferayWindowState.EXCLUSIVE); customerRegistrationsMenu.setParameter( "mvcPath", "/templates/registrations_menu.ftl"); urlObject.put("registrations_menu", customerRegistrationsMenu); return urlObject; }
private void renderFromMobilink( RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { renderFrontendWebEmployeePortlet(renderRequest, renderResponse); renderFrontendWebJobposPortlet(renderRequest, renderResponse); renderFrontendWebAdminPortlet(renderRequest, renderResponse); renderFrontendWebWorkingUnitPortlet(renderRequest, renderResponse); renderFrontendWebNotificationPortlet(renderRequest, renderResponse); renderRequest.setAttribute( "url", generateURLCommon(renderRequest, renderResponse)); renderRequest.setAttribute("constants", generalConstantsCommon(renderRequest)); renderRequest.setAttribute("param", generalParamsCommon(renderRequest)); }
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { // Get Mode String mode = ParamUtil.getString( renderRequest, LDFPortletKeys.MODE, LDFPortletKeys.MODE_ORGANIZAION); // Carry around mode renderRequest.setAttribute(LDFPortletKeys.MODE, mode); if(_log.isDebugEnabled()) { _log.debug("mode <" + mode + ">"); _log.debug("jsp <" + _commonUtil .getPageFromMode() .getOrDefault(mode, LDFPortletKeys.JSP_ORGANIZAION) + ">"); } return _commonUtil .getPageFromMode() .getOrDefault(mode, LDFPortletKeys.JSP_ORGANIZAION); }
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { _log.info("render()"); try { Measurement measurement = ActionUtil.getMeasurement(renderRequest); renderRequest.setAttribute(DataManagerWebKeys.MEASUREMENT, measurement); } catch (Exception e) { if (e instanceof NoSuchMeasurementException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass()); return "/error.jsp"; } else { throw new PortletException(e); } } return getPath(); }
private String determineDefaultPhase(Method handlerMethod) { if (void.class != handlerMethod.getReturnType()) { return PortletRequest.RENDER_PHASE; } for (Class<?> argType : handlerMethod.getParameterTypes()) { if (ActionRequest.class.isAssignableFrom(argType) || ActionResponse.class.isAssignableFrom(argType) || InputStream.class.isAssignableFrom(argType) || Reader.class.isAssignableFrom(argType)) { return PortletRequest.ACTION_PHASE; } else if (RenderRequest.class.isAssignableFrom(argType) || RenderResponse.class.isAssignableFrom(argType) || OutputStream.class.isAssignableFrom(argType) || Writer.class.isAssignableFrom(argType)) { return PortletRequest.RENDER_PHASE; } else if (ResourceRequest.class.isAssignableFrom(argType) || ResourceResponse.class.isAssignableFrom(argType)) { return PortletRequest.RESOURCE_PHASE; } else if (EventRequest.class.isAssignableFrom(argType) || EventResponse.class.isAssignableFrom(argType)) { return PortletRequest.EVENT_PHASE; } } return ""; }
/** * Determine an error ModelAndView via the registered HandlerExceptionResolvers. * @param request current portlet request * @param response current portlet response * @param handler the executed handler, or null if none chosen at the time of * the exception (for example, if multipart resolution failed) * @param ex the exception that got thrown during handler execution * @return a corresponding ModelAndView to forward to * @throws Exception if no error ModelAndView found */ protected ModelAndView processHandlerException( RenderRequest request, RenderResponse response, Object handler, Exception ex) throws Exception { ModelAndView exMv = null; for (Iterator<HandlerExceptionResolver> it = this.handlerExceptionResolvers.iterator(); exMv == null && it.hasNext();) { HandlerExceptionResolver resolver = it.next(); exMv = resolver.resolveException(request, response, handler, ex); } if (exMv != null) { if (logger.isDebugEnabled()) { logger.debug("HandlerExceptionResolver returned ModelAndView [" + exMv + "] for exception"); } logger.warn("Handler execution resulted in exception - forwarding to resolved error view", ex); return exMv; } else { throw ex; } }
/** * Trigger afterCompletion callbacks on the mapped HandlerInterceptors. * Will just invoke afterCompletion for all interceptors whose preHandle * invocation has successfully completed and returned true. * @param mappedHandler the mapped HandlerExecutionChain * @param interceptorIndex index of last interceptor that successfully completed * @param ex Exception thrown on handler execution, or null if none * @see HandlerInterceptor#afterRenderCompletion */ private void triggerAfterRenderCompletion(HandlerExecutionChain mappedHandler, int interceptorIndex, RenderRequest request, RenderResponse response, Exception ex) throws Exception { // Apply afterCompletion methods of registered interceptors. if (mappedHandler != null) { HandlerInterceptor[] interceptors = mappedHandler.getInterceptors(); if (interceptors != null) { for (int i = interceptorIndex; i >= 0; i--) { HandlerInterceptor interceptor = interceptors[i]; try { interceptor.afterRenderCompletion(request, response, mappedHandler.getHandler(), ex); } catch (Throwable ex2) { logger.error("HandlerInterceptor.afterCompletion threw exception", ex2); } } } } }
@Test public void testNativeRequest() { MockRenderRequest portletRequest = new MockRenderRequest(); MockRenderResponse portletResponse = new MockRenderResponse(); PortletWebRequest request = new PortletWebRequest(portletRequest, portletResponse); assertSame(portletRequest, request.getNativeRequest()); assertSame(portletRequest, request.getNativeRequest(PortletRequest.class)); assertSame(portletRequest, request.getNativeRequest(RenderRequest.class)); assertSame(portletRequest, request.getNativeRequest(MockRenderRequest.class)); assertNull(request.getNativeRequest(MultipartRequest.class)); assertSame(portletResponse, request.getNativeResponse()); assertSame(portletResponse, request.getNativeResponse(PortletResponse.class)); assertSame(portletResponse, request.getNativeResponse(RenderResponse.class)); assertSame(portletResponse, request.getNativeResponse(MockRenderResponse.class)); assertNull(request.getNativeResponse(MultipartRequest.class)); }
/** * Routes between search results and single asset view * * @param request The request * @param response The response * @throws PortletException If something goes wrong * @throws IOException If something goes wrong */ @Override protected void doView(RenderRequest request, RenderResponse response) throws IOException, PortletException { String viewModeParam = ParamUtil.getString(request, PortletRequestParameter.VIEW_MODE.getName(), StringPool.BLANK); ViewMode viewMode = ViewMode.getViewMode(viewModeParam); switch(viewMode) { case VIEW_JOURNAL: this.doViewJournal(request, response); break; default: this.doViewResults(request, response); break; } }
@Override protected void doHelp(RenderRequest request, RenderResponse response) throws PortletException, IOException { String lang = request.getLocale().getLanguage(); String templatePath; if(HELP_TEMPLATES.containsKey(lang)) { templatePath = HELP_TEMPLATES.get(lang); } else { templatePath = HELP_TEMPLATES.get(StringPool.BLANK); } Map<String, Object> ctx = Collections.singletonMap("ns", response.getNamespace()); this.renderTemplate(request, response, ctx, templatePath); }
/** * Renders the given template * * @param request The request * @param response The response * @param ctx The template context * @param templatePath The path of the template, relative to the templates path given in the init parameters * * @throws PortletException Thrown if there is an error during template processing * @throws IOException Thrown if there is an error while writing the response */ public void renderTemplate(RenderRequest request, RenderResponse response, Map<String, Object> ctx, String templatePath) throws PortletException, IOException { PortletContext portletCtx = this.getPortletContext(); String templateResourcePath = String.format(TEMPLATE_PATH_FORMAT, portletCtx.getPortletContextName(), this.templatesPath, templatePath); if(this.templateResourceLoader.hasTemplateResource(templateResourcePath)) { try { this.writeTemplate(request, response, ctx, templateResourcePath); } catch(TemplateException e) { throw new PortletException(e); } } else { throw new TemplateNotFoundException(templateResourcePath); } }
/** * Writes the template's rendering in the portlet response * * @param request The request * @param response The response * @param ctx The template context * @param templateResourcePath The template to write * * @throws IOException Thrown if something goes wrong when writing the response * @throws TemplateException Thrown if something goes wrong when processing the template */ private void writeTemplate(RenderRequest request, RenderResponse response, Map<String, Object> ctx, String templateResourcePath) throws TemplateException, IOException { TemplateResource templateResource = this.templateResourceLoader.getTemplateResource(templateResourcePath); Template template = this.templateManager.getTemplate(templateResource, false); this.templateManager.addTaglibSupport(template, this.portal.getHttpServletRequest(request), this.portal.getHttpServletResponse(response)); this.enrichTemplateContext(request, response, template); Set<Entry<String, Object>> contextObjects = ctx.entrySet(); for(Entry<String, Object> obj : contextObjects) { template.put(obj.getKey(), obj.getValue()); } template.processTemplate(response.getWriter()); }
/** * Puts commonly used variables in the template context * @param request The request * @param response The response * @param template The template */ private void enrichTemplateContext(RenderRequest request, RenderResponse response, Template template) { template.put(TemplateVariable.LOCALE.getVariableName(), request.getLocale()); template.put(TemplateVariable.PORTLET_CONTEXT.getVariableName(), this.getPortletContext()); template.put(TemplateVariable.REQUEST.getVariableName(), request); template.put(TemplateVariable.RESPONSE.getVariableName(), response); template.put(TemplateVariable.THEME_DISPLAY.getVariableName(), request.getAttribute(WebKeys.THEME_DISPLAY)); template.put(TemplateVariable.USER_INFO.getVariableName(), request.getAttribute(PortletRequest.USER_INFO)); }
@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()); // set varible renderRequest.setAttribute("ajax", urlObject); renderRequest.setAttribute("api", apiObject); super.render(renderRequest, renderResponse); }
@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); }
@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); }
@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 serviceInfoLookupURL = PortletURLFactoryUtil.create( renderRequest, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); serviceInfoLookupURL.setPortletMode(PortletMode.VIEW); serviceInfoLookupURL.setWindowState(LiferayWindowState.EXCLUSIVE); serviceInfoLookupURL.setParameter( "mvcPath", "/templates/homepage/serviceinfo_lookup.ftl"); urlObject.put("serviceinfo_lookup", serviceInfoLookupURL.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); }
@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 dossierLookupURL = PortletURLFactoryUtil.create( renderRequest, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); dossierLookupURL.setPortletMode(PortletMode.VIEW); dossierLookupURL.setWindowState(LiferayWindowState.EXCLUSIVE); dossierLookupURL.setParameter( "mvcPath", "/templates/homepage/dossier_lookup.ftl"); urlObject.put("dossier_lookup", dossierLookupURL.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); }
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 dossierLookupURL = PortletURLFactoryUtil.create(renderRequest, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); dossierLookupURL.setPortletMode(PortletMode.VIEW); dossierLookupURL.setWindowState(LiferayWindowState.EXCLUSIVE); dossierLookupURL.setParameter("mvcPath", "/templates/homepage/search_serviceinfo.ftl"); urlObject.put("dossier_lookup", dossierLookupURL.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); }
@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 dossierLookupURL = PortletURLFactoryUtil.create(renderRequest, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); dossierLookupURL.setPortletMode(PortletMode.VIEW); dossierLookupURL.setWindowState(LiferayWindowState.EXCLUSIVE); dossierLookupURL.setParameter("mvcPath", "/templates/homepage/dossier_lookup.ftl"); urlObject.put("dossier_lookup", dossierLookupURL.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); }
@Override protected void doView( RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { PrintWriter printWriter = renderResponse.getWriter(); printWriter.print("opencps-lang Portlet - Hello World!"); }
@Override public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { renderRequest.setAttribute(DummyFactoryConfiguration.class.getName(), _dummyFactoryConfiguration); super.doView(renderRequest, renderResponse); }
@Override protected void doDispatch( RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { renderRequest.setAttribute(DummyFactoryConfiguration.class.getName(), _dummyFactoryConfiguration); super.doDispatch(renderRequest, renderResponse); }
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>"); }
@Override protected void doView(RenderRequest request, RenderResponse response) throws IOException, PortletException { PrintWriter printWriter = response.getWriter(); printWriter.print("Blueprint Portlet - Hello World!"); }
@Override protected ModelAndView handleRenderRequestInternal( RenderRequest request, RenderResponse response) throws Exception { this.portletInstance.render(request, response); return null; }
@Override public Header createHeader(RenderRequest renderRequest, RenderResponse renderResponse) { // Username final String username = getUsername(renderRequest); // PreferencesMap final Map<String,List<String>> preferencesMap = new HashMap<>(); final PortletPreferences prefs = renderRequest.getPreferences(); for (Map.Entry<String,String[]> y : prefs.getMap().entrySet()) { final String name = y.getKey(); /* * We ignore (skip) preferences that exist for the benefit of the * SoffitConnectorController. */ if (name.startsWith(SoffitConnectorController.CONNECTOR_PREFERENCE_PREFIX)) { continue; } List<String> values = Arrays.asList(prefs.getValues(name, new String[0])); if (!values.isEmpty()) { preferencesMap.put(name, values); } } // Preferences header final Preferences preferences = preferencesService.createPreferences(preferencesMap, username, getExpiration(renderRequest)); final Header rslt = new BasicHeader( Headers.PREFERECES.getName(), preferences.getEncryptedToken()); logger.debug("Produced the following Preferences header for username='{}': {}", username, rslt); return rslt; }
@Override public String render( RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { return "/render.jsp"; }
@Override protected void doView(RenderRequest request, RenderResponse response) throws IOException, PortletException { PrintWriter printWriter = response.getWriter(); printWriter.print("OSGi API Portlet - Hello World!"); }
/** * Checks whether this resolver is supposed to apply (i.e. the handler * matches in case of "mappedHandlers" having been specified), then * delegates to the {@link #doResolveException} template method. */ @Override public ModelAndView resolveException(RenderRequest request, RenderResponse response, Object handler, Exception ex) { if (shouldApplyTo(request, handler)) { return doResolveException(request, response, handler, ex); } else { return null; } }
@Override public void doView( RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { if (_log.isDebugEnabled()) { _log.debug("Blade Message Portlet render"); } renderRequest.setAttribute( MessageDisplayConfiguration.class.getName(), _messageDisplayConfiguration); super.doView(renderRequest, renderResponse); }
@Override protected void doView(RenderRequest request, RenderResponse response) throws IOException, PortletException { PrintWriter printWriter = response.getWriter(); String fileName = request.getParameter("fileName"); String mimeType = request.getParameter("mimeType"); String version = request.getParameter("version"); String statusLabel = request.getParameter("statusLabel"); String createdDate = request.getParameter("createdDate"); String createdUserName = request.getParameter("createdUserName"); printWriter.print( "<span style=\"color:green\">File Name</span>:" + fileName + "<br/>"); printWriter.print( "<span style=\"color:green\">Type</span>:" + mimeType + "<br/>"); printWriter.print( "<span style=\"color:green\">Version</span>:" + version + "<br/>"); printWriter.print( "<span style=\"color:green\">Status</span>:" + statusLabel + "<br/>"); printWriter.print( "<span style=\"color:green\">Created Date</span>:" + createdDate + "<br/>"); printWriter.print( "<span style=\"color:green\">Created User Name</span>:" + createdUserName + "<br/>"); }
@Override public void postHandleRender( RenderRequest request, RenderResponse response, Object handler, ModelAndView modelAndView) throws Exception { this.requestInterceptor.postHandle(new PortletWebRequest(request), (modelAndView != null && !modelAndView.wasCleared() ? modelAndView.getModelMap() : null)); }
/** * Delegate render requests to processRequest/doRenderService. */ @Override protected final void doDispatch(RenderRequest request, RenderResponse response) throws PortletException, IOException { processRequest(request, response); }
@Override public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse response) throws PortletException, IOException { if (!Locale.CANADA.equals(request.getLocale())) { throw new PortletException("Incorrect Locale in RenderRequest"); } response.getWriter().write("locale-ok"); return null; }