掲示板
how to get the current path of a portlet or java class? (glassfish)
11年前 に Johan de jong によって更新されました。
how to get the current path of a portlet or java class? (glassfish)
Junior Member 投稿: 41 参加年月日: 12/02/06 最新の投稿
I tried several ways to get it but all i get is the Path to liferay/glassfish-3.1.1/domains/domain1/config/
or the real path of the Liferay portal.
Last thing i tried was : new java.io.File(".").getCanonicalPath();
or the real path of the Liferay portal.
Last thing i tried was : new java.io.File(".").getCanonicalPath();
11年前 に Amit Sharma によって更新されました。
RE: how to get the current path of a portlet or java class? (glassfish)
New Member 投稿: 6 参加年月日: 12/08/29 最新の投稿
Hi Johan, Please try this
this.getClass().getResource("").getPath();
This should give you the path from which current class is being referenced by JVM.
Regards,
Amit Sharma
this.getClass().getResource("").getPath();
This should give you the path from which current class is being referenced by JVM.
Regards,
Amit Sharma
11年前 に David H Nebinger によって更新されました。
RE: how to get the current path of a portlet or java class? (glassfish)
Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
Any implementation that relies on a filesystem path is a bad implementation and poor design.
Reference classpath items, certainly, or use some sort of property to define a filesystem path.
But certainly do not rely on a location in the filesystem where your class/jar lives to be the basis for filesystem access.
Reference classpath items, certainly, or use some sort of property to define a filesystem path.
But certainly do not rely on a location in the filesystem where your class/jar lives to be the basis for filesystem access.
11年前 に Johan de jong によって更新されました。
RE: how to get the current path of a portlet or java class? (glassfish)
Junior Member 投稿: 41 参加年月日: 12/02/06 最新の投稿
I need the current Path of the portlet because i want to save a generated generated picture.
maybe i was thinking wrong. So any other suggestion is appreciated
maybe i was thinking wrong. So any other suggestion is appreciated
11年前 に David H Nebinger によって更新されました。
RE: how to get the current path of a portlet or java class? (glassfish)
Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
If it is a temporary file (doesn't live beyond the restart of the application container), it should be stored in the temp folder.
If it has a longer lifespan, store it to the image gallery.
If it has a longer lifespan, store it to the image gallery.
11年前 に Johan de jong によって更新されました。
RE: how to get the current path of a portlet or java class? (glassfish)
Junior Member 投稿: 41 参加年月日: 12/02/06 最新の投稿
how can i store it in the image gallery?
i thought i needed to know the real path to this gallery too.
when i don't give path the image is stored inside the glassfish's config directory, and IMHO that is the last place where something should be stored.
( i even think that no portlet or liferay should be capable of writting and reading the Glassfish config directory
i thought i needed to know the real path to this gallery too.
when i don't give path the image is stored inside the glassfish's config directory, and IMHO that is the last place where something should be stored.
( i even think that no portlet or liferay should be capable of writting and reading the Glassfish config directory