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


Java ContentTypes类代码示例

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


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


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