Results 1 to 3 of 3
  1. #1
    James Manley is offline Member
    Join Date
    Jan 2011
    Posts
    6
    Rep Power
    0

    Question 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

  2. #2
    James Manley is offline Member
    Join Date
    Jan 2011
    Posts
    6
    Rep Power
    0

    Default

    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;

  3. #3
    James Manley is offline Member
    Join Date
    Jan 2011
    Posts
    6
    Rep Power
    0

    Thumbs up

    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

  1. java classes in webapp which are not servlets
    By iwanabeguru in forum New To Java
    Replies: 3
    Last Post: 02-08-2011, 02:45 PM
  2. Replies: 11
    Last Post: 07-07-2010, 07:02 AM
  3. JDK Directory
    By PhQ in forum Eclipse
    Replies: 1
    Last Post: 03-21-2010, 04:54 AM
  4. catching uncaught exceptions using Spring / WebApp
    By taille50 in forum Web Frameworks
    Replies: 1
    Last Post: 10-18-2009, 02:14 AM
  5. root directory
    By raghu9198 in forum New To Java
    Replies: 19
    Last Post: 01-06-2009, 04:11 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •