当前位置: 首页>>代码示例>>Java>>正文


Java PortletRequestDispatcher.include方法代码示例

本文整理汇总了Java中javax.portlet.PortletRequestDispatcher.include方法的典型用法代码示例。如果您正苦于以下问题:Java PortletRequestDispatcher.include方法的具体用法?Java PortletRequestDispatcher.include怎么用?Java PortletRequestDispatcher.include使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.portlet.PortletRequestDispatcher的用法示例。


在下文中一共展示了PortletRequestDispatcher.include方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doServeResource

import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
@Override
protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
        throws Exception {
    
    String cmd = ParamUtil.getString(resourceRequest, Constants.CMD);

    PortletRequestDispatcher portletRequestDispatcher = null;

    if (cmd.equals(Constants.IMPORT)) {
        portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest, "/import/processes_list/view.jsp");
    } else {
        portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest,
                "/import/new_import/import_task_records_resources.jsp");
    }

    portletRequestDispatcher.include(resourceRequest, resourceResponse);
}
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:18,代码来源:ImportTaskRecordsMVCResourceCommand.java

示例2: doServeResource

import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
@Override
protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
        throws Exception {
    
    String cmd = ParamUtil.getString(resourceRequest, Constants.CMD);

    PortletRequestDispatcher portletRequestDispatcher = null;

    if (cmd.equals(Constants.IMPORT)) {
        portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest, "/import/processes_list/view.jsp");
    } else {
        portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest,
                "/import/new_import/import_contacts_resources.jsp");
    }

    portletRequestDispatcher.include(resourceRequest, resourceResponse);
}
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:18,代码来源:ImportContactsMVCResourceCommand.java

示例3: doServeResource

import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
@Override
    protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
            throws Exception {
        
//        _log.info("doServeResource()");

        String cmd = ParamUtil.getString(resourceRequest, Constants.CMD);

//        _log.info("cmd = " + cmd);

        PortletRequestDispatcher portletRequestDispatcher = null;

        if (cmd.equals(Constants.IMPORT)) {
            portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest, "/import/processes_list/view.jsp");
        } else {
            portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest,
                    "/import/new_import/import_measurements_resources.jsp");
        }

        portletRequestDispatcher.include(resourceRequest, resourceResponse);
    }
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:22,代码来源:ImportMeasurementsMVCResourceCommand.java

示例4: perform

import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
public void perform(TaskRequest req, TaskResponse res) {

		RenderRequest preq = (RenderRequest) request.evaluate(req, res);
		RenderResponse pres = (RenderResponse) response.evaluate(req, res);
		String rsc = (String) resource.evaluate(req, res);

		try {

			// Load the PortletRequest...
			for (String key : req.getAttributeNames()) {
				preq.setAttribute(key, req.getAttribute(key));
			}

			PortletRequestDispatcher prd = preq.getPortletSession(true).getPortletContext().getRequestDispatcher(rsc);
			prd.include(preq, pres);

		} catch (Throwable t) {
			String msg = "Error dispatching to the specified resource:  " + rsc;
			throw new RuntimeException(msg, t);
		}

	}
 
开发者ID:drewwills,项目名称:cernunnos,代码行数:23,代码来源:RequestDispatcherTask.java

示例5: serveResource

