cancel
Showing results for 
Search instead for 
Did you mean: 

File Down load problem

Former Member
0 Kudos

Hi All,

I am using the filedownload control in my application , when i run the application i am getting the following error

The initial exception that caused the request to fail, was:

com.sap.tc.webdynpro.services.exceptions.InvalidUrlRuntimeException: Invalid URL=../../../resources/local/FileDownLoad/Components/com.net.Fdownload/<>

at com.sap.tc.webdynpro.serverimpl.core.url.AbstractURLGenerator.checkURL(AbstractURLGenerator.java:601)

at com.sap.tc.webdynpro.serverimpl.core.url.AbstractURLGenerator.applyWSRPTemplate(AbstractURLGenerator.java:1170)

at com.sap.tc.webdynpro.serverimpl.core.url.AbstractURLGenerator.computeWebResourceURL(AbstractURLGenerator.java:1014)

at com.sap.tc.webdynpro.serverimpl.core.url.AbstractURLGenerator.getWebResourceURLInternal(AbstractURLGenerator.java:213)

at com.sap.tc.webdynpro.services.sal.url.core.URLGeneratorInternal.getWebResourceURLInternal(URLGeneratorInternal.java:284)

I have wrote the following code

IWDAttributeInfo attInfo =

wdContext.getNodeInfo().getAttribute("datasource");

IWDModifiableBinaryType mBinaryType =

(IWDModifiableBinaryType) attInfo.getModifiableSimpleType();

String mFileId = "test";

mBinaryType.setFileName("blah.txt");

mBinaryType.setMimeType(WDWebResourceType.TXT);

Writer output = null;

//use buffering

//FileWriter always assumes default encoding is OK!

try

{

File testFile = new File("C:
Temp
blah.txt");

output = new BufferedWriter( new FileWriter(testFile) );

output.write("dsfsdfsdfdsfs");

output.close();

}

catch (Exception ex)

{

}

finally {

//flush and close both "output" and its underlying FileWriter

//if (output != null) output.close();

}

try

{

FileInputStream FileIn =

new FileInputStream("C:
Temp
blah.txt");

byte Bytes[] = new byte[FileIn.available()];

FileIn.read(Bytes, 0, Bytes.length);

FileIn.close();

wdContext.currentContextElement().setDatasource(Bytes);

}

Can any one tell me what is wrong with the code.

Accepted Solutions (0)

Answers (1)

Answers (1)

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Sapuser,

do you work with SAP NetWeaver 04 or with NetWeaver 7.0? Nevertheless you must create a Cached Web Resource in NW 04. Please read my corresponding Tutorial.

Regards, Bertram