本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}