论坛

主页 » Liferay Portal » English » 3. Development

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
David Ilechukwu
[URGENT] Best Liferay Directory to Store Private Files?
2013年1月27日 上午10:06
答复

David Ilechukwu

等级: Regular Member

帖子: 114

加入日期: 2010年6月7日

最近的帖子

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?
2013年1月27日 上午11:35
答复

Jelmer Kuperus

等级: Liferay Legend

帖子: 1192

加入日期: 2010年3月10日

最近的帖子

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?
2013年1月27日 下午2:50
答复

David Ilechukwu

等级: Regular Member

帖子: 114

加入日期: 2010年6月7日

最近的帖子

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?
2013年1月28日 上午2:02
答复

Vilmos Papp

LIFERAY STAFF

等级: Expert

帖子: 463

加入日期: 2010年10月21日

最近的帖子

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?
2013年1月28日 上午2:21
答复

David Ilechukwu

等级: Regular Member

帖子: 114

加入日期: 2010年6月7日

最近的帖子

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?
2013年1月28日 上午3:49
答复

gofri _

等级: Junior Member

帖子: 94

加入日期: 2007年3月2日

最近的帖子

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?
2013年1月28日 上午6:36
答复

Vilmos Papp

LIFERAY STAFF

等级: Expert

帖子: 463

加入日期: 2010年10月21日

最近的帖子

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