Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4611918
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:20:00+00:00 2026-05-22T01:20:00+00:00

I have a Java Applet application. The use case is as follows: The users

  • 0

I have a Java Applet application. The use case is as follows:

The users invoke a URL which is mapped to a Servlet. The servlet as a response returns a JSP page from which the users can navigate in the UI. The entire UI is made of Swing [basically a JApplet]. The events in the UI are handled in the traditional manner [ActionListeners, SelectionListeners…]. Now I have the following requirement:

There is a file in the server directory that I am supposed to allow the users to download through my application. I need to give the users a link in my UI, the clicking of which will trigger the download.

Can this be done considering the security features of JApplets? Also consider the event handling mechanism of Swing components.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:20:01+00:00Added an answer on May 22, 2026 at 1:20 am

    The options for a sand-boxed applet.

    There are 2(.2) ways to go (that I can immediately think of).

    1. Use the AppletContext.showDocument(URL,String) method to trigger the download using the browser.
    2. For ‘Next Generation’ plug-in 2 based applets (1.6.0_10+ in Sun/Oracle’s JVM) it is possible to hook into the functionality of the JNLP API of Java Web Start.
      1. The JNLP API provides the ability to access the local file-system in a sand-boxed application or applet. Here is my little demo. of the JNLP API file services.
      2. The JNLP API also provides the BasicService.showDocument(URL) method. This version is slightly superior to the AppletContext equivalent for the fact that it returns a boolean to indicate success/failure. The applet based version might fail, and if it does, it does so silently. See also the demo. of the BasicService.

    A trusted applet can use this process.

    1. Pop a JFileChooser to allow the user to decide where to save the File.
    2. If the chooser returns a valid File (indicating the action was not cancelled) proceed with saving.
    3. Get an InputStream from the URL.
    4. Establish an OutputStream to the File.
    5. Read bytes from the InputStream, write them to the OutputStream.
    6. Rinse & repeat till read produces -1.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a java applet application in which i use rich text area .
I have a paint application that runs as a Java applet. I need to
I have built a multi-touch application which is based on a Java EE backend
I use Java Applet like an example. When you open a website which has
We have a Java Applet built using AWT. This applet lets you select pictures
I have a Java Applet that uses AWT. In some (rare) circumstances, the platform
We have an ages old Java applet that we want to move forward to
I'm trying to embed a Java Applet using the <OBJECT> tag, which is the
From the perspective of a cross application/applet java accessibility service, how would you link
I have a 3-rd party java application (I don't own source code) and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.