List of usage examples for com.liferay.portal.kernel.atom AtomRequestContext getHeader
public String getHeader(String name);
From source file:com.liferay.document.library.internal.atom.FileEntryAtomCollectionAdapter.java
License:Open Source License
@Override protected FileEntry doPostEntry(String title, String summary, String content, Date date, AtomRequestContext atomRequestContext) throws Exception { long folderId = atomRequestContext.getLongParameter("folderId"); long repositoryId = 0; if (folderId != 0) { Folder folder = _dlAppService.getFolder(folderId); repositoryId = folder.getRepositoryId(); } else {// w w w .jav a2 s. c o m repositoryId = atomRequestContext.getLongParameter("repositoryId"); } String mimeType = atomRequestContext.getHeader("Media-Content-Type"); if (mimeType == null) { mimeType = MimeTypesUtil.getContentType(title); } byte[] contentDecoded = Base64.decode(content); ByteArrayInputStream contentInputStream = new ByteArrayInputStream(contentDecoded); ServiceContext serviceContext = new ServiceContext(); FileEntry fileEntry = _dlAppService.addFileEntry(repositoryId, folderId, title, mimeType, title, summary, null, contentInputStream, contentDecoded.length, serviceContext); return fileEntry; }
From source file:com.liferay.document.library.internal.atom.FileEntryAtomCollectionAdapter.java
License:Open Source License
@Override protected FileEntry doPostMedia(String mimeType, String slug, InputStream inputStream, AtomRequestContext atomRequestContext) throws Exception { long folderId = atomRequestContext.getLongParameter("folderId"); long repositoryId = 0; if (folderId != 0) { Folder folder = _dlAppService.getFolder(folderId); repositoryId = folder.getRepositoryId(); } else {/*from ww w. j a va2s . co m*/ repositoryId = atomRequestContext.getLongParameter("repositoryId"); } String title = atomRequestContext.getHeader("Title"); String description = atomRequestContext.getHeader("Summary"); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); StreamUtil.transfer(inputStream, byteArrayOutputStream); byte[] content = byteArrayOutputStream.toByteArray(); ByteArrayInputStream contentInputStream = new ByteArrayInputStream(content); ServiceContext serviceContext = new ServiceContext(); FileEntry fileEntry = _dlAppService.addFileEntry(repositoryId, folderId, title, mimeType, title, description, null, contentInputStream, content.length, serviceContext); return fileEntry; }
From source file:com.liferay.document.library.internal.atom.FileEntryAtomCollectionAdapter.java
License:Open Source License
@Override protected void doPutEntry(FileEntry fileEntry, String title, String summary, String content, Date date, AtomRequestContext atomRequestContext) throws Exception { String mimeType = atomRequestContext.getHeader("Media-Content-Type"); if (mimeType == null) { mimeType = MimeTypesUtil.getContentType(title); }/* w w w .jav a 2s . c o m*/ byte[] contentDecoded = Base64.decode(content); ByteArrayInputStream contentInputStream = new ByteArrayInputStream(contentDecoded); ServiceContext serviceContext = new ServiceContext(); _dlAppService.updateFileEntry(fileEntry.getFileEntryId(), title, mimeType, title, summary, null, true, contentInputStream, contentDecoded.length, serviceContext); }
From source file:com.liferay.document.library.internal.atom.FileEntryAtomCollectionAdapter.java
License:Open Source License
@Override protected void doPutMedia(FileEntry fileEntry, String mimeType, String slug, InputStream inputStream, AtomRequestContext atomRequestContext) throws Exception { String title = atomRequestContext.getHeader("Title"); String description = atomRequestContext.getHeader("Summary"); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); StreamUtil.transfer(inputStream, byteArrayOutputStream); byte[] content = byteArrayOutputStream.toByteArray(); ByteArrayInputStream contentInputStream = new ByteArrayInputStream(content); ServiceContext serviceContext = new ServiceContext(); _dlAppService.updateFileEntry(fileEntry.getFileEntryId(), slug, mimeType, title, description, null, true, contentInputStream, content.length, serviceContext); }
From source file:com.liferay.portlet.documentlibrary.atom.FileEntryAtomCollectionAdapter.java
License:Open Source License
@Override protected FileEntry doPostEntry(String title, String summary, String content, Date date, AtomRequestContext atomRequestContext) throws Exception { long folderId = atomRequestContext.getLongParameter("folderId"); long repositoryId = 0; if (folderId != 0) { Folder folder = DLAppServiceUtil.getFolder(folderId); repositoryId = folder.getRepositoryId(); } else {//w w w. j a v a 2 s . co m repositoryId = atomRequestContext.getLongParameter("repositoryId"); } String mimeType = atomRequestContext.getHeader("Media-Content-Type"); if (mimeType == null) { mimeType = MimeTypesUtil.getContentType(title); } byte[] contentDecoded = Base64.decode(content); ByteArrayInputStream contentInputStream = new ByteArrayInputStream(contentDecoded); ServiceContext serviceContext = new ServiceContext(); FileEntry fileEntry = DLAppServiceUtil.addFileEntry(repositoryId, folderId, title, mimeType, title, summary, null, contentInputStream, contentDecoded.length, serviceContext); return fileEntry; }
From source file:com.liferay.portlet.documentlibrary.atom.FileEntryAtomCollectionAdapter.java
License:Open Source License
@Override protected FileEntry doPostMedia(String mimeType, String slug, InputStream inputStream, AtomRequestContext atomRequestContext) throws Exception { long folderId = atomRequestContext.getLongParameter("folderId"); long repositoryId = 0; if (folderId != 0) { Folder folder = DLAppServiceUtil.getFolder(folderId); repositoryId = folder.getRepositoryId(); } else {//w w w . j av a 2 s . c om repositoryId = atomRequestContext.getLongParameter("repositoryId"); } String title = atomRequestContext.getHeader("Title"); String description = atomRequestContext.getHeader("Summary"); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); StreamUtil.transfer(inputStream, byteArrayOutputStream); byte[] content = byteArrayOutputStream.toByteArray(); ByteArrayInputStream contentInputStream = new ByteArrayInputStream(content); ServiceContext serviceContext = new ServiceContext(); FileEntry fileEntry = DLAppServiceUtil.addFileEntry(repositoryId, folderId, title, mimeType, title, description, null, contentInputStream, content.length, serviceContext); return fileEntry; }
From source file:com.liferay.portlet.documentlibrary.atom.FileEntryAtomCollectionAdapter.java
License:Open Source License
@Override protected void doPutEntry(FileEntry fileEntry, String title, String summary, String content, Date date, AtomRequestContext atomRequestContext) throws Exception { String mimeType = atomRequestContext.getHeader("Media-Content-Type"); if (mimeType == null) { mimeType = MimeTypesUtil.getContentType(title); }// w ww .jav a 2 s . c o m byte[] contentDecoded = Base64.decode(content); ByteArrayInputStream contentInputStream = new ByteArrayInputStream(contentDecoded); ServiceContext serviceContext = new ServiceContext(); DLAppServiceUtil.updateFileEntry(fileEntry.getFileEntryId(), title, mimeType, title, summary, null, true, contentInputStream, contentDecoded.length, serviceContext); }
From source file:com.liferay.portlet.documentlibrary.atom.FileEntryAtomCollectionAdapter.java
License:Open Source License
@Override protected void doPutMedia(FileEntry fileEntry, String mimeType, String slug, InputStream inputStream, AtomRequestContext atomRequestContext) throws Exception { String title = atomRequestContext.getHeader("Title"); String description = atomRequestContext.getHeader("Summary"); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); StreamUtil.transfer(inputStream, byteArrayOutputStream); byte[] content = byteArrayOutputStream.toByteArray(); ByteArrayInputStream contentInputStream = new ByteArrayInputStream(content); ServiceContext serviceContext = new ServiceContext(); DLAppServiceUtil.updateFileEntry(fileEntry.getFileEntryId(), slug, mimeType, title, description, null, true, contentInputStream, content.length, serviceContext); }