Skip to Content
author's profile photo
Former Member

Work with Directory

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    author's profile photo
    Former Member
    Jul 26, 2004 at 01:07 PM

    Put your XML file in the resource folder src/mimes/Components/<component> and use

    WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart())
    

    to get the resource path.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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