• 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

How do I download files?

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I want to create a web application that will allow user's to download
files from my server.
I have this JSP and Java Bean ...

Here's a example of the HTML source this produces ...

When I access my JSP and click on one of the .txt links I get a 404 error?
The files do exist and permission on them are wide open. I have been making
symbolic links to the USER002 directory all over the place.
SUNWappserver/domains/domain1/applications/j2ee-modules/MyDownLoader
bash-2.03$ ls -l
total 6
lrwxrwxrwx 1 plank chumb 25 Mar 15 14:03 USER002 -> ../../../config/USER002
drwxr-xr-x 3 plank chumb 512 Mar 15 14:01 WEB-INF
-rw-r--r-- 1 plank chumb 409 Mar 15 14:01 index.jsp
bash-2.03$ cat USER002/.htaccess
AddType application/octet-stream .inq

Is there something wrong with my <a href=> tags? Is there a problem using symbolic links? Is there something other than just having a .htaccess file in my USER002 directory?
Please help!
[ March 15, 2004: Message edited by: Sheldon Plankton ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You've made the href's relative to the serlvet. Make them context relative (leading /), or provide a base tag in the JSP to force the relative base.
[ March 15, 2004: Message edited by: Bear Bibeault ]
 
Sheldon Plankton
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear,
I made that change ... redeployed ... restarted my server ... added a symbolic link in my docroot dir to USER002 but still I get 404
The <a href> tags now look like this ...
<a href='/USER002/20040103120005.txt'>20040103120005.txt</a>
What else should I check?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is USER002 located at the root of your web app? You simply need to create a URL that will address the location of the files. If the folder is located outside the range of the web server, no URL on earth will serve it up. (Though it's easy to write a servlet that can).
So, where are you storing the files?
 
Sheldon Plankton
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear,
bash-2.03$ pwd
/usr/local/home/Plank/SUNWappserver/domains/domain1
bash-2.03$ find . -name 'USER002'
./config/USER002
./docroot/USER002
./config/USER002 is an actual directory
./docroot/USER002 is a symbolic link to /usr/local/home/Plank/SUNWappserver/domains/domain1/config/USER002
I beginning to think it is a problem with the symbolic link and that's going to be a problem for me
 
reply
    Bookmark Topic Watch Topic
  • New Topic