import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
@Override
public void serveResource(ResourceRequest portletReq, ResourceResponse portletResp)
      throws PortletException, IOException {

   long tid = Thread.currentThread().getId();
   portletReq.setAttribute(THREADID_ATTR, tid);

   // Prereq for: V2DispatcherReqRespTests4_SPEC2_19_IncludeServletResourceRequest_getAttribute
   portletReq.setAttribute(ATTR_PREFIX +"V2DispatcherReqRespTests4_SPEC2_19_IncludeServletResourceRequest_getAttribute", "Value1");

   // Prereq for: V2DispatcherReqRespTests4_SPEC2_19_IncludeServletResourceRequest_getAttributeNames
   portletReq.setAttribute(ATTR_PREFIX + "V2DispatcherReqRespTests4_SPEC2_19_IncludeServletResourceRequest_getAttributeNames", "Value1");

   // Now do the actual dispatch
   String target = SERVLET_PREFIX + "DispatcherReqRespTests4_SPEC2_19_IncludeServletResourceRequest_servlet" + SERVLET_SUFFIX + "?" + QUERY_STRING;
   PortletRequestDispatcher rd = portletConfig.getPortletContext()
         .getRequestDispatcher(target);
   rd.include(portletReq, portletResp);
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:20,代码来源:DispatcherReqRespTests4_SPEC2_19_IncludeServletResourceRequest.java

示例6: checkAddedSameNameParameter

import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
protected TestResult checkAddedSameNameParameter(PortletContext context,
                                                 PortletRequest request,
                                                 PortletResponse response)
throws IOException, PortletException {
	// Dispatch to the companion servlet: call checkAddedSameNameParameter().
	StringBuffer buffer = new StringBuffer();
	buffer.append(SERVLET_PATH).append("?")
			.append(KEY_TARGET).append("=").append(TARGET_ADDED_SAME_NAME_PARAM)
			.append("&").append(KEY_RENDER).append("=").append(VALUE_ADDED1)
			.append("&").append(KEY_RENDER).append("=").append(VALUE_ADDED2);

	if (LOG.isDebugEnabled()) {
		LOG.debug("Dispatching to: " + buffer.toString());
	}
	PortletRequestDispatcher dispatcher = context.getRequestDispatcher(
			buffer.toString());
	dispatcher.include((RenderRequest) request, (RenderResponse) response);

	// Retrieve test result returned by the companion servlet.
    TestResult result = (TestResult) request.getAttribute(RESULT_KEY);
	request.removeAttribute(RESULT_KEY);
	return result;
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:24,代码来源:DispatcherRenderParameterTest.java

示例7: serveResource

import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
@Override
public void serveResource(ResourceRequest portletReq, ResourceResponse portletResp) throws PortletException,
      IOException {

   long tid = Thread.currentThread().getId();
   portletReq.setAttribute(THREADID_ATTR, tid);

   portletResp.getWriter();

   // Multilevel forward / include
   portletReq.setAttribute(ATTR_DISPATCH_ACTION, "forward");
   String targ = SERVLET_PREFIX + "DispatcherTests5_SPEC2_19_IncThenForwardServletResource_servlet" + EXTRA_PATH
         + "?" + QUERY_STRING;
   portletReq.setAttribute(ATTR_DISPATCH_TARGET, targ);

   // Now do the actual dispatch
   String target = SERVLET_INCFWD + "?" + QUERY_STRING;
   PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
   rd.include(portletReq, portletResp);
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:21,代码来源:DispatcherTests5_SPEC2_19_IncThenForwardServletResource.java

示例8: processAction

import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
@Override
public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException {

   portletResp.setRenderParameters(portletReq.getParameterMap());
   long tid = Thread.currentThread().getId();
   portletReq.setAttribute(THREADID_ATTR, tid);

   new StringWriter();

   // Multilevel forward / include
   portletReq.setAttribute(ATTR_DISPATCH_ACTION, "forward");
   String targ = SERVLET_PREFIX + "DispatcherTests5_SPEC2_19_IncThenForwardServletAction_servlet" + EXTRA_PATH + "?"
         + QUERY_STRING;
   portletReq.setAttribute(ATTR_DISPATCH_TARGET, targ);

   // Now do the actual dispatch
   String target = SERVLET_INCFWD + "?" + QUERY_STRING;
   PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
   rd.include(portletReq, portletResp);
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:21,代码来源:DispatcherTests5_SPEC2_19_IncThenForwardServletAction.java

示例9: doDispatch

import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
/**
 * Perform a dispatch on the given PortletRequestDispatcher.
 * <p>The default implementation uses a forward for resource requests
 * and an include for render requests.
 * @param dispatcher the PortletRequestDispatcher to use
 * @param request current portlet render/resource request
 * @param response current portlet render/resource response
 * @throws Exception if there's a problem performing the dispatch
 */
protected void doDispatch(PortletRequestDispatcher dispatcher, PortletRequest request, MimeResponse response)
		throws Exception {

	// In general, we prefer a forward for resource responses, in order to have full Servlet API
	// support in the target resource (e.g. on uPortal). However, on Liferay, a resource forward
	// displays an empty page, so we have to resort to an include there...
	if (PortletRequest.RESOURCE_PHASE.equals(request.getAttribute(PortletRequest.LIFECYCLE_PHASE)) &&
			!dispatcher.getClass().getName().startsWith("com.liferay")) {
		dispatcher.forward(request, response);
	}
	else {
		dispatcher.include(request, response);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:24,代码来源:DispatcherPortlet.java

示例10: validateAccessToken

import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
protected AccessToken validateAccessToken(PortletRequest request, PortletResponse response, OAuthProvider oauthProvider,
        AccessToken accessToken) throws PortletException, IOException {
    AccessToken previousAccessToken = (AccessToken) request.getPortletSession().getAttribute(ATTRIBUTE_ACCESS_TOKEN);

    if (isValidationNeeded(accessToken, previousAccessToken)) {
        // Validate accessToken
        try {
            accessToken = getOAuthProvider().validateTokenAndUpdateScopes(accessToken);
        } catch (OAuthApiException oe) {
            String jspPage;
            if (oe.getExceptionCode() == OAuthApiExceptionCode.ACCESS_TOKEN_ERROR) {
                request.setAttribute(ATTRIBUTE_ERROR_MESSAGE, oauthProvider.getFriendlyName() + " access token is invalid.");
                request.setAttribute(ATTRIBUTE_OAUTH_PROVIDER, oauthProvider);
                jspPage = "/jsp/error/token.jsp";
            } else if (oe.getExceptionCode() == OAuthApiExceptionCode.IO_ERROR) {
                oe.printStackTrace();
                request.setAttribute(ATTRIBUTE_ERROR_MESSAGE, "I/O error happened. See server.log for more details");
                jspPage = "/jsp/error/error.jsp";
            } else {
                // Some unexpected error
                throw new PortletException(oe);
            }

            PortletRequestDispatcher prd = filterConfig.getPortletContext().getRequestDispatcher(jspPage);
            prd.include(request, response);
            return null;
        }

        if (!accessToken.equals(previousAccessToken)) {
            saveAccessToken(request, response, accessToken);
        }
    }

    return accessToken;
}
 
开发者ID:exo-samples,项目名称:docs-samples,代码行数:36,代码来源:OAuthPortletFilter.java

示例11: doView

import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
protected void doView(RenderRequest req, RenderResponse resp)
      throws PortletException, IOException {
   
   if (logger.isLoggable(Level.FINE)) {
      logger.logp(Level.FINE, this.getClass().getName(), "doView", "Entry");
   }
   
   resp.setContentType("text/html");
   req.setAttribute(ATTR_TITLE, getTitle(req));
   
   PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(
         "/WEB-INF/jsp/view-isp.jsp");
   rd.include(req, resp);

}
 
开发者ID:msnicklous,项目名称:SinglePageAppPortlets,代码行数:16,代码来源:ImageSelPortlet.java

示例12: include

import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
protected void include(String path, RenderRequest renderRequest,
		RenderResponse renderResponse) throws IOException, PortletException {

	PortletRequestDispatcher portletRequestDispatcher = getPortletContext()
			.getRequestDispatcher(path);

	if (portletRequestDispatcher == null) {
		// do nothing
		// _log.error(path + " is not a valid include");
	} else {
		portletRequestDispatcher.include(renderRequest, renderResponse);
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:14,代码来源:DeregisterAcademyMailPortlet.java

示例13: doView

import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
@Override
protected void doView(RenderRequest request, RenderResponse response) throws IOException, PortletException {
    AccessToken accessToken = getAccessToken();
    final FacebookClientWrapper facebookClient = new FacebookClientWrapper(request, response, getPortletContext(),
            getOAuthProvider(), accessToken.getAccessToken());

    User me = facebookClient.getMeWithDetails();

    if (me != null) {
        request.setAttribute("facebookUserInfo", me);
        PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/jsp/facebook/userinfo.jsp");
        prd.include(request, response);
    }
}
 
开发者ID:exo-samples,项目名称:docs-samples,代码行数:15,代码来源:FacebookUserInfoPortlet.java

示例14: sendToJSP

import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
private void sendToJSP(RenderRequest request, RenderResponse response,
		String jspPage) throws PortletException {
	response.setContentType(request.getResponseContentType());
	if (jspPage != null && jspPage.length() != 0) {
		try {
			PortletRequestDispatcher dispatcher = pContext
				.getRequestDispatcher(jspPage);
			dispatcher.include(request, response);
		} catch (IOException e) {
			throw new PortletException("Sakai Dispatch unabble to use "
					+ jspPage, e);
		}
	}
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:15,代码来源:IMSBLTIPortlet.java

示例15: include

import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
protected void include(String path, RenderRequest renderRequest,
		RenderResponse renderResponse) throws IOException, PortletException {

	PortletRequestDispatcher portletRequestDispatcher = getPortletContext()
			.getRequestDispatcher(path);

	if (portletRequestDispatcher == null) {
	} else {
		portletRequestDispatcher.include(renderRequest, renderResponse);
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:12,代码来源:About.java


注:本文中的javax.portlet.PortletRequestDispatcher.include方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。