[Dev] Get Absolute Path Of File In App Cloud

2015-09-30 Thread Lasantha Dharmakeerthi
Hi Devs I have created jaggery app and deployed it in wso2 app cloud. I have method to read a certificate file and certificate is in the jaggery app. In local Aplication Server I used file path like wise “ repository/deployment/server/jaggeryapps/Parkingapp /resources/wso2defaultpub.cer” So how

Re: [Dev] Get Absolute Path Of File In App Cloud

2015-09-30 Thread Sajith Ariyarathna
Hi Lasantha, Assuming, You are reading the certificate file using Jaggery. In your Jaggery app, certificate file is in '*resources/wso2defaultpub.cer*' path You can read your file using Jaggery File [1] object. Refer following code snippet. var certFile = new

Re: [Dev] Get Absolute Path Of File In App Cloud

2015-09-30 Thread Dimuthu Leelarathne
Hi, Use getResourceAsStream method. thanks, dimuthu On Wed, Sep 30, 2015 at 3:11 PM, Lasantha Dharmakeerthi wrote: > Hi > Devs > > I have created jaggery app and deployed it in wso2 app cloud. I have > method to read a certificate file and certificate is in the jaggery

Re: [Dev] Get Absolute Path Of File In App Cloud

2015-09-30 Thread Lasantha Dharmakeerthi
Hi All I use java inside my jaggery app to read certificate file and get public key. *code* inputStream = new Packages.java.io.FileInputStream(certificatePath); var key = Packages.java.security.cert.CertificateFactory.getInstance("X.509").generateCertificate(inputStream).getPublicKey(); As

Re: [Dev] Get Absolute Path Of File In App Cloud

2015-09-30 Thread Sajith Ariyarathna
Hi Lasantha, Please find my comments inline. > As sajith said can read certificate file using Jaggery File object. But > is there a way to get public key from that way?? > You cannot get the public key using Jaggery File object since File object represent a file, not a security certificate.

Re: [Dev] Get Absolute Path Of File In App Cloud

2015-09-30 Thread Sajith Ariyarathna
Hi Lasantha, For Jaggery, working directory is your app directory which is in /repository/deployment/server/jaggeryapps/ . However if you are using Java inside Jaggery, for those Java codes working directory is carbon product directory . Hence variable certificatePath should be

Re: [Dev] Get Absolute Path Of File In App Cloud

2015-09-30 Thread Sajith Ariyarathna
Hi Lasantha, Jaggery server runs on top of Carbon. So Java libraries which are added to Carbon are also available in Jaggery. External Java libraries can be added to Carbon by dropping them into /repository/components/lib directory (more details [1]). Don't forget to restart the server. [1]