• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ContentTypes类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.liferay.portal.kernel.util.ContentTypes的典型用法代码示例。如果您正苦于以下问题:Java ContentTypes类的具体用法?Java ContentTypes怎么用?Java ContentTypes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ContentTypes类属于com.liferay.portal.kernel.util包,在下文中一共展示了ContentTypes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: doServeResource

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
@Override
protected void doServeResource(ResourceRequest request, ResourceResponse response)
		throws Exception {
	String cmd = ParamUtil.getString(request, Constants.CMD);
	String serializedJson = "";
	
	if(cmd.equals(CMD_PAGELIST)) {
		serializedJson = getPageLists(request,response );
	} else {
		_log.error("Unknown command is passed <" + cmd + ">");
	}
	
	HttpServletResponse servletResponse = _portal.getHttpServletResponse(
			response);

	servletResponse.setContentType(ContentTypes.APPLICATION_JSON);

	ServletResponseUtil.write(servletResponse, serializedJson);		
}
 
开发者ID:yasuflatland-lf,项目名称:liferay-dummy-factory,代码行数:20,代码来源:PageMVCResourceCommand.java


示例2: doServeResource

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
@Override
protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception {
	String cmd = ParamUtil.getString(resourceRequest, Constants.CMD);
	String serializedJson = "";

	if (cmd.equals(CMD_ROLELIST)) {
		serializedJson = getRoleLists(resourceRequest, resourceResponse);
	} else {
		_log.error("Unknown command is passed <" + cmd + ">");
	}

	HttpServletResponse response = _portal.getHttpServletResponse(resourceResponse);

	response.setContentType(ContentTypes.APPLICATION_JSON);

	ServletResponseUtil.write(response, serializedJson);
}
 
开发者ID:yasuflatland-lf,项目名称:liferay-dummy-factory,代码行数:18,代码来源:RoleMVCResourceCommand.java


示例3: doServeResource

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
@Override
protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
		throws Exception {
	String cmd = ParamUtil.getString(resourceRequest, Constants.CMD);
	String serializedJson = "";
	
	if(cmd.equals(CMD_THREAD_LIST)) {
		serializedJson = getThreadList(resourceRequest,resourceResponse );
		
	} else if (cmd.equals(CMD_CATEGORY_LIST)) {
		serializedJson = getCategoryList(resourceRequest,resourceResponse );
		
	} else {
		_log.error("Unknown command is passed <" + cmd + ">");
	}
	
	HttpServletResponse response = _portal.getHttpServletResponse(
			resourceResponse);

	response.setContentType(ContentTypes.APPLICATION_JSON);

	ServletResponseUtil.write(response, serializedJson);		
}
 
开发者ID:yasuflatland-lf,项目名称:liferay-dummy-factory,代码行数:24,代码来源:MBMVCResourceCommand.java


示例4: _writeSampleHTML

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
/**
 * Write sample HTML
 *
 * @param resp
 */
private void _writeSampleHTML(HttpServletResponse resp) {
	resp.setCharacterEncoding(StringPool.UTF8);
	resp.setContentType(ContentTypes.TEXT_HTML_UTF8);
	resp.setStatus(HttpServletResponse.SC_OK);

	try {
		ServletResponseUtil.write(resp, _generateSampleHTML());
	}
	catch (Exception e) {
		if (_log.isWarnEnabled()) {
			_log.warn(e, e);
		}

		resp.setStatus(HttpServletResponse.SC_PRECONDITION_FAILED);
	}
}
 
开发者ID:liferay,项目名称:liferay-blade-samples,代码行数:22,代码来源:BladeServlet.java


