本文整理汇总了Java中com.liferay.portal.kernel.upload.UploadPortletRequest.getFileName方法的典型用法代码示例。如果您正苦于以下问题:Java UploadPortletRequest.getFileName方法的具体用法?Java UploadPortletRequest.getFileName怎么用?Java UploadPortletRequest.getFileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.upload.UploadPortletRequest
的用法示例。
在下文中一共展示了UploadPortletRequest.getFileName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EmployeeFileTerm
import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入方法依赖的package包/类
public EmployeeFileTerm(ActionRequest actionRequest) {
UploadPortletRequest request = PortalUtil.getUploadPortletRequest(actionRequest);
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
fileName= request.getFileName("uploadedFile");
file = request.getFile("uploadedFile");
mimeType = request.getContentType("uploadedFile");
employeeFileId = ParamUtil.getLong(request, EMPLOYEE_FILE_ID);
groupId = themeDisplay.getScopeGroupId();
companyId = themeDisplay.getCompanyId();
userId = themeDisplay.getUserId();
userName = themeDisplay.getUser().getFullName();
createDate = ParamUtil.getDate(request, CREATE_DATE,
DateTimeUtils.getDateTimeFormat(DateTimeUtils._VN_DATE_TIME_FORMAT));
modifiedDate = ParamUtil.getDate(request, MODIFIED_DATE,
DateTimeUtils.getDateTimeFormat(DateTimeUtils._VN_DATE_TIME_FORMAT));
employeeId = ParamUtil.getLong(request, EMPLOYEE_ID);
fileEntryId = ParamUtil.getLong(request, FILE_ENTRY_ID);
documentName = ParamUtil.getString(request, DOCUMENT_NAME);
if(Validator.isNull(documentName)){
documentName = fileName;
}
}
示例2: addTempFileEntry
import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入方法依赖的package包/类
protected void addTempFileEntry(ActionRequest actionRequest, String folderName) throws Exception {
_log.info("addTempFileEntry()");
UploadPortletRequest uploadPortletRequest = _portal.getUploadPortletRequest(actionRequest);
checkExceededSizeLimit(uploadPortletRequest);
long groupId = ParamUtil.getLong(actionRequest, "groupId");
deleteTempFileEntry(groupId, folderName);
InputStream inputStream = null;
try {
String sourceFileName = uploadPortletRequest.getFileName("file");
inputStream = uploadPortletRequest.getFileAsStream("file");
String contentType = uploadPortletRequest.getContentType("file");
_layoutService.addTempFileEntry(groupId, folderName, sourceFileName, inputStream, contentType);
} catch (Exception e) {
UploadException uploadException = (UploadException) actionRequest.getAttribute(WebKeys.UPLOAD_EXCEPTION);
if (uploadException != null) {
Throwable cause = uploadException.getCause();
if (cause instanceof FileUploadBase.IOFileUploadException) {
if (_log.isInfoEnabled()) {
_log.info("Temporary upload was cancelled");
}
}
if (uploadException.isExceededFileSizeLimit()) {
throw new FileSizeException(cause);
}
if (uploadException.isExceededUploadRequestSizeLimit()) {
throw new UploadRequestSizeException(cause);
}
} else {
throw e;
}
} finally {
StreamUtil.cleanUp(inputStream);
}
}
示例3: addSong
import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入方法依赖的package包/类
public void addSong(ActionRequest request, ActionResponse response)
throws Exception {
UploadPortletRequest uploadPortletRequest =
PortalUtil.getUploadPortletRequest(request);
long albumId = ParamUtil.getLong(uploadPortletRequest, "albumId");
String name = ParamUtil.getString(uploadPortletRequest, "name");
InputStream songInputStream = uploadPortletRequest.getFileAsStream(
"songFile");
String songFileName = uploadPortletRequest.getFileName("songFile");
InputStream lyricsInputStream =
uploadPortletRequest.getFileAsStream("lyricsFile");
String lyricsFileName = uploadPortletRequest.getFileName(
"lyricsFile");
ServiceContext serviceContext = ServiceContextFactory.getInstance(
Song.class.getName(), uploadPortletRequest);
try {
SongServiceUtil.addSong(
albumId, name, songFileName, songInputStream,
lyricsFileName, lyricsInputStream, serviceContext);
SessionMessages.add(request, "songAdded");
String redirect = ParamUtil.getString(
uploadPortletRequest, "redirect");
response.sendRedirect(redirect);
}
catch (Exception e) {
SessionErrors.add(request, e.getClass().getName());
if (e instanceof SongNameException ||
e instanceof DuplicatedSongException ||
e instanceof PrincipalException) {
response.setRenderParameter(
"jspPage", "/html/songs/edit_song.jsp");
}
else {
response.setRenderParameter("jspPage", "/html/error.jsp");
}
}
}
示例4: updateSong
import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入方法依赖的package包/类
public void updateSong(ActionRequest request, ActionResponse response)
throws Exception {
UploadPortletRequest uploadPortletRequest =
PortalUtil.getUploadPortletRequest(request);
long albumId = ParamUtil.getLong(uploadPortletRequest, "albumId");
long songId = ParamUtil.getLong(uploadPortletRequest, "songId");
String name = ParamUtil.getString(uploadPortletRequest, "name");
InputStream songInputStream = uploadPortletRequest.getFileAsStream(
"songFile");
String songFileName = uploadPortletRequest.getFileName("songFile");
InputStream lyricsInputStream =
uploadPortletRequest.getFileAsStream("lyricsFile");
String lyricsFileName = uploadPortletRequest.getFileName(
"lyricsFile");
ServiceContext serviceContext = ServiceContextFactory.getInstance(
Song.class.getName(), uploadPortletRequest);
try {
SongServiceUtil.updateSong(
songId, albumId, name, songFileName, songInputStream,
lyricsFileName, lyricsInputStream, serviceContext);
SessionMessages.add(request, "songUpdated");
String redirect = ParamUtil.getString(
uploadPortletRequest, "redirect");
response.sendRedirect(redirect);
}
catch (Exception e) {
SessionErrors.add(request, e.getClass().getName());
if (e instanceof SongNameException ||
e instanceof PrincipalException) {
response.setRenderParameter(
"jspPage", "/html/songs/edit_song.jsp");
}
else {
response.setRenderParameter("jspPage", "/html/error.jsp");
}
}
}
示例5: addSong
import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入方法依赖的package包/类
public void addSong(ActionRequest request, ActionResponse response)
throws Exception {
UploadPortletRequest uploadPortletRequest =
PortalUtil.getUploadPortletRequest(request);
long albumId = ParamUtil.getLong(uploadPortletRequest, "albumId");
String name = ParamUtil.getString(uploadPortletRequest, "name");
InputStream songInputStream = uploadPortletRequest.getFileAsStream(
"songFile");
String songFileName = uploadPortletRequest.getFileName("songFile");
InputStream lyricsInputStream =
uploadPortletRequest.getFileAsStream("lyricsFile");
String lyricsFileName = uploadPortletRequest.getFileName(
"lyricsFile");
ServiceContext serviceContext = ServiceContextFactory.getInstance(
Song.class.getName(), uploadPortletRequest);
try {
SongServiceUtil.addSong(
albumId, name, songFileName, songInputStream,
lyricsFileName, lyricsInputStream, serviceContext);
SessionMessages.add(request, "songAdded");
String redirect = ParamUtil.getString(
uploadPortletRequest, "redirect");
response.sendRedirect(redirect);
}
catch (Exception e) {
SessionErrors.add(request, e.getClass().getName());
if (e instanceof SongNameException ||
e instanceof DuplicatedSongException ||
e instanceof PrincipalException) {
response.setRenderParameter(
"jspPage", "/html/songs/edit_song.jsp");
}
else {
response.setRenderParameter("jspPage", "/html/error.jsp");
}
}
}
示例6: PartnerFileTerm
import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入方法依赖的package包/类
public PartnerFileTerm(ActionRequest actionRequest) {
UploadPortletRequest request = PortalUtil.getUploadPortletRequest(actionRequest);
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
fileName= request.getFileName("uploadedFile");
file = request.getFile("uploadedFile");
mimeType = request.getContentType("uploadedFile");
partnerFileId = ParamUtil.getLong(request, PARTNER_FILE_ID);
groupId = themeDisplay.getScopeGroupId();
companyId = themeDisplay.getCompanyId();
userId = themeDisplay.getUserId();
userName = themeDisplay.getUser().getFullName();
createDate = ParamUtil.getDate(request, CREATE_DATE,
DateTimeUtils.getDateTimeFormat(DateTimeUtils._VN_DATE_TIME_FORMAT));
modifiedDate = ParamUtil.getDate(request, MODIFIED_DATE,
DateTimeUtils.getDateTimeFormat(DateTimeUtils._VN_DATE_TIME_FORMAT));
partnerId = ParamUtil.getLong(request, PARTNER_ID);
fileEntryId = ParamUtil.getLong(request, FILE_ENTRY_ID);
if(Validator.isNull(documentName)){
documentName = fileName;
}
}
示例7: setActivity
import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入方法依赖的package包/类
public void setActivity(ActionRequest actionRequest,
ActionResponse actionResponse) throws IOException, NestableException {
long actId = ParamUtil.getLong(actionRequest, "actId");
UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest);
String text = ParamUtil.getString(uploadRequest, "text");
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
User user = UserLocalServiceUtil.getUser(themeDisplay.getUserId());
boolean isSetTextoEnr = StringPool.TRUE.equals(LearningActivityLocalServiceUtil.getExtraContentValue(actId,"textoenr"));
boolean isSetFichero = StringPool.TRUE.equals(LearningActivityLocalServiceUtil.getExtraContentValue(actId,"fichero"));
LearningActivity learningActivity = LearningActivityLocalServiceUtil.getLearningActivity(actId);
LearningActivityTryLocalServiceUtil.getTriesCountByActivityAndUser(actId, user.getUserId());
if((learningActivity.getTries()!=0)&&(learningActivity.getTries()<=LearningActivityTryLocalServiceUtil.getTriesCountByActivityAndUser(actId, user.getUserId()))) {
//TODO
SessionErrors.add(actionRequest, "onlineActivity.max-tries");
}
else {
//ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
Element resultadosXML=SAXReaderUtil.createElement("results");
Document resultadosXMLDoc=SAXReaderUtil.createDocument(resultadosXML);
if(isSetFichero) {
String fileName = uploadRequest.getFileName("fileName");
File file = uploadRequest.getFile("fileName");
String mimeType = uploadRequest.getContentType("fileName");
if (Validator.isNull(fileName)) {
SessionErrors.add(actionRequest, "onlineActivity.mandatory.file");
actionRequest.setAttribute("actId", actId);
actionResponse.setRenderParameter("text", text);
return;
}
if( file.getName().endsWith(".bat")
|| file.getName().endsWith(".com")
|| file.getName().endsWith(".exe")
|| file.getName().endsWith(".msi") ){
SessionErrors.add(actionRequest, "onlineActivity.not.allowed.file.type");
actionResponse.setRenderParameter("text", text);
actionRequest.setAttribute("actId", actId);
return;
}
long repositoryId = DLFolderConstants.getDataRepositoryId(themeDisplay.getScopeGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID);
long folderId = createDLFolders(user.getUserId(), repositoryId, actionRequest);
//Subimos el Archivo en la Document Library
ServiceContext serviceContext= ServiceContextFactory.getInstance( DLFileEntry.class.getName(), actionRequest);
//Damos permisos al archivo para usuarios de comunidad.
serviceContext.setAddGroupPermissions(true);
FileEntry document = DLAppLocalServiceUtil.addFileEntry(
themeDisplay.getUserId(), repositoryId , folderId , fileName, mimeType, fileName, StringPool.BLANK, StringPool.BLANK, file , serviceContext ) ;
Element fileXML=SAXReaderUtil.createElement(FILE_XML);
fileXML.addAttribute("id", Long.toString(document.getFileEntryId()));
resultadosXML.add(fileXML);
}
if(isSetTextoEnr){
Element richTextXML=SAXReaderUtil.createElement(RICH_TEXT_XML);
richTextXML.setText(text);
resultadosXML.add(richTextXML);
}
else {
Element textXML=SAXReaderUtil.createElement(TEXT_XML);
textXML.setText(text);
resultadosXML.add(textXML);
}
LearningActivityTry learningActivityTry = LearningActivityTryLocalServiceUtil.createLearningActivityTry(actId,ServiceContextFactory.getInstance(actionRequest));
learningActivityTry.setTryResultData(resultadosXMLDoc.formattedString());
//learningActivityTry.setEndDate(new Date());
//learningActivityTry.setResult(0);
LearningActivityTryLocalServiceUtil.updateLearningActivityTry(learningActivityTry);
SessionMessages.add(actionRequest, "onlinetaskactivity.updating");
}
}