Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Important and Urgent - Please reply

 
peter brews
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic