M
may
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.
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.