• 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

Loading a text doc into a browser

 
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a application that loads text docs into the following directory:
C:\jakarta-tomcat-5.0.19\webapps\documentHolder.

What I want to do is open those documents via my web browser: I have no idea how to map a URL to that location.

Do i have to create a mapping similar to the mapping of a servlet in the
web.xml file.

Thanks for any help.

Tony
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In order for Tomcat to consider your webapps/documentHolder directory to be part of a web application, it has to see a documentHolder/WEB-INF directory with a minimum web.xml file in it. As I recall, you can copy one of the existing web.xml and take out everything between the
<web-app>
</web-app>
to create a minimum web.xml
Bill
 
Tony Evans
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi William,

Thanks for the advice, but I still cant get it to work.

What I have so far is a directory and test file:
C:\jakarta-tomcat-4.1.12\webapps\know_your_customer_docs\customer1\customer1Doc.doc.

The link
http://localhost:8080/customers/know_your_customer_docs/customer1/customer1Doc.doc.

should load the
 
Tony Evans
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi William,

Thanks for the advice, but I still cant get it to work.

What I have so far is a directory and test file:
C:\jakarta-tomcat-4.1.12\webapps\know_your_customer_docs\customer1\customer1Doc.doc.

The link
http://localhost:8080/customers/know_your_customer_docs/
customer1/customer1Doc.doc

should load the doc into the browser:

I though you could set the path in the server.xml so I added the following code to the server.xml

<Context path="/customers"
docBase="../server/webapps/know_your_customer_docs" debug="0" reloadable="false"
</Context>

I copied this code from an example and I think it sets the path URL path to the absolute path doc path.

I also did what you suggested and added a WEB-INF folder under my know_your_customer_docs with a minimum web.xml doc.

I am not sure what should go in the web.xml doc apart from

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
</web-app>

Thanks for any help Tony.
 
Tony Evans
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I hve fixed the problem, I have removed the context set up and replaced the link The link
http://localhost:8080/customers/customer1/customer1Doc.doc


with
The link
http://localhost:8080/know_your_customer_docs/customer1/customer1Doc.doc

And it works

Tony
 
reply
    Bookmark Topic Watch Topic
  • New Topic