Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Important and Urgent - Please reply

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Author
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic