本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}