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

Java UploadedFile类代码示例

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

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



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

示例1: copyUploadedFile

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
/**
 * Copy uploaded file to byte array.
 * 
 * @param uploadedFile
 * @return byte array
 * @throws IOException 
 */
public static byte[] copyUploadedFile(UploadedFile uploadedFile) throws IOException {
    
    InputStream in = uploadedFile.getInputStream();
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {
        int b;
        while ((b = in.read()) != -1) {
            out.write(b);
        }
    } finally {
        out.close();
        in.close();
    }
    return out.toByteArray();
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:23,代码来源:Utils.java


示例2: setCustLogoImageImpl

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
private void setCustLogoImageImpl(UploadedFile uploadedFile) {
	removeLogoImage();

	GluuImage newLogoImage = imageService.constructImage(currentPerson, uploadedFile);
	newLogoImage.setStoreTemporary(true);
	newLogoImage.setLogo(true);
	try {
		if (imageService.createImageFiles(newLogoImage)) {
			this.curLogoImage = newLogoImage;
		}

		this.organization.setLogoImage(imageService.getXMLFromGluuImage(newLogoImage));
	} catch (Exception ex) {
		log.error("Failed to store icon image: '{0}'", ex, newLogoImage);
	}
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:17,代码来源:UpdateOrganizationAction.java


示例3: setFaviconImageImpl

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
public void setFaviconImageImpl(UploadedFile uploadedFile) {
	removeFaviconImage();

	GluuImage newFaviconImage = imageService.constructImage(currentPerson, uploadedFile);
	newFaviconImage.setStoreTemporary(true);
	newFaviconImage.setLogo(false);
	try {
		if (imageService.createFaviconImageFiles(newFaviconImage)) {
			this.curFaviconImage = newFaviconImage;
		}

		this.organization.setFaviconImage(imageService.getXMLFromGluuImage(newFaviconImage));
	} catch (Exception ex) {
		log.error("Failed to store favicon image: '{0}'", ex, newFaviconImage);
	}
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:17,代码来源:UpdateOrganizationAction.java


示例4: uploadImage

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
public void uploadImage(FileUploadEvent event) {
	UploadedFile uploadedFile = event.getUploadedFile();
	this.uploadedImage = null;
	try {
		GluuImage image = imageService.constructImage((GluuCustomPerson) Component.getInstance("currentPerson"), uploadedFile);
		image.setStoreTemporary(true);
		if (imageService.createImageFiles(image)) {
			this.uploadedImage = image;
		}
	} finally {
		try {
			uploadedFile.delete();
		} catch (IOException ex) {
			log.error("Failed to remove temporary image", ex);
		}
	}
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:18,代码来源:CustomAttributeAction.java


示例5: updateCert

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
private void updateCert(UploadedFile item) {
	InputStream is = null;
	OutputStream os = null;
	try {
		is = item.getInputStream();
		os = new FileOutputStream(getTempCertDir() + this.uploadMarker);
		BufferedOutputStream bos = new BufferedOutputStream(os);

		IOUtils.copy(is, bos);
		bos.flush();
	} catch (IOException ex) {
		log.error("Failed to upload certicicate", ex);
	} finally {
		IOUtils.closeQuietly(is);
		IOUtils.closeQuietly(os);
	}
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:18,代码来源:ManageCertificateAction.java


示例6: updateTrsutStoreCert

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
private void updateTrsutStoreCert(UploadedFile item) {
	InputStream is = null;
	try {
		is = item.getInputStream();
		String certificate = IOUtils.toString(is);
		this.trustStoreCertificateUploadMarker.setCertificate(certificate);

		this.trustStoreCertificateUploadMarker.setAddedAt(new Date());
		this.trustStoreCertificateUploadMarker.setAddedBy(currentPerson.getDn());

	} catch (IOException ex) {
		log.error("Failed to upload key", ex);
	} finally {
		IOUtils.closeQuietly(is);
	}
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:17,代码来源:ManageCertificateAction.java


示例7: updateKey

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
private void updateKey(UploadedFile item) {
	InputStream is = null;
	OutputStream os = null;
	try {
		is = item.getInputStream();
		os = new FileOutputStream(getTempCertDir() + this.uploadMarker.replace("crt", "key"));
		BufferedOutputStream bos = new BufferedOutputStream(os);

		IOUtils.copy(is, bos);
		bos.flush();
	} catch (IOException ex) {
		log.error("Failed to upload key", ex);
	} finally {
		IOUtils.closeQuietly(is);
		IOUtils.closeQuietly(os);
	}
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:18,代码来源:ManageCertificateAction.java


示例8: uploadFile

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
@Restrict("#{s:hasPermission('trust', 'access')}")
public String uploadFile(FileUploadEvent event) {
    log.info("uploadFile() call for IDP");
    try {
        UploadedFile uploadedFile = event.getUploadedFile();
        String filepath = asimbaService.saveIDPMetadataFile(uploadedFile, idp);
        idp.setMetadataFile(filepath);
        idp.setMetadataUrl("");
        facesMessages.add(StatusMessage.Severity.INFO, "File uploaded");
    } catch (Exception e) {
        log.error("IDP metadata - uploadFile() exception", e);
        facesMessages.add(StatusMessage.Severity.ERROR, "Requestor metadata - uploadFile exception", e);
        return OxTrustConstants.RESULT_FAILURE;
    }
    return OxTrustConstants.RESULT_SUCCESS;
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:17,代码来源:UpdateAsimbaIDPAction.java


示例9: uploadFile

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
@Restrict("#{s:hasPermission('trust', 'access')}")
public String uploadFile(FileUploadEvent event) {
    log.info("uploadFile() Requestor", spRequestor);
    try {
        UploadedFile uploadedFile = event.getUploadedFile();
        String filepath = asimbaService.saveSPRequestorMetadataFile(uploadedFile);
        spRequestor.setMetadataFile(filepath);
        spRequestor.setMetadataUrl("");
        facesMessages.add(StatusMessage.Severity.INFO, "File uploaded");
    } catch (Exception e) {
        log.error("Requestor metadata - uploadFile() exception", e);
        facesMessages.add(StatusMessage.Severity.ERROR, "Requestor metadata - uploadFile exception", e);
        return OxTrustConstants.RESULT_FAILURE;
    }
    return OxTrustConstants.RESULT_SUCCESS;
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:17,代码来源:UpdateAsimbaSPRequestorAction.java


示例10: copyUploadedFile

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
/**
 * Copy uploaded file to byte array.
 *
 * @param uploadedFile
 * @return byte array
 * @throws IOException
 */
public byte[] copyUploadedFile(UploadedFile uploadedFile) throws IOException {

    InputStream in = uploadedFile.getInputStream();
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {
        int b;
        while ((b = in.read()) != -1) {
            out.write(b);
        }
    } finally {
        out.close();
        in.close();
    }
    return out.toByteArray();
}
 
开发者ID:GluuFederation,项目名称:oxTrust,代码行数:23,代码来源:ServiceUtil.java


示例11: setCustLogoImageImpl

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
private void setCustLogoImageImpl(UploadedFile uploadedFile) {
	removeLogoImage();

	GluuImage newLogoImage = imageService.constructImage(currentPerson, uploadedFile);
	newLogoImage.setStoreTemporary(true);
	newLogoImage.setLogo(true);
	try {
		if (imageService.createImageFiles(newLogoImage)) {
			this.curLogoImage = newLogoImage;
		}

		this.organization.setLogoImage(imageService.getXMLFromGluuImage(newLogoImage));
	} catch (Exception ex) {
		log.error("Failed to store icon image: '{}'", newLogoImage, ex);
	}
}
 
开发者ID:GluuFederation,项目名称:oxTrust,代码行数:17,代码来源:UpdateOrganizationAction.java


示例12: setFaviconImageImpl

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
public void setFaviconImageImpl(UploadedFile uploadedFile) {
	removeFaviconImage();

	GluuImage newFaviconImage = imageService.constructImage(currentPerson, uploadedFile);
	newFaviconImage.setStoreTemporary(true);
	newFaviconImage.setLogo(false);
	try {
		if (imageService.createFaviconImageFiles(newFaviconImage)) {
			this.curFaviconImage = newFaviconImage;
		}

		this.organization.setFaviconImage(imageService.getXMLFromGluuImage(newFaviconImage));
	} catch (Exception ex) {
		log.error("Failed to store favicon image: '{}'", newFaviconImage, ex);
	}
}
 
开发者ID:GluuFederation,项目名称:oxTrust,代码行数:17,代码来源:UpdateOrganizationAction.java


示例13: uploadImage

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
public void uploadImage(FileUploadEvent event) {
	UploadedFile uploadedFile = event.getUploadedFile();
	this.uploadedImage = null;
	try {
		GluuImage image = imageService.constructImage(identity.getUser(), uploadedFile);
		image.setStoreTemporary(true);
		if (imageService.createImageFiles(image)) {
			this.uploadedImage = image;
		}
	} finally {
		try {
			uploadedFile.delete();
		} catch (IOException ex) {
			log.error("Failed to remove temporary image", ex);
		}
	}
}
 
开发者ID:GluuFederation,项目名称:oxTrust,代码行数:18,代码来源:CustomAttributeAction.java


示例14: processFileUpload

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
@Override
public void processFileUpload(FileUploadEvent event)
{
	UploadedFile uploadedFile = event.getUploadedFile();

	try
	{
		String content = IOUtils.toString(uploadedFile.getInputStream());

		FileInfo fileInfo = new FileInfo();
		fileInfo.setName(uploadedFile.getName());
		fileInfo.setContent(content);
		fileInfo.setSessionId(sessionId);
		fileInfo.setUser(sessionUser);

		fileInfoEvent.fire(fileInfoService.create(fileInfo));
	}
	catch (IOException e)
	{
		// TODO: proper error handling

		return;
	}
}
 
开发者ID:jithub2005,项目名称:RemInD,代码行数:25,代码来源:FileUploadController.java


示例15: constructImage

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
/**
 * Creates GluuImage object from uploaded file
 * 
 * @param creator
 *            person uploading the file
 * @param uploadedFile
 *            uploaded file
 * @return GluuImage object
 */
public GluuImage constructImage(GluuCustomPerson creator, UploadedFile uploadedFile) {
	GluuImage image = new GluuImage();
	image.setUuid(RepositoryUtility.generateUUID());
	image.setCreationDate(new Date());
	image.setCreator(creator.getDn());
	image.setSourceName(FilenameUtils.getName(uploadedFile.getName()));
	image.setSourceContentType(uploadedFile.getContentType());
	image.setSize(uploadedFile.getSize());
	image.setData(uploadedFile.getData());

	return image;
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:22,代码来源:ImageService.java


示例16: constructImageWithThumbnail

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
public GluuImage constructImageWithThumbnail(GluuCustomPerson creator, UploadedFile uploadedFile, int thumbWidth, int thumbHeight) {
	GluuImage image = constructImage(creator, uploadedFile);
	
	try {
		imageRepository.addThumbnail(image, thumbWidth, thumbHeight);
	} catch (Exception ex) {
		log.error("Failed to generate thumbnail for photo {0}", ex, image);
	}

	return image;
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:12,代码来源:ImageService.java


示例17: getImageDate

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
public byte[] getImageDate(UploadedFile uploadedFile) {
	if (uploadedFile == null) {
		return null;
	}

	return uploadedFile.getData();
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:8,代码来源:ImageService.java


示例18: saveIDPMetadataFile

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
public String saveIDPMetadataFile(UploadedFile uploadedFile, IDPEntry idp) throws IOException {
    String baseDir = LDAPUtility.getBaseDirectory() + File.separator + "webapps" + File.separator + "asimba" 
            + File.separator + "WEB-INF" + File.separator + "sample-data" + File.separator + "idp";
    
    byte[] fileContent = Utils.copyUploadedFile(uploadedFile);
    
    // save copy to LDAP:
    idp.setMetadataXMLText(new String(fileContent, "UTF8"));
    
    return Utils.saveRandomFile(fileContent, baseDir, "xml");
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:12,代码来源:AsimbaService.java


示例19: setCustLogoImage

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
public void setCustLogoImage(FileUploadEvent event) {
	UploadedFile uploadedFile = event.getUploadedFile();
	try {
		setCustLogoImageImpl(uploadedFile);
	} finally {
		try {
			uploadedFile.delete();
		} catch (IOException ex) {
			log.error("Failed to remove temporary image", ex);
		}
	}
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:13,代码来源:UpdateOrganizationAction.java


示例20: setFaviconImage

import org.richfaces.model.UploadedFile; //导入依赖的package包/类
public void setFaviconImage(FileUploadEvent event) {
	UploadedFile uploadedFile = event.getUploadedFile();
	try {
		setFaviconImageImpl(uploadedFile);
	} finally {
		try {
			uploadedFile.delete();
		} catch (IOException ex) {
			log.error("Failed to remove temporary image", ex);
		}
	}
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:13,代码来源:UpdateOrganizationAction.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java AbstractReplacer类代码示例发布时间:2022-05-22
下一篇:
Java DownloadOptions类代码示例发布时间: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