Results 1 to 3 of 3
- 02-25-2011, 08:31 AM #1
Member
- Join Date
- Jan 2011
- Posts
- 6
- Rep Power
- 0
Looking for a variable containing webapp directory
Hello, I am looking for a environement variable that contains the webapp directory in JBOSS. My aim is to create a excel file that will be downloaded to the client. And for that I nead a exact directory. I succed in writing the location in hard in my code but this solution is not good, I nead a relative directory. On google I found a ${HOME_JSF} variable but it doesn't work in my system.
Thanks for hellping,
James
- 03-15-2011, 08:43 AM #2
Member
- Join Date
- Jan 2011
- Posts
- 6
- Rep Power
- 0
To find a location of a file in the servlet http://<domaine.com>:<port>/<name of the Servlet>/<inputFile> on remote host
will be on local host
inputFileDir = System.getProperty("catalina.base")+"/wtpwebapps/<name of the Servlet>/"+inputFile;
- 03-23-2011, 12:56 PM #3
Member
- Join Date
- Jan 2011
- Posts
- 6
- Rep Power
- 0
This code give the full local contexte path :
FacesContext facesContext = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest)facesContext.getExternalContex t().getRequest();
String contextPath = request.getContextPath();
String fullContextPath = System.getProperty("catalina.base")+"/webapps/"+contextPath;
System.out.println(fullContextPath);
:p
Similar Threads
-
java classes in webapp which are not servlets
By iwanabeguru in forum New To JavaReplies: 3Last Post: 02-08-2011, 01:45 PM -
How do I substitute any variable for a hardcoded variable
By Weazel Boy in forum New To JavaReplies: 11Last Post: 07-07-2010, 06:02 AM -
JDK Directory
By PhQ in forum EclipseReplies: 1Last Post: 03-21-2010, 03:54 AM -
catching uncaught exceptions using Spring / WebApp
By taille50 in forum Web FrameworksReplies: 1Last Post: 10-18-2009, 01:14 AM -
root directory
By raghu9198 in forum New To JavaReplies: 19Last Post: 01-06-2009, 03:11 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks