本文整理汇总了Java中javax.portlet.PortletRequestDispatcher.forward方法的典型用法代码示例。如果您正苦于以下问题:Java PortletRequestDispatcher.forward方法的具体用法?Java PortletRequestDispatcher.forward怎么用?Java PortletRequestDispatcher.forward使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.portlet.PortletRequestDispatcher
的用法示例。
在下文中一共展示了PortletRequestDispatcher.forward方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serveResource
import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
/**
* Serve the resource as specified in the given request to the given response,
* using the PortletContext's request dispatcher.
* <p>This is roughly equivalent to Portlet 2.0 GenericPortlet.
* @param request the current resource request
* @param response the current resource response
* @param context the current Portlet's PortletContext
* @throws PortletException propagated from Portlet API's forward method
* @throws IOException propagated from Portlet API's forward method
*/
public static void serveResource(ResourceRequest request, ResourceResponse response, PortletContext context)
throws PortletException, IOException {
String id = request.getResourceID();
if (id != null) {
if (!PortletUtils.isProtectedResource(id)) {
PortletRequestDispatcher rd = context.getRequestDispatcher(id);
if (rd != null) {
rd.forward(request, response);
return;
}
}
response.setProperty(ResourceResponse.HTTP_STATUS_CODE, "404");
}
}
示例2: 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: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletResourceRequest_getAttribute
portletReq.setAttribute(ATTR_PREFIX +"V2DispatcherReqRespTests2_SPEC2_19_ForwardServletResourceRequest_getAttribute", "Value1");
// Prereq for: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletResourceRequest_getAttributeNames
portletReq.setAttribute(ATTR_PREFIX + "V2DispatcherReqRespTests2_SPEC2_19_ForwardServletResourceRequest_getAttributeNames", "Value1");
// Now do the actual dispatch
String target = SERVLET_PREFIX + "DispatcherReqRespTests2_SPEC2_19_ForwardServletResourceRequest_servlet" + SERVLET_SUFFIX + "?" + QUERY_STRING;
PortletRequestDispatcher rd = portletConfig.getPortletContext()
.getRequestDispatcher(target);
rd.forward(portletReq, portletResp);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:20,代码来源:DispatcherReqRespTests2_SPEC2_19_ForwardServletResourceRequest.java
示例3: 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: V2DispatcherReqRespTests1_SPEC2_19_ForwardJSPResourceRequest_getAttribute
portletReq.setAttribute(ATTR_PREFIX +"V2DispatcherReqRespTests1_SPEC2_19_ForwardJSPResourceRequest_getAttribute", "Value1");
// Prereq for: V2DispatcherReqRespTests1_SPEC2_19_ForwardJSPResourceRequest_getAttributeNames
portletReq.setAttribute(ATTR_PREFIX + "V2DispatcherReqRespTests1_SPEC2_19_ForwardJSPResourceRequest_getAttributeNames", "Value1");
// Now do the actual dispatch
String target = JSP_PREFIX + "DispatcherReqRespTests1_SPEC2_19_ForwardJSPResourceRequest" + JSP_SUFFIX + "?" + QUERY_STRING;
PortletRequestDispatcher rd = portletConfig.getPortletContext()
.getRequestDispatcher(target);
rd.forward(portletReq, portletResp);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:20,代码来源:DispatcherReqRespTests1_SPEC2_19_ForwardJSPResourceRequest.java
示例4: 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);
// Prereq for: V2DispatcherReqRespTests1_SPEC2_19_ForwardJSPActionRequest_getAttribute
portletReq.setAttribute(ATTR_PREFIX +"V2DispatcherReqRespTests1_SPEC2_19_ForwardJSPActionRequest_getAttribute", "Value1");
// Prereq for: V2DispatcherReqRespTests1_SPEC2_19_ForwardJSPActionRequest_getAttributeNames
portletReq.setAttribute(ATTR_PREFIX + "V2DispatcherReqRespTests1_SPEC2_19_ForwardJSPActionRequest_getAttributeNames", "Value1");
// Now do the actual dispatch
String target = JSP_PREFIX + "DispatcherReqRespTests1_SPEC2_19_ForwardJSPActionRequest" + JSP_SUFFIX + "?" + QUERY_STRING;
PortletRequestDispatcher rd = portletConfig.getPortletContext()
.getRequestDispatcher(target);
rd.forward(portletReq, portletResp);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:22,代码来源:DispatcherReqRespTests1_SPEC2_19_ForwardJSPActionRequest.java
示例5: 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);
// Prereq for: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getAttribute
portletReq.setAttribute(ATTR_PREFIX +"V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getAttribute", "Value1");
// Prereq for: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getAttributeNames
portletReq.setAttribute(ATTR_PREFIX + "V2DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_getAttributeNames", "Value1");
// Now do the actual dispatch
String target = SERVLET_PREFIX + "DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest_servlet" + SERVLET_SUFFIX + "?" + QUERY_STRING;
PortletRequestDispatcher rd = portletConfig.getPortletContext()
.getRequestDispatcher(target);
rd.forward(portletReq, portletResp);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:21,代码来源:DispatcherReqRespTests2_SPEC2_19_ForwardServletActionRequest.java
示例6: render
import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
@Override
public void render(RenderRequest portletReq, RenderResponse portletResp)
throws PortletException, IOException {
long tid = Thread.currentThread().getId();
portletReq.setAttribute(THREADID_ATTR, tid);
// Prereq for: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_getAttribute
portletReq.setAttribute(ATTR_PREFIX +"V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_getAttribute", "Value1");
// Prereq for: V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_getAttributeNames
portletReq.setAttribute(ATTR_PREFIX + "V2DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_getAttributeNames", "Value1");
// Now do the actual dispatch
String target = SERVLET_PREFIX + "DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest_servlet" + SERVLET_SUFFIX + "?" + QUERY_STRING;
PortletRequestDispatcher rd = portletConfig.getPortletContext()
.getRequestDispatcher(target);
rd.forward(portletReq, portletResp);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:20,代码来源:DispatcherReqRespTests2_SPEC2_19_ForwardServletRenderRequest.java
示例7: render
import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
@Override
public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException {
long tid = Thread.currentThread().getId();
portletReq.setAttribute(THREADID_ATTR, tid);
portletResp.getWriter();
// Multilevel forward / include
portletReq.setAttribute(ATTR_DISPATCH_ACTION, "include");
String targ = SERVLET_PREFIX + "DispatcherTests6_SPEC2_19_FwdThenIncludeServletRender_servlet" + EXTRA_PATH + "?"
+ QUERY_STRING;
portletReq.setAttribute(ATTR_DISPATCH_TARGET, targ);
// Now do the actual dispatch
String target = "/IncluderForwarderServlet" + "?" + QUERY_STRING;
PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
rd.forward(portletReq, portletResp);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:20,代码来源:DispatcherTests6_SPEC2_19_FwdThenIncludeServletRender.java
示例8: 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 + "DispatcherTests6_SPEC2_19_FwdThenForwardServletResource_servlet" + EXTRA_PATH
+ "?" + QUERY_STRING;
portletReq.setAttribute(ATTR_DISPATCH_TARGET, targ);
// Now do the actual dispatch
String target = "/IncluderForwarderServlet" + "?" + QUERY_STRING;
PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
rd.forward(portletReq, portletResp);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:21,代码来源:DispatcherTests6_SPEC2_19_FwdThenForwardServletResource.java
示例9: 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, "include");
String targ = SERVLET_PREFIX + "DispatcherTests6_SPEC2_19_FwdThenIncludeServletResource_servlet" + EXTRA_PATH
+ "?" + QUERY_STRING;
portletReq.setAttribute(ATTR_DISPATCH_TARGET, targ);
// Now do the actual dispatch
String target = "/IncluderForwarderServlet" + "?" + QUERY_STRING;
PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
rd.forward(portletReq, portletResp);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:21,代码来源:DispatcherTests6_SPEC2_19_FwdThenIncludeServletResource.java
示例10: processEvent
import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
@Override
public void processEvent(EventRequest portletReq, EventResponse portletResp) throws PortletException, IOException {
portletResp.setRenderParameters(portletReq);
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 + "DispatcherTests6_SPEC2_19_FwdThenForwardServletEvent_servlet" + EXTRA_PATH + "?"
+ QUERY_STRING;
portletReq.setAttribute(ATTR_DISPATCH_TARGET, targ);
// Now do the actual dispatch
String target = "/IncluderForwarderServlet" + "?" + QUERY_STRING;
PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
rd.forward(portletReq, portletResp);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:23,代码来源:DispatcherTests6_SPEC2_19_FwdThenForwardServletEvent_event.java
示例11: 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, "include");
String targ = SERVLET_PREFIX + "DispatcherTests6_SPEC2_19_FwdThenIncludeServletAction_servlet" + EXTRA_PATH + "?"
+ QUERY_STRING;
portletReq.setAttribute(ATTR_DISPATCH_TARGET, targ);
// Now do the actual dispatch
String target = "/IncluderForwarderServlet" + "?" + QUERY_STRING;
PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
rd.forward(portletReq, portletResp);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:21,代码来源:DispatcherTests6_SPEC2_19_FwdThenIncludeServletAction.java
示例12: render
import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
@Override
public void render(RenderRequest portletReq, RenderResponse 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 + "DispatcherTests6_SPEC2_19_FwdThenForwardServletRender_servlet" + EXTRA_PATH + "?"
+ QUERY_STRING;
portletReq.setAttribute(ATTR_DISPATCH_TARGET, targ);
// Now do the actual dispatch
String target = "/IncluderForwarderServlet" + "?" + QUERY_STRING;
PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
rd.forward(portletReq, portletResp);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:20,代码来源:DispatcherTests6_SPEC2_19_FwdThenForwardServletRender.java
示例13: processEvent
import javax.portlet.PortletRequestDispatcher; //导入方法依赖的package包/类
@Override
public void processEvent(EventRequest portletReq, EventResponse portletResp) throws PortletException, IOException {
portletResp.setRenderParameters(portletReq);
long tid = Thread.currentThread().getId();
portletReq.setAttribute(THREADID_ATTR, tid);
new StringWriter();
// Prereq for: V2DispatcherTests4_SPEC2_19_ForwardServletEvent_invoke3
portletReq = new EventRequestWrapper(portletReq);
portletResp = new EventResponseWrapper(portletResp);
// Now do the actual dispatch
String target = SERVLET_PREFIX + "DispatcherTests4_SPEC2_19_ForwardServletEvent_servlet" + SERVLET_SUFFIX + "?"
+ QUERY_STRING;
PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
rd.forward(portletReq, portletResp);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:22,代码来源:DispatcherTests4_SPEC2_19_ForwardServletEvent_event.java
示例14: 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);
}
}
示例15: 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();
// Now do the actual dispatch
String target = SERVLET_PREFIX + "DispatcherTests_SPEC2_19_ForwardServletResource_servlet" + SERVLET_SUFFIX + "?"
+ QUERY_STRING;
PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
rd.forward(portletReq, portletResp);
}