• 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 to Invoke files using Servlet

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I'm developing a Search Engine. Actually what i have to do is that, i should search for the file using the keyword specified. The Matching result should be listed to the user, On clicking the result the particular file should be invoked.

The file are located within a folder (say SAPFiles), i'm maintaining the information about the file in a Oracle database. These information are loaded into the database manually. The various file information are File_ID,File_NAME,FILE_EXTENSIN,DATE_CREATION,DATE_MODIFIED,KEYWORDS,PATH.

The Keyword field holds the meta data about the file and path holds the path.

Actually i want to know how make my servlet invoke the file using the PATH and other information which are in the database.

I'm using J2EE Application Server 1.3.1 to deploy my servlets.

Can anyone help on this please...

With kind regards
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just build hyperlinks to the files in your results page.
 
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Swaminathan,

You could directly put the link to that file in your result page,

But if you want more secure and well controlled application,
Don't put the files under directly accessible web path.

Instead, add a column MIME-TYPE to your database table, and have a servlet read the files and write the contents to HttpResponse. Ofcourse, put the MIME-TYPE in header.
 
Swaminathan Balasubramani
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank u so much...

I need some more technical information...

I'm not aware..how to map the file with the path directly. I would also like to know how to implement the same with MIME-Type and servlet...enforcing security...

Please help me explanation and syntax...if u have done this before pls also help me with the sample code...

Thanking in advance for the anticipated reply...
 
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
I'm sure you don't intend to give this impression, but it looks like you are asking the assembled experts of this forum to design an application for you.
Personally, I get $75/hr for this sort of work.
My advice is to start small - try to make a standalone application first, trying to start with a servlet will just complicate things.
Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic