on 07-26-2004 1:42 PM
Hello,
Ich have a following question:
My WebDynpro-Application works with some xml files, which have to be placed into WebDynpro-Directory. Where can i create a directory for my xml documents? And how can i get a path to this directory in my WebDynpro Application?
With best regards
Michael Belenki
Put your XML file in the resource folder src/mimes/Components/<component> and use
WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart())
to get the resource path.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Thanks. But i have the problem that i cannot work with file, because the path is relative.
WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart())
returns something like
this .\temp\webdynpro\web\localhost\myWebDynproApplication\packagename\Component\myfile.xml
And now i would like to create File-object
File myFile = new File(path).
How can i get a full path to my xml document?
With best regards
Michael Belenki
Hi Stefan,
Yes, you are right, this was sadly not the problem.
With the help of 'WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart() + File.separator + "myfile.xml")' i get a path, which doesn't exist: path: ".\temp\webdynpro\web\local\WebDynpro_MyProject\com.sap.tc.webdynpro.myproject.mycomp\Component\myfile.xml"
Right path is:
C:\usr\sap\J2E\JC00\j2ee\cluster\server0\temp\webdynpro\web\local\WebDynpro_MyProject\Components\com.sap.tc.webdynpro.myproject.mycomp\myfile.xml
But how can i get a right path and is it bug?
with best regards
Michael
Hi Michael,
no, it's not a bug, the reason is, how you make the call. Since you concat wdComponentAPI.getDeployableObjectPart() + File.separator + "myfile.xml", you really call WDUrlGenerator.getResourcePath(String), which results in ".\temp\webdynpro\web\<objectName>". <objectName> is the fully qualified name of the deployable object part appended with the file in your call.
Please use the following instead:
try {
String url = WDURLGenerator.getResourcePath(
wdComponentAPI.getDeployableObjectPart(),
"myfile.xml"
);
wdComponentAPI.getMessageManager().reportSuccess(url);
} catch (WDAliasResolvingException e) {
wdComponentAPI.getMessageManager().reportException(
e.getMessage(), true
);
}
Hope that helps.
Best regards
Stefan
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.