Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
David Ilechukwu
[URGENT] Best Liferay Directory to Store Private Files?
27. Januar 2013 10:06
Antwort

David Ilechukwu

Rang: Regular Member

Nachrichten: 114

Eintrittsdatum: 7. Juni 2010

Neue Beiträge

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. Januar 2013 11:35
Antwort

Jelmer Kuperus

Rang: Liferay Legend

Nachrichten: 1190

Eintrittsdatum: 10. März 2010

Neue Beiträge

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. Januar 2013 14:50
Antwort

David Ilechukwu

Rang: Regular Member

Nachrichten: 114

Eintrittsdatum: 7. Juni 2010

Neue Beiträge

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. Januar 2013 02:02
Antwort

Vilmos Papp

LIFERAY STAFF

Rang: Expert

Nachrichten: 423

Eintrittsdatum: 21. Oktober 2010

Neue Beiträge

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. Januar 2013 02:21
Antwort

David Ilechukwu

Rang: Regular Member

Nachrichten: 114

Eintrittsdatum: 7. Juni 2010

Neue Beiträge

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. Januar 2013 03:49
Antwort

gofri _

Rang: Junior Member

Nachrichten: 94

Eintrittsdatum: 2. März 2007

Neue Beiträge

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. Januar 2013 06:36
Antwort

Vilmos Papp

LIFERAY STAFF

Rang: Expert

Nachrichten: 423

Eintrittsdatum: 21. Oktober 2010

Neue Beiträge

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