當前位置: 首頁>>代碼示例>>Java>>正文


Java RenderResponse類代碼示例

本文整理匯總了Java中javax.portlet.RenderResponse的典型用法代碼示例。如果您正苦於以下問題:Java RenderResponse類的具體用法?Java RenderResponse怎麽用?Java RenderResponse使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RenderResponse類屬於javax.portlet包,在下文中一共展示了RenderResponse類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: render

import javax.portlet.RenderResponse; //導入依賴的package包/類
@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();
}
 
開發者ID:inofix,項目名稱:ch-inofix-timetracker,代碼行數:24,代碼來源:GetTaskRecordMVCRenderCommand.java

示例2: doEdit

import javax.portlet.RenderResponse; //導入依賴的package包/類
/**
 * 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;
    }

}
 
開發者ID:savoirfairelinux,項目名稱:flashlight-search,代碼行數:28,代碼來源:FlashlightSearchPortlet.java

示例3: renderADT

import javax.portlet.RenderResponse; //導入依賴的package包/類
/**
 * 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);
    }
}
 
開發者ID:savoirfairelinux,項目名稱:flashlight-search,代碼行數:28,代碼來源:TemplatedPortlet.java

示例4: render

import javax.portlet.RenderResponse; //導入依賴的package包/類
@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();
}
 
開發者ID:inofix,項目名稱:ch-inofix-contact-manager,代碼行數:24,代碼來源:GetContactMVCRenderCommand.java

示例5: generateURLJsonObject

import javax.portlet.RenderResponse; //導入依賴的package包/類
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;
}
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:22,代碼來源:FrontendWebRegisterPortlet.java

示例6: renderFromMobilink

import javax.portlet.RenderResponse; //導入依賴的package包/類
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));
}
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:18,代碼來源:AdminPortlet.java

示例7: render

import javax.portlet.RenderResponse; //導入依賴的package包/類
@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);
}
 
開發者ID:yasuflatland-lf,項目名稱:liferay-dummy-factory,代碼行數:24,代碼來源:CommonMVCRenderCommand.java

示例8: render

import javax.portlet.RenderResponse; //導入依賴的package包/類
@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();
}
 
開發者ID:inofix,項目名稱:ch-inofix-data-manager,代碼行數:24,代碼來源:GetMeasurementMVCRenderCommand.java

示例9: determineDefaultPhase

import javax.portlet.RenderResponse; //導入依賴的package包/類
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 "";
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:23,代碼來源:AnnotationMethodHandlerAdapter.java

示例10: processHandlerException

import javax.portlet.RenderResponse; //導入依賴的package包/類
/**
 * 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;
    }
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:31,代碼來源:DispatcherPortlet.java

示例11: triggerAfterRenderCompletion

import javax.portlet.RenderResponse; //導入依賴的package包/類
/**
 * 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);
                }
            }
        }
    }
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:30,代碼來源:DispatcherPortlet.java

示例12: testNativeRequest

import javax.portlet.RenderResponse; //導入依賴的package包/類
@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));
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:17,代碼來源:PortletWebRequestTests.java

示例13: doView

import javax.portlet.RenderResponse; //導入依賴的package包/類
/**
 * 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;
    }
}
 
開發者ID:savoirfairelinux,項目名稱:flashlight-search,代碼行數:22,代碼來源:FlashlightSearchPortlet.java

示例14: doHelp

import javax.portlet.RenderResponse; //導入依賴的package包/類
@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);
}
 
開發者ID:savoirfairelinux,項目名稱:flashlight-search,代碼行數:15,代碼來源:FlashlightSearchPortlet.java

示例15: renderTemplate

import javax.portlet.RenderResponse; //導入依賴的package包/類
/**
 * 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);
    }
}
 
開發者ID:savoirfairelinux,項目名稱:flashlight-search,代碼行數:26,代碼來源:TemplatedPortlet.java


注:本文中的javax.portlet.RenderResponse類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。