[jpos-users] Using FSDMsg in an Application server

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[jpos-users] Using FSDMsg in an Application server

Paul Irving
Hi,

This is a high level question about using FSDMsg when deploying to an application server.

For my ISO projects using ISOMsg the packagers are read using this:

public static ISOPackager getPackager(final String filename) throws ISOException {  
        InputStream is = XmlPackagerFactory.class.getResourceAsStream("/com/mypackage/jpos/packgers/xml/" + filename);  
        return new GenericPackager(is);  
}

For the FSDMsg I want to include the xml files as part of the jar, so I retrieve them using:

public static final URL BASE = XmlFSDSchemaFactory.class.getResource("/com/mypackage/jpos/packgers/xml/FSDMsg/")
public static final String PROTOCOL = "file:";

Now this works happily for a stand alone java application, but when the jar is deployed into an application server, the path retrieved is incorrectly. However, if I use the following in the app server:

InputStream is = XmlFSDSchemaFactory.class.getResourceAsStream("/com/mypackage/jpos/packgers/xml/" + filename);

then the path to the file is always correct and the I can read the XML schema as an inputStream. So it seems getResourceAsStream is more portable than getResourceAsStream for some reason.

As my application needs to run standalone or deployed in an App server could anyone recommend a 'portable' way of getting the XML schema file paths?? Or a way of using an input stream instead of file paths??

Thanks in advance

Paul


--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/0772ee24-e55a-4504-af7d-33177760d291%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Using FSDMsg in an Application server

Alejandro Revilla

Take a look at FSDMsg implementation, in particular the loadSchema message around line 605:

https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/util/FSDMsg.java#L605

If the schema prefix is jar: it picks it from the classpath.

Let us know if that works for you.




--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3Dm7O%2B3Zr43B2aY-P%3D3UUt6tHiNLjx2%2BYx9T79SmjjZ-vg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Using FSDMsg in an Application server

Paul Irving
Hi Alejandro,

Apologies in the delay, but this works perfectly, thank you.

I still have other issues, but that's for another question :-)  

Paul

On 26 April 2017 at 23:06, Alejandro Revilla <[hidden email]> wrote:

Take a look at FSDMsg implementation, in particular the loadSchema message around line 605:

https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/util/FSDMsg.java#L605

If the schema prefix is jar: it picks it from the classpath.

Let us know if that works for you.




--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to a topic in the Google Groups "jPOS Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jpos-users/GQUrRQTUhCU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3Dm7O%2B3Zr43B2aY-P%3D3UUt6tHiNLjx2%2BYx9T79SmjjZ-vg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAZNfA5YCMa%2BtAumw37Pi3UY50SiL-rfHGDP8Ty%3DG6ZBoqRFxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Using FSDMsg in an Application server

Alejandro Revilla
Awesome. Thanks for the heads-up.



On Fri, Jun 16, 2017 at 9:19 AM, Paul Irving <[hidden email]> wrote:
Hi Alejandro,

Apologies in the delay, but this works perfectly, thank you.

I still have other issues, but that's for another question :-)  

Paul

On 26 April 2017 at 23:06, Alejandro Revilla <[hidden email]> wrote:

Take a look at FSDMsg implementation, in particular the loadSchema message around line 605:

https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/util/FSDMsg.java#L605

If the schema prefix is jar: it picks it from the classpath.

Let us know if that works for you.




--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to a topic in the Google Groups "jPOS Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jpos-users/GQUrRQTUhCU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3Dm7O%2B3Zr43B2aY-P%3D3UUt6tHiNLjx2%2BYx9T79SmjjZ-vg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAZNfA5YCMa%2BtAumw37Pi3UY50SiL-rfHGDP8Ty%3DG6ZBoqRFxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3DnFP0Tta6uzsy0mM%2BeBsjYammKLq97ceDqG6_mfdRXoxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.