wood burning stoves 2.0*
The moose likes JSP and the fly likes Important and Urgent - Please reply Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Important and Urgent - Please reply" Watch "Important and Urgent - Please reply" New topic
Author

Important and Urgent - Please reply

peter brews
Greenhorn

Joined: Feb 11, 2002
Posts: 20
I am developing a Jsp application where in I have links to open Word .doc files. The problem is the entire URL of the doc file with the directory structure on the server (physical location of the file on the unix server) is displyed on the browser when the users click the hyperlink.
I do not want to display the file location on the browser. Is there a way to do this.
example: filename /home/Directory/Dir1/test.doc
/home/Directory is mapped as the root directory on the web server.
When the user clicks this link he sees
http://localhost:<port>/Dir1/test.doc
I want to hide the /Dir1/test.doc portion of the URL.
Thanks, Pete
Mark Howard
Ranch Hand

Joined: Feb 14, 2001
Posts: 285
Hi Peter
I had a similar problem in trying to prevent the path being displayed in the status bar at the bottom of the browser when the user rolled their mouse over a link. I found a solution by using JavaScript, a whole host of which can be found at this site.
Not sure how you prevent the path from appearing in the address bar though
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
It seems to me that if you wanted a link to download a Word file, you could have the link point to a jsp that had some code that was something like this:
page with link

getDocument.jsp

Your link and url will only show getDocument.jsp?file=myDoc.doc. Setting the contentType will give the client an idea how to treat the file, be it prompting for download or opening up Word.
HTH
[ January 23, 2003: Message edited by: Jason Menard ]
Marty Hall
Author
Ranch Hand

Joined: Jan 02, 2003
Posts: 111
I am developing a Jsp application where in I have links to open Word .doc files. The problem is the entire URL of the doc file with the directory structure on the server (physical location of the file on the unix server) is displyed on the browser when the users click the hyperlink.
I do not want to display the file location on the browser. [...]
When the user clicks this link he sees
http://localhost:<port>/Dir1/test.doc
I want to hide the /Dir1/test.doc portion of the URL.

Would you be satisfied with http://localhost/foo/bar? If so, just map a servlet in the "foo" Web application to the URL "bar". Have the servlet read the Word file from a FileInputStream and pass it through to the user by writeing to response.getOutputStream (first setting the MIME type to application/msword with response.setContentType).
If you need to get rid of the "foo" part, you will have to use your server's default Web application, which varies from server to server. It is the ROOT Web app in Tomcat, for instance.
Cheers-
- Marty


Java training and consulting
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Important and Urgent - Please reply
 
Similar Threads
Tomcat url redirect problem
Problem Invoking Servlet thru Proxy Server
JAX-WS deployment
Difference JSP File & JSP Page
Oracle 9i AS and struts!! Urgent