示例5: updateCompetence

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
@Indexable(type=IndexableType.REINDEX)
public Competence updateCompetence(Competence competence, ServiceContext serviceContext) throws SystemException, PortalException {

	competence = LmsLocaleUtil.checkDefaultLocale(Competence.class, competence, "title");
	competence = LmsLocaleUtil.checkDefaultLocale(Competence.class, competence, "description");
	
	Competence competenceReturn = competencePersistence.update(competence, true);
	Locale locale=new Locale(serviceContext.getLanguageId());
	
	long userId=serviceContext.getUserId();
	AssetEntryLocalServiceUtil.updateEntry(
			userId, competence.getGroupId(), Competence.class.getName(),
			competence.getCompetenceId(), competence.getUuid(),0, serviceContext.getAssetCategoryIds(),
			serviceContext.getAssetTagNames(), true, null, null,
			new java.util.Date(System.currentTimeMillis()), null,
			ContentTypes.TEXT_HTML, competence.getTitle(), competence.getDescription(locale), competence.getDescription(locale), null, null, 0, 0,
			null, false);
	return competenceReturn;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:20,代码来源:CompetenceLocalServiceImpl.java


示例6: modCompetence

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
@Indexable(type=IndexableType.REINDEX)
public Competence modCompetence (Competence competence, ServiceContext serviceContext) throws SystemException, PortalException {
		competence.setExpandoBridgeAttributes(serviceContext);

		competence = LmsLocaleUtil.checkDefaultLocale(Competence.class, competence, "title");
		competence = LmsLocaleUtil.checkDefaultLocale(Competence.class, competence, "description");
		
		Locale locale=new Locale(serviceContext.getLanguageId());
		competencePersistence.update(competence, true);
		long userId=serviceContext.getUserId();
		AssetEntryLocalServiceUtil.updateEntry(
				userId, competence.getGroupId(), Competence.class.getName(),
				competence.getCompetenceId(), competence.getUuid(),0, serviceContext.getAssetCategoryIds(),
				serviceContext.getAssetTagNames(), true, null, null,
				new java.util.Date(System.currentTimeMillis()), null,
				ContentTypes.TEXT_HTML, competence.getTitle(), competence.getDescription(locale), competence.getDescription(locale), null, null, 0, 0,
				null, false);
		return competence;
	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:21,代码来源:CompetenceLocalServiceImpl.java


示例7: initCsv

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
private CSVWriter initCsv(ResourceResponse resourceResponse)
		throws IOException, UnsupportedEncodingException {
	//Necesario para crear el fichero csv.
	resourceResponse.setCharacterEncoding(StringPool.UTF8);
	resourceResponse.setContentType(ContentTypes.TEXT_CSV_UTF8);
	resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION,"attachment; fileName=Statistics.csv");
	byte b[] = {(byte)0xEF, (byte)0xBB, (byte)0xBF};
	
	resourceResponse.getPortletOutputStream().write(b);
	
	CSVWriter writer = new CSVWriter(new OutputStreamWriter(resourceResponse.getPortletOutputStream(),StringPool.UTF8),CharPool.SEMICOLON);
	return writer;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:14,代码来源:CourseStats.java


示例8: updateAsset

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
public void updateAsset(
		long userId, Album album, long[] assetCategoryIds,
		String[] assetTagNames, long[] assetLinkEntryIds)
	throws PortalException {

	AssetEntry assetEntry = assetEntryLocalService.updateEntry(
		userId, album.getGroupId(), album.getCreateDate(),
		album.getModifiedDate(), Album.class.getName(), album.getAlbumId(),
		album.getUuid(), 0, assetCategoryIds, assetTagNames, true, null,
		null, null, ContentTypes.TEXT_HTML, album.getName(), null, null,
		null, null, 0, 0, null, false);

	assetLinkLocalService.updateLinks(
		userId, assetEntry.getEntryId(), assetLinkEntryIds,
		AssetLinkConstants.TYPE_RELATED);
}
 
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:17,代码来源:AlbumLocalServiceImpl.java


示例9: updateAsset

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
public void updateAsset(
		long userId, Song song, long[] assetCategoryIds,
		String[] assetTagNames, long[] assetLinkEntryIds)
	throws PortalException {

	AssetEntry assetEntry = assetEntryLocalService.updateEntry(
		userId, song.getGroupId(), song.getCreateDate(),
		song.getModifiedDate(), Song.class.getName(), song.getSongId(),
		song.getUuid(), 0, assetCategoryIds, assetTagNames, true, null,
		null, null, ContentTypes.TEXT_HTML, song.getName(), null, null,
		null, null, 0, 0, null, false);

	assetLinkLocalService.updateLinks(
		userId, assetEntry.getEntryId(), assetLinkEntryIds,
		AssetLinkConstants.TYPE_RELATED);
}
 
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:17,代码来源:SongLocalServiceImpl.java


示例10: updateAsset

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
public void updateAsset(
		long userId, Artist artist, long[] assetCategoryIds,
		String[] assetTagNames, long[] assetLinkEntryIds)
	throws PortalException {

	AssetEntry assetEntry = assetEntryLocalService.updateEntry(
		userId, artist.getGroupId(), artist.getCreateDate(),
		artist.getModifiedDate(), Artist.class.getName(),
		artist.getArtistId(), artist.getUuid(), 0, assetCategoryIds,
		assetTagNames, true, null, null, null, ContentTypes.TEXT_HTML,
		artist.getName(), null, null, null, null, 0, 0, null, false);

	assetLinkLocalService.updateLinks(
		userId, assetEntry.getEntryId(), assetLinkEntryIds,
		AssetLinkConstants.TYPE_RELATED);
}
 
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:17,代码来源:ArtistLocalServiceImpl.java


示例11: strutsExecute

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
public ActionForward strutsExecute(ActionMapping mapping, ActionForm form,
		HttpServletRequest request, HttpServletResponse response)
		throws Exception {

	try {
		_log.info("strutsExecute");
		ServletResponseUtil.sendFile(request, response, null,
				getRSS(request), ContentTypes.TEXT_XML_UTF8);
		System.out
				.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");

		return null;
	} catch (Exception e) {
		PortalUtil.sendError(e, request, response);

		return null;
	}
}
 
开发者ID:SmartInfrastructures,项目名称:xipi,代码行数:19,代码来源:RSSAction.java


示例12: processAction

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
public void processAction(ActionMapping mapping, ActionForm form,
		PortletConfig portletConfig, ActionRequest actionRequest,
		ActionResponse actionResponse) throws Exception {

	try {
		HttpServletRequest request = PortalUtil
				.getHttpServletRequest(actionRequest);
		HttpServletResponse response = PortalUtil
				.getHttpServletResponse(actionResponse);
		_log.info("processAction");
		System.out
				.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
		ServletResponseUtil.sendFile(request, response, null,
				getRSS(request), ContentTypes.TEXT_XML_UTF8);

		mapping.setForward("/common/null.jsp");
	} catch (Exception e) {
		PortalUtil.sendError(e, actionRequest, actionResponse);
	}
}
 
开发者ID:SmartInfrastructures,项目名称:xipi,代码行数:21,代码来源:RSSAction.java


示例13: updateAsset

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
public void updateAsset(
		long userId, Album album, long[] assetCategoryIds,
		String[] assetTagNames, long[] assetLinkEntryIds)
	throws PortalException, SystemException {

	AssetEntry assetEntry = assetEntryLocalService.updateEntry(
		userId, album.getGroupId(), album.getCreateDate(),
		album.getModifiedDate(), Album.class.getName(), album.getAlbumId(),
		album.getUuid(), 0, assetCategoryIds, assetTagNames, true, null,
		null, null, ContentTypes.TEXT_HTML, album.getName(), null, null,
		null, null, 0, 0, null, false);

	assetLinkLocalService.updateLinks(
		userId, assetEntry.getEntryId(), assetLinkEntryIds,
		AssetLinkConstants.TYPE_RELATED);
}
 
开发者ID:juliocamarero,项目名称:jukebox,代码行数:17,代码来源:AlbumLocalServiceImpl.java


示例14: updateAsset

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
public void updateAsset(
		long userId, Song song, long[] assetCategoryIds,
		String[] assetTagNames, long[] assetLinkEntryIds)
	throws PortalException, SystemException {

	AssetEntry assetEntry = assetEntryLocalService.updateEntry(
		userId, song.getGroupId(), song.getCreateDate(),
		song.getModifiedDate(), Song.class.getName(), song.getSongId(),
		song.getUuid(), 0, assetCategoryIds, assetTagNames, true, null,
		null, null, ContentTypes.TEXT_HTML, song.getName(), null, null,
		null, null, 0, 0, null, false);

	assetLinkLocalService.updateLinks(
		userId, assetEntry.getEntryId(), assetLinkEntryIds,
		AssetLinkConstants.TYPE_RELATED);
}
 
开发者ID:juliocamarero,项目名称:jukebox,代码行数:17,代码来源:SongLocalServiceImpl.java


示例15: updateAsset

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
public void updateAsset(
		long userId, Artist artist, long[] assetCategoryIds,
		String[] assetTagNames, long[] assetLinkEntryIds)
	throws PortalException, SystemException {

	AssetEntry assetEntry = assetEntryLocalService.updateEntry(
		userId, artist.getGroupId(), artist.getCreateDate(),
		artist.getModifiedDate(), Artist.class.getName(),
		artist.getArtistId(), artist.getUuid(), 0, assetCategoryIds,
		assetTagNames, true, null, null, null, ContentTypes.TEXT_HTML,
		artist.getName(), null, null, null, null, 0, 0, null, false);

	assetLinkLocalService.updateLinks(
		userId, assetEntry.getEntryId(), assetLinkEntryIds,
		AssetLinkConstants.TYPE_RELATED);
}
 
开发者ID:juliocamarero,项目名称:jukebox,代码行数:17,代码来源:ArtistLocalServiceImpl.java


示例16: serveResource

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
/**
 * This method is called whenever the server gets an AJAX request from client. All asynchronous requests
 * should go over this method.
 *
 * @param request  Asynchronous request from client
 * @param response Response from server
 * @throws PortletException
 * @throws IOException
 */
@Override
public void serveResource(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {
    // Do not continue if the user is not signed in
    if (!isCorrectAttempt(request)) {
        // Return unauthorized response code
        response.setProperty(ResourceResponse.HTTP_STATUS_CODE, HttpStatus.UNAUTHORIZED.toString());
        return;
    }

    // Environment needs to be set up at the beginning of the request
    propertiesManager.setup(request.getPreferences());

    // Response content type is JSON
    response.setContentType(ContentTypes.APPLICATION_JSON);

    // This is an entry point to the whole app. Processor will do all the necessary work and fill the response.
    processor.processRequest(request, response);
}
 
开发者ID:marcelmika,项目名称:lims,代码行数:28,代码来源:LIMSPortlet.java


示例17: updateAsset

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
@Override
public void updateAsset(long userId, TaskRecord taskRecord, long[] assetCategoryIds, String[] assetTagNames,
        long[] assetLinkEntryIds, Double priority) throws PortalException {

    // TODO
    boolean visible = true;
    // boolean visible = false;
    // if (taskRecord.isApproved()) {
    // visible = true;
    // publishDate = taskRecord.getCreateDate();
    // }

    Date publishDate = null;

    String summary = HtmlUtil.extractText(StringUtil.shorten(taskRecord.getWorkPackage(), 500));

    String className = TaskRecord.class.getName();
    long classPK = taskRecord.getTaskRecordId();

    AssetEntry assetEntry = assetEntryLocalService.updateEntry(userId, taskRecord.getGroupId(),
            taskRecord.getCreateDate(), taskRecord.getModifiedDate(), className, classPK, taskRecord.getUuid(), 0,
            assetCategoryIds, assetTagNames, true, visible, null, null, publishDate, null, ContentTypes.TEXT_HTML,
            taskRecord.getWorkPackage(), taskRecord.getWorkPackage(), summary, null, null, 0, 0, priority);

    assetLinkLocalService.updateLinks(userId, assetEntry.getEntryId(), assetLinkEntryIds,
            AssetLinkConstants.TYPE_RELATED);
}
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:28,代码来源:TaskRecordLocalServiceImpl.java


示例18: updateAsset

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
@Override
public void updateAsset(long userId, Contact contact, long[] assetCategoryIds, String[] assetTagNames,
        long[] assetLinkEntryIds, Double priority) throws PortalException {

    // TODO
    boolean visible = true;
    // boolean visible = false;
    // if (contact.isApproved()) {
    // visible = true;
    // publishDate = contact.getCreateDate();
    // }

    Date publishDate = contact.getCreateDate();

    // TODO
    String description = "TODO: contact description";
    String summary = HtmlUtil.extractText(StringUtil.shorten(contact.getCard(), 500));

    String className = Contact.class.getName();
    long classPK = contact.getContactId();

    AssetEntry assetEntry = assetEntryLocalService.updateEntry(userId, contact.getGroupId(),
            contact.getCreateDate(), contact.getModifiedDate(), className, classPK, contact.getUuid(), 0,
            assetCategoryIds, assetTagNames, true, visible, null, null, publishDate, null, ContentTypes.TEXT_HTML,
            // contact.getName(),
            "TODO: contact.getName()", description, summary, null, null, 0, 0, priority);

    assetLinkLocalService.updateLinks(userId, assetEntry.getEntryId(), assetLinkEntryIds,
            AssetLinkConstants.TYPE_RELATED);

    // assetEntryLocalService.updateVisible(Contact.class.getName(),
    // classPK, visible);

}
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:35,代码来源:ContactLocalServiceImpl.java


示例19: doServeResource

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
@Override
protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
		throws Exception {
	int numberOfCrawlers = ParamUtil.getInteger(resourceRequest, "numberOfCrawlers", -1);
	int maxDepthOfCrawling = ParamUtil.getInteger(resourceRequest, "maxDepthOfCrawling", -1);
	int maxPagesToFetch = ParamUtil.getInteger(resourceRequest, "maxPagesToFetch", -1);
	String tmpUrls = ParamUtil.getString(resourceRequest, "urls", "https://www.shutterstock.com/photos");
	String[] strArray = tmpUrls.split(",");
	List<String> urls = new ArrayList<>(Arrays.asList(strArray));
	List<String> result = Lists.newArrayList();
	
	if(_log.isDebugEnabled()) {
		_log.debug("numberOfCrawlers : " + String.valueOf(numberOfCrawlers));
		_log.debug("maxDepthOfCrawling : " + String.valueOf(maxDepthOfCrawling));
		_log.debug("maxPagesToFetch : " + String.valueOf(maxPagesToFetch));
	}

	if( numberOfCrawlers >= 0 && 
		maxDepthOfCrawling >= 0 && 
		maxPagesToFetch >= 0 ) {
		
		// Run image links crawler
		result = run(numberOfCrawlers, maxDepthOfCrawling, maxPagesToFetch, urls);
	}

	HttpServletResponse response = _portal.getHttpServletResponse(resourceResponse);

	response.setContentType(ContentTypes.APPLICATION_JSON);

	String serializedJson = createReturnJson(resourceRequest, resourceResponse, result);
	
	ServletResponseUtil.write(response, serializedJson);		
}
 
开发者ID:yasuflatland-lf,项目名称:liferay-dummy-factory,代码行数:34,代码来源:ImageLinksMVCResourceCommand.java


示例20: updateAsset

import com.liferay.portal.kernel.util.ContentTypes; //导入依赖的package包/类
@Override
public void updateAsset(long userId, Measurement measurement,
        long[] assetCategoryIds, String[] assetTagNames, Double priority)
        throws PortalException {

    // TODO
    boolean visible = true;
    // boolean visible = false;
    // if (measurement.isApproved()) {
    // visible = true;
    // publishDate = measurement.getCreateDate();
    // }

    Date publishDate = null;

    String summary = HtmlUtil
            .extractText(StringUtil.shorten(measurement.getData(), 500));

    String className = Measurement.class.getName();
    long classPK = measurement.getMeasurementId();

    assetEntryLocalService.updateEntry(userId, measurement.getGroupId(),
            measurement.getCreateDate(), measurement.getModifiedDate(),
            className, classPK, measurement.getUuid(), 0, assetCategoryIds,
            assetTagNames, true, visible, null, null, publishDate, null,
            ContentTypes.TEXT_HTML, measurement.getName(),
            measurement.getName(), summary, null, null, 0, 0, priority);
}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:29,代码来源:MeasurementLocalServiceImpl.java



注:本文中的com.liferay.portal.kernel.util.ContentTypes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Sets类代码示例发布时间:2022-05-22
下一篇:
Java ByteArrayDataOutput类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap