File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes File Download Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "File Download" Watch "File Download" New topic

File Download

Eibhlin Reid

Joined: Nov 04, 2004
Posts: 28
Hi there,

I have never used servlets before but I was wondering if there is a way to use them to allow a user of my program to download an XML file off of a server. I know I could do a website using EJBs (which I have some experience of) but I would just rather the user click a button on the application to start the download instead of having to go to a website to download the file.

Is this knid of thing easy to do? All help greatly appreciated!

Thanks in advance!
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

A servlet (as it's name suggests) a server component. It sits on the server and waits for a request.

The request can come from a browser or from any application that can generate an HTTP request.

What type of app are you writing?

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Eibhlin Reid

Joined: Nov 04, 2004
Posts: 28
I'm writing an application to remove adware/spyware from a windows machine. I would like users to be able to download updates to the definitions file, but wanted something thats quick and easy for both them and me!!
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
The HttpClient classes can be used to emulate a browser making a request.
See this Jakarta commons project page.
I agree. Here's the link:
subject: File Download
It's not a secret anymore!