• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

get to files on another partition

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Helo,

i have a problem i don't know how to solve.

I have tomcat installed for example on C:/SERVER/Tomcat

I have some files like .txt and .mp3 on D:/data/

now the page works fine... i can acces it ower http://localhost:80

but how can i access to the files on D:/data ower HTTP protocol??

like http://localhost:80/D/data

???
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, D Pasha!

HTTP is not a file server protocol. So you can't access files through it.

What you can do is setup a webapp that returns the contents of a file in response to a URL request. That is default behavior for resources inside a WAR (except for WEB-INF and its children). For any other location, however, you have to provide your own file-transfer logic. This can be done with a fairly simple servlet that parses the URL to build a filename path, opens the file and copies its contents to the HttpServletResponse data stream.
 
m pasha
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SOLVED!

i had to put COntextPath to do HOST part in the server.xml file of Tomcat Config folder



i can get to the files like .mp3 now like

http://localhost/files/test.mp3

thanks anyway Tim

 
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic