Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
David Ilechukwu
[URGENT] Best Liferay Directory to Store Private Files?
27 gennaio 2013 10.06
Risposta

David Ilechukwu

Punteggio: Regular Member

Messaggi: 128

Data di Iscrizione: 7 giugno 2010

Messaggi recenti

Ok guys,
Here's a quick one

My scenario is as follows:
I need to manually (not using Liferay http upload) upload a very confidential file (actually a company certificate keystore file) to my Liferay Server, such that:
The file should NEVER be accessible over http or https
File can only be accessed in code (say using a String pathToFile parameter).
Question is - where in Liferay (Tomcat Server) would be the best place to put such a sensitive file?

I'm aware that the default system used by Liferay for saving uploaded files can be specified in portal-ext.properties, using say:
dl.store.file.system.root.dir=${liferay.home}/data/document_library.

However, that would specify the default location for uploading files (and that would obviously be accessible over http).

Questions
(1) Where in Liferay Server directory hierarchy would be the best location to store such a file?
(2) How would I access such a file in Liferay (portlet) code?

Quick responses will be highly appreciated! emoticon

Thanks Guys!
Jelmer Kuperus
RE: [URGENT] Best Liferay Directory to Store Private Files?
27 gennaio 2013 11.35
Risposta

Jelmer Kuperus

Punteggio: Liferay Legend

Messaggi: 1192

Data di Iscrizione: 10 marzo 2010

Messaggi recenti

dl.store.file.system.root.dir=${liferay.home}/data/document_library is not directly directly over http

It just holds the bytes of the files stored in the document library but those files cannot be retrieved unless a DlFileEntry exists in the database that points to it.

You should probably store your file under ${liferay.home}/data/whatever
David Ilechukwu
RE: [URGENT] Best Liferay Directory to Store Private Files?
27 gennaio 2013 14.50
Risposta

David Ilechukwu

Punteggio: Regular Member

Messaggi: 128

Data di Iscrizione: 7 giugno 2010

Messaggi recenti

How do you I access a file stored in ${liferay.home}/datain my source code (seems to have skipped my mind).
Please show me a sample code snippet for doing that?

Also - what do you think about storing the file in my portlet-service.jar (seems a more distributed way of doing things)?
Many Thanks

jelmer kuperus:
dl.store.file.system.root.dir=${liferay.home}/data/document_library is not directly directly over http

It just holds the bytes of the files stored in the document library but those files cannot be retrieved unless a DlFileEntry exists in the database that points to it.

You should probably store your file under ${liferay.home}/data/whatever
Vilmos Papp
RE: [URGENT] Best Liferay Directory to Store Private Files?
28 gennaio 2013 2.02
Risposta

Vilmos Papp

LIFERAY STAFF

Punteggio: Liferay Master

Messaggi: 521

Data di Iscrizione: 21 ottobre 2010

Messaggi recenti

Hi David,

You can assess it through Documents and Media services, but if you would be more specific about what type you would like to upload, how frequently you want to change it that would be helpful to find a proper solution.

Regards,
Vilmos
David Ilechukwu
RE: [URGENT] Best Liferay Directory to Store Private Files?
28 gennaio 2013 2.21
Risposta

David Ilechukwu

Punteggio: Regular Member

Messaggi: 128

Data di Iscrizione: 7 giugno 2010

Messaggi recenti

Vilmos Papp:
Hi David,

You can assess it through Documents and Media services, but if you would be more specific about what type you would like to upload, how frequently you want to change it that would be helpful to find a proper solution.

Regards,
Vilmos


Thanks Vilmos -
(1) This file will not be uploaded to the portal - it is simply a file that will be copied into the Liferay data directory.
(2) The file is a certificate keystore (.pfx) - it is needed by the code that generates digital signatures

Hope this makes it clearer.
How do I access this file in code is the question (preferrably using a standard File object). What path would I put as the path to the file? Is it the full path (maybe C:/LiferayPortal/data/whatever) or is it some kind of alias url within Liferay such as /data/whatever/file.pfx

Thanks for quick response.
Regards
gofri _
RE: [URGENT] Best Liferay Directory to Store Private Files?
28 gennaio 2013 3.49
Risposta

gofri _

Punteggio: Junior Member

Messaggi: 92

Data di Iscrizione: 2 marzo 2007

Messaggi recenti

You can use:
1. DLStoreUtil to access files in liferay data folder, skipping Document Library objects' creation, and thus accessing them only through Your code.
2. If You need more "low-level" logic, w/o using Liferay services, You can add file in some folder and point it in portal-ext.properties
Vilmos Papp
RE: [URGENT] Best Liferay Directory to Store Private Files?
28 gennaio 2013 6.36
Risposta

Vilmos Papp

LIFERAY STAFF

Punteggio: Liferay Master

Messaggi: 521

Data di Iscrizione: 21 ottobre 2010

Messaggi recenti

Hi David,

I would create a custom Deployer implementation to deploy these type of files, which would move the file into a folder on the same level of document_library. If it's done, you can check how we access these files relatively and use the same pattern in your own code.

I hope it helps.

Regards,
Vilmos