on 04-14-2008 2:46 PM
Hello,
I try to build a WebDynpro -Application, that allows to download files from a KM.
When I use the UI-Element FileDownload alone, everything works fine.
When I add the FileDownload-Element as column to a table, I get an [IllegalArgumentException|http://ubuntuusers.de/paste/182148/]
This is the code I use:
IWDAttributeInfo attributeInfo2 =wdContext.getNodeInfo()
.getAttribute(IPrivateResultView.IDownloadNodeElement.DOWNLOAD_FILE);
IWDModifiableBinaryType binaryType2 =(IWDModifiableBinaryType) attributeInfo2
.getModifiableSimpleType();
...
ByteArrayOutputStream out = new ByteArrayOutputStream();
int length;
byte[] part = new byte[10 * 1024];
while ((length = in.read(part)) != -1) {
out.write(part, 0, length);
}
in.close();
byte[] myDLfile = out.toByteArray();
IPrivateResultView.IDownloadNodeElement DLNode =wdContext.nodeDownloadNode()
.createDownloadNodeElement();
DLNode.setDownloadFile(myDLfile);
DLNode.setFileName(resource.getDisplayName(true));
wdContext.nodeDownloadNode().addElement(DLNode);
binaryType2.setFileName(resource.getDisplayName(true));
binaryType2.setMimeType(WDWebResourceType.UNKNOWN);
DownloadFile is of type binary.
Hello nikhiL,
thank you for the quick answer. I tried, what you told me, but the error (java.lang.IllegalArgumentException) is still the same...
Best regards,
Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello nikhiL,
you were right, my mistake was not to use the nodeDownloadNode().
With this code, it worked:
IWDAttributeInfo attributeInfo2 =wdContext.nodeDownloadNode().getNodeInfo().
getAttribute(IPrivateResultView.IDownloadNodeElement.DOWNLOAD_FILE);
Thanks alot!
Best regards,
Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
replace
IWDAttributeInfo attributeInfo2 =wdContext.getNodeInfo()
.getAttribute(IPrivateResultView.IDownloadNodeElement.DOWNLOAD_FILE);
by
IWDAttributeInfo attributeInfo2 =wdContext.getNodeInfo()
.getAttribute("Download_file"); // case-sensitive
nikhiL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.