PortletUtils.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:spring4-understanding 作者:
/**
 * 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");
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号