1 Reply Latest reply on Nov 1, 2012 7:30 PM by mataratones

    How to load a file packaged in the .esb?

    mataratones

      I'm trying to load an XSLT file from the .esb package.  (This is for a custom action, ignore for the moment why I'm not doing an XsltAction.)  The base path, for some reason, is jboss-as\bin\, which is obviously not in the .esb, and when I try to use a relative path that goes up a directory ("../"), I get a MalformedURL exception.  A servlet would have a context, but my class is not a servlet, so I don't know how to get at a file inside the .esb.  I don't think this is an unusual thing to do, but obviously I have no idea how to do it, and I would appreciate any help.

       

      Derek

        • 1. Re: How to load a file packaged in the .esb?
          mataratones

          I figured out how to answer this, but I went out of the frying pan into the fire.

           

          I can get to a file in the .esb by calling getClass().getResource("path"), being sure to start the path with a "/" to indicate it is from the root esbcontent directory.

           

          So I managed to load the XSLT file, but it also references an external file as an XSD.  Once again, using a simple relative path inside the XSLT is not working.  I tried setting the SystemID on the transformer (useful advice from http://stackoverflow.com/questions/7236291/saxon-error-with-xslt-import-statement), but that didn't help.  I suppose I need a URIResolver, but I don't know how to resolve the path since it isn't part of the regular filesystem.

           

          Derek