Accessing resources(files) outside WAR application file

Discussion in 'Java' started by may, Oct 21, 2003.

  1. may

    may Guest

    I would like to know if it is possible to access resources, e.g. image
    file, text file which reside on the application server (but not in
    war/ear files) using JSPs/servlet.

    Tasks I am trying to accomplish are:

    - User to upload file (image, text). I can do this using JSPs and
    Servlet/struts. File is uploaded on the appserver at a location
    relative to webcontext. File path is apended after obtaining
    HttpSerletRequest.getContextPath().

    - User then clicks a link to view the image/text file just uploaded in
    the previous step.

    Last step is where the problem occurs as link is trying to access
    resource which is not within its EAR/WAR file and therefore it can not
    find the file. Using HttpSerletRequest.getContextPath() returns path
    within the WAR file which is root folder of WAR file. File uploaded
    in the previous step can not be added to WAR file unless the
    application WAR file is rebuilt and redeployed. Redeploying
    application every time any user uploads a file is obviously not a
    desirable approach.

    I do not know if it is possible to access file system on application
    server outside of the web application WAR/EAR files.

    Or is redeploying application is necessary which means that it will
    need to be scheduled at an appropriate time and therefore user will
    not be able to view the web page until then.

    Any help/pointers will be much appreciated.
     
    may, Oct 21, 2003
    #1
    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. Miguel De Anda

    Config files in .war files?

    Miguel De Anda, Aug 14, 2003, in forum: Java
    Replies:
    2
    Views:
    405
    Miguel De Anda
    Aug 15, 2003
  2. Andy Fish
    Replies:
    0
    Views:
    302
    Andy Fish
    Jun 23, 2004
  3. Stephan Koser
    Replies:
    3
    Views:
    687
    Juha Laiho
    Dec 7, 2004
  4. Replies:
    3
    Views:
    5,423
    Juha Laiho
    Jul 22, 2006
  5. Krzysztof Poc

    outside type, outside function

    Krzysztof Poc, Feb 3, 2012, in forum: C++
    Replies:
    1
    Views:
    305
    Victor Bazarov
    Feb 7, 2012
Loading...

Share This Page