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


Java ResourceURL.setResourceID方法代码示例

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


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

示例1: getResourceURL

import javax.portlet.ResourceURL; //导入方法依赖的package包/类
/**
 * Creates a resource URL from the given faces context.
 * 
 * @param context
 *            the faces context
 * @return the resource URL
 */
public static String getResourceURL(FacesContext context, String path)
{
    MimeResponse portletResponse = (MimeResponse) context.getExternalContext().getResponse();
    ResourceURL resourceURL = portletResponse.createResourceURL();
    resourceURL.setResourceID(path);
    return resourceURL.toString();
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:15,代码来源:AlfrescoFacesPortlet.java

示例2: doLoadMore

import javax.portlet.ResourceURL; //导入方法依赖的package包/类
/**
 * Performs the "load more" AJAX request
 *
 * @param request The resource request
 * @param response The resource response
 *
 * @throws PortletException If something goes wrong
 * @throws IOException If something goes wrong
 */
public void doLoadMore(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {
    response.setContentType(ContentTypes.APPLICATION_JSON);
    response.setCharacterEncoding(StandardCharsets.UTF_8.name());
    response.setProperty(HTTP_HEADER_CACHE_CONTROL, CACHE_CONTROL_NO_CACHE);
    response.setProperty(ResourceResponse.EXPIRATION_CACHE, ZERO);

    String tabId = ParamUtil.get(request, PortletRequestParameter.TAB_ID.getName(), StringPool.BLANK);
    int offset = ParamUtil.getInteger(request, PortletRequestParameter.PAGE_OFFSET.getName(), 0);
    if(offset < 0) {
        offset = 0;
    }

    FlashlightSearchConfiguration config = this.searchService.readConfiguration(request.getPreferences());
    Map<String, FlashlightSearchConfigurationTab> tabs = config.getTabs();

    if(tabs.containsKey(tabId)) {
        try {
            SearchResultsContainer container = this.searchService.search(request, response, tabId, offset, true);
            JSONPayloadFactory jsonPayloadFactory = new JSONPayloadFactory(this.jsonFactory);
            if(container.hasSearchResults(tabId)) {
                FlashlightSearchConfigurationTab tab = tabs.get(tabId);
                SearchPage page = container.getSearchPage(tabId);

                ResourceURL loadMoreUrl = response.createResourceURL();
                loadMoreUrl.setResourceID(PortletResource.LOAD_MORE.getResourceId());
                loadMoreUrl.setParameter(PortletRequestParameter.TAB_ID.getName(), tabId);
                loadMoreUrl.setParameter(PortletRequestParameter.KEYWORDS.getName(), ParamUtil.get(request, PortletRequestParameter.KEYWORDS.getName(), StringPool.BLANK));
                loadMoreUrl.setParameter(PortletRequestParameter.PAGE_OFFSET.getName(), Integer.toString(offset + 1));
                loadMoreUrl.setParameter(PortletRequestParameter.RANDOM_CACHE.getName(), randomCacheParamValue());

                JSONObject payload = jsonPayloadFactory.createJSONPayload(tab, page, offset, loadMoreUrl.toString());
                response.getWriter().print(payload.toJSONString());
            } else {
                // No search results with the given tab
                LOG.debug("A search tab was found, but no pages were returned");
                response.setProperty(ResourceResponse.HTTP_STATUS_CODE, STATUS_CODE_NOT_FOUND);
            }
        } catch (SearchException e) {
            // Cannot perform search, return a 500 error
            LOG.error("Cannot perform search", e);
            response.setProperty(ResourceResponse.HTTP_STATUS_CODE, STATUS_CODE_INTERNAL_ERROR);
        }
    } else {
        // No tab with given ID. Return 404
        response.setProperty(ResourceResponse.HTTP_STATUS_CODE, STATUS_CODE_NOT_FOUND);
    }
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:57,代码来源:FlashlightSearchPortlet.java

示例3: doView

import javax.portlet.ResourceURL; //导入方法依赖的package包/类
public void doView(
		RenderRequest renderRequest, RenderResponse renderResponse)
	throws IOException, PortletException {

	PortletConfig portletConfig =
		(PortletConfig)renderRequest.getAttribute(
			JavaConstants.JAVAX_PORTLET_CONFIG);

	String updateMessage = getUpdateMessage(portletConfig);

	renderRequest.setAttribute("updateMessage", updateMessage);

	List<String> outputList = IndexCheckerOutput.generateCSVOutput(
		portletConfig, renderRequest);

	String portletId = portletConfig.getPortletName();
	long userId = PortalUtil.getUserId(renderRequest);
	String outputContent = OutputUtils.listStringToString(outputList);

	FileEntry exportCsvFileEntry = OutputUtils.addPortletOutputFileEntry(
		portletId, userId, outputContent);

	if (exportCsvFileEntry != null) {
		ResourceURL exportCsvResourceURL =
			renderResponse.createResourceURL();
		exportCsvResourceURL.setResourceID(exportCsvFileEntry.getTitle());

		renderRequest.setAttribute(
			"exportCsvResourceURL", exportCsvResourceURL.toString());
	}

	try {
		List<Long> siteGroupIds = this.getSiteGroupIds();
		renderRequest.setAttribute("groupIdList", siteGroupIds);

		List<String> groupDescriptionList = getSiteGroupDescriptions(
			siteGroupIds, renderRequest.getLocale());
		renderRequest.setAttribute(
			"groupDescriptionList", groupDescriptionList);
	}
	catch (Exception e) {
		throw new PortletException(e);
	}

	try {
		List<Model> modelList = this.getModelList();
		renderRequest.setAttribute("modelList", modelList);
	}
	catch (SystemException se) {
		throw new PortletException(se);
	}

	long filterModifiedDate = ParamUtil.getLong(
		renderRequest, "filterModifiedDate", 0L);

	renderRequest.setAttribute("filterModifiedDate", filterModifiedDate);

	super.doView(renderRequest, renderResponse);
}
 
开发者ID:jorgediaz-lr,项目名称:index-checker,代码行数:60,代码来源:IndexCheckerPortlet.java

示例4: createResourceURL

import javax.portlet.ResourceURL; //导入方法依赖的package包/类
/**
 * Create resource URL for a resourceId
 * 
 * @param renderResponse
 * @param resourceId
 * 
 * @return url string
 */
protected String createResourceURL(RenderResponse renderResponse, String resourceId) {

	ResourceURL portletURL = renderResponse.createResourceURL();

	portletURL.setResourceID(resourceId);

	return portletURL.toString();
}
 
开发者ID:peerkar,项目名称:liferay-gsearch,代码行数:17,代码来源:ViewMVCRenderCommand.java


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