本文整理汇总了Java中net.sourceforge.stripes.action.FileBean.delete方法的典型用法代码示例。如果您正苦于以下问题:Java FileBean.delete方法的具体用法?Java FileBean.delete怎么用?Java FileBean.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sourceforge.stripes.action.FileBean
的用法示例。
在下文中一共展示了FileBean.delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveUpload
import net.sourceforge.stripes.action.FileBean; //导入方法依赖的package包/类
protected void saveUpload(HttpServletRequest req) {
StripesRequestWrapper stripesRequest =
StripesRequestWrapper.findStripesWrapper(req);
final FileBean fileBean = stripesRequest.getFileParameterValue(inputName);
if (fileBean != null) {
try {
newBlob(fileBean);
} catch (IOException e) {
logger.error("Could not read upload", e);
forgetBlob();
blobError = getText("elements.error.field.fileblob.uploadFailed");
try {
fileBean.delete();
} catch (IOException e1) {
logger.error("Could not delete FileBean", e1);
}
}
} else {
logger.debug("An update of a blob was requested, but nothing was uploaded. The previous value will be kept.");
keepOldBlob(req);
}
}
示例2: newBlob
import net.sourceforge.stripes.action.FileBean; //导入方法依赖的package包/类
protected void newBlob(final FileBean fileBean) throws IOException {
blob = new Blob(generateNewCode()) {
@Override
public void dispose() {
super.dispose();
try {
fileBean.delete();
} catch (IOException e) {
logger.warn("Could not delete file bean", e);
}
}
};
blob.setInputStream(fileBean.getInputStream());
blob.setFilename(fileBean.getFileName());
blob.setContentType(fileBean.getContentType());
blob.setCreateTimestamp(new DateTime());
blob.setPropertiesLoaded(true);
}
示例3: upload
import net.sourceforge.stripes.action.FileBean; //导入方法依赖的package包/类
public Resolution upload() throws Exception {
Invoice invc = null;
capturedCount = 0;
final int nItems = (getItems()==null ? 0 : getItems().size());
if (nItems>0) {
Log.out.debug("InvoiceUpload "+String.valueOf(nItems)+" items found");
try {
connect(getSessionAttribute("nickname"), getSessionAttribute("password"));
Dms oDms = getSession().getDms();
Document rcpt = oDms.getDocument(getRecipientTaxPayer());
String sTaxPayerId = rcpt.type().name().equals("TaxPayer") ? getRecipientTaxPayer() : getSessionAttribute("taxpayer_docid");
TaxPayer txpy = new TaxPayer(getSession().getDms(), sTaxPayerId);
Invoices invs = txpy.invoices(getSession());
invc = invs.create(getSession(), getSessionAttribute("user_uuid"), getServiceFlavor(),
sTaxPayerId, getBillerTaxPayer(), getRecipientTaxPayer());
capureddocid = invc.id();
for (FileBean attachment : getItems()) {
if (attachment != null) {
if (attachment.getSize() > 0) {
InvoicePage page = invc.createPage(getSession(), attachment.getInputStream(), ++capturedCount, attachment.getFileName());
if (capturedCount==1) {
capuredpage1 = page.id();
}
attachment.delete();
} else {
ValidationError error = new SimpleError(attachment.getFileName()+ " is not a valid file." );
getContext().getValidationErrors().add("items" , error);
}
}
} // next
disconnect();
Log.out.debug("Done uploading items");
if (capturedCount>0) {
ThumbnailCreator.createThumbnailFor(capureddocid, capuredpage1);
}
} catch (Exception e) {
Log.out.error("InvoiceUpload.upload() "+e.getClass().getName()+" "+e.getMessage(), e);
getContext().getMessages().add(new SimpleMessage("ERROR "+e.getMessage(), items));
} finally { close(); }
} else {
Log.out.debug("InvoiceUpload no items found");
}
if (invc==null)
return new RedirectResolution("/error.jsp");
if (invc.getServiceFlavor().equals(CaptureServiceFlavor.BASIC))
return new ForwardResolution("EditInvoice.action?id="+invc.id());
else
return new ForwardResolution(FORM);
}
示例4: upload
import net.sourceforge.stripes.action.FileBean; //导入方法依赖的package包/类
public Resolution upload() throws Exception {
String sFwd;
Ticket tckt = null;
BillNote bill = null;
setCapturedCount(0);
final int nItems = (getItems()==null ? 0 : getItems().size());
if (nItems>0) {
Log.out.debug("UploadBillNote "+String.valueOf(nItems)+" items found");
try {
connect(getSessionAttribute("nickname"), getSessionAttribute("password"));
TaxPayer txpy = new TaxPayer(getSession().getDms(), getRecipientTaxPayer());
bill = txpy.billnotes(getSession()).forConcept(getSession(), getConcept(), getEmployee());
setCapturedPage1("");
for (FileBean attachment : getItems()) {
if (attachment != null) {
if (attachment.getSize() > 0) {
if (tckt==null) {
tckt = bill.createTicket(getSession(), getAccount());
setId(tckt.id());
FlashScope oFscope = FlashScope.getCurrent(getContext().getRequest(), true);
oFscope.put("ticket_docid", tckt.id());
}
TicketNote note = tckt.createNote(getSession(), attachment.getInputStream(), incCapturedCount(), attachment.getFileName());
if (getCapturedPage1().length()==0) setCapturedPage1(note.id());
attachment.delete();
} else {
ValidationError error = new SimpleError(attachment.getFileName()+ " is not a valid file." );
getContext().getValidationErrors().add("items" , error);
}
}
} // next
disconnect();
if (getCapturedCount()>0)
ThumbnailCreator.createThumbnailFor(getId(), getCapturedPage1());
sFwd = "EditBillNote.action?id="+tckt.id();
} catch (IllegalStateException e) {
Log.out.error("BillNoteUpload.upload() "+e.getClass().getName()+" "+e.getMessage(), e);
getContext().getMessages().add(new SimpleMessage("ERROR "+e.getMessage(), items));
sFwd = "error.jsp?e=couldnotloadticket";
} finally { close(); }
} else {
Log.out.debug("UploadBillNote no items found");
sFwd = "error.jsp?e=couldnotloadticket";
}
return new ForwardResolution(sFwd);
}