开发者

AS400 prog and dynamic classpath

开发者 https://www.devze.com 2023-03-07 10:54 出处:网络
i have to call an AS400 prog by a java class. i\'ve found the method ProgramCallDocument(connexion, \"myProg\");

i have to call an AS400 prog by a java class. i've found the method

ProgramCallDocument(connexion, "myProg");

it works fi开发者_如何转开发ne, but "myProg" has to be a file into class path. But in my case this will be sent by a user through an html form.

So my question is: how can i load an xml file into the classpath dynamically ??


If your XML file is in your classpath, then you can get an InputStream for it by using something like this:

public InputStream getInputStreamFromClasspathFile(String filename) {
    return this.getClass().getClassLoader().getResourceAsStream(filename);
}

You should be able to parse your XML from the InputStream.


Not entirely sure this is what you're looking for ... but the ProgramCallDocument class let's you specify the class loader that's used to load the PCML document from.

See ProgramCallDocument

david


That's ok !

i've found out this method:

public ProgramCallDocument(AS400 sys,
                       String docName,
                       InputStream docStream,
                       ClassLoader loader,
                       InputStream xsdStream,
                       int type)
                throws PcmlException

which allow to create a DocumentCall based on the inputstream.

0

精彩评论

暂无评论...
验证码 换一张
取 消