Hi collegues,
could you be so kind to help me in this task?
I am using the File Upload UI in WebDynpro Java. When I am uploading the file from my local system to the server, I need to retrieve the full path and attach it as document to an e-mail.
this is my "onActionUploadFile"
... IPrivateConvoCompView.IResourceElement contextElement = wdContext.currentResourceElement(); IWDResource resource = contextElement.getFileResource(); if (contextElement.getFileResource() != null) { try{ String resourcePath = WDURLGenerator.getPublicResourcePath( resource.getUrl( WDFileDownloadBehaviour.OPEN_INPLACE.ordinal() ) ); this.msgmgr.reportSuccess("New URL : " + resourcePath); } catch (Exception e) { throw new WDRuntimeException(e); } ...
and then I'd like to use it as an attachment, passing it (name: attach - type IWDResource) to a method
... MimeBodyPart attachBodyPart = new MimeBodyPart(); Multipart multipart = new MimeMultipart(); if (attach != null) { try { DataSource source = new FileDataSource( attach.getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()) ); attachBodyPart.setDataHandler(new DataHandler(source)); attachBodyPart.setFileName(attach.getResourceName()); multipart.addBodyPart(attachBodyPart); } catch (Exception e) { throw new IOException("Ecc: " + e.getStackTrace()[0].toString()); } ...
but I am not able to locate correctly the file on the server using FileDataSource
Any advice?
Thanks in advance for your replies.
Regards,
Mirco.