JSP to get the WAR file location

Discussion in 'Java' started by jrefactors@hotmail.com, Dec 16, 2004.

  1. Guest

    Any API to get the current project location? Basically I need to get
    the WAR file location,

    For example, proj1.war is located here, and in the JSP code I can get
    the path of WAR file location.

    /appl/myproj/websphere/installedApps/proj1.ear/proj1.war/
    any ideas? thanks!!
     
    , Dec 16, 2004
    #1
    1. Advertising

  2. Chris Smith Guest

    <> wrote:
    > Any API to get the current project location? Basically I need to get
    > the WAR file location,
    >
    > For example, proj1.war is located here, and in the JSP code I can get
    > the path of WAR file location.
    >
    > /appl/myproj/websphere/installedApps/proj1.ear/proj1.war/
    > any ideas? thanks!!


    You can *probably* do it, but not in a reliable way. Search Google's
    USENET gateway for articles by me containing "getCodeSource", and you
    can experiment with and adapt the code there.

    --
    www.designacourse.com
    The Easiest Way To Train Anyone... Anywhere.

    Chris Smith - Lead Software Developer/Technical Trainer
    MindIQ Corporation
     
    Chris Smith, Dec 16, 2004
    #2
    1. Advertising

  3. With Tomcat you can get the context-path the following way:

    webAppPath = getServletContext().getRealPath(".");



    <> schrieb im Newsbeitrag
    news:...
    > Any API to get the current project location? Basically I need to get
    > the WAR file location,
    >
    > For example, proj1.war is located here, and in the JSP code I can get
    > the path of WAR file location.
    >
    > /appl/myproj/websphere/installedApps/proj1.ear/proj1.war/
    > any ideas? thanks!!
    >
     
    Ferenc Hechler, Dec 16, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alberto Rocha
    Replies:
    0
    Views:
    483
    Alberto Rocha
    Apr 30, 2004
  2. Java Job
    Replies:
    1
    Views:
    4,205
    Mike Schilling
    Aug 5, 2004
  3. Replies:
    0
    Views:
    342
  4. ohaya
    Replies:
    2
    Views:
    409
    ohaya
    Aug 5, 2005
  5. Replies:
    3
    Views:
    5,396
    Juha Laiho
    Jul 22, 2006
Loading...

Share This Page