Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

a litte confused

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI all.
I have developed a servlet for downloading the pdf files.
its url something like:

but the real sites use:
<a href="http://somesite/Ebook.pdf">Download</a>
so what is the right approach ???

and how they performed this approach ?
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are probably a couple of factors here.
Firstly, if they don't use an application server, their architecture could work wuite differently.
Also, on live sites it is common to put a web server in front of the application server and use this to hide the application context. In effect it maps request to the web server domain to requests to the application server context.
It should also be possible to create a servlet mapping of /*.pdf for your servlet rather than /download. You'll need to look at the API to find out where the filename turns up (I've used similar code several times, but I keep forgetting )
The last two points combined would allow you to use a servlet to control pdf downloads in the form "/myfile.pdf".
I usually use the alternate servlet mapping to make a servlet act as a virtual directory, and then it manages all requests for resources in that directory. If you map the servlet as "/download/*", then you can lookat the file requested and decide what to do programatically before sending it back.
Dave.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic