Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

file download-user authentication-window close  RSS feed

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm involved a project to let staff to access valuable files
throught intranet. I want to realize the following functions:
1. When the user clicks the zipfile download image in a html page, a user authentication window appears to ask user to enter
userid&passwd. I write the required zipfile name as a hidden
field in the authentication page.
2. Next, after entering the userid&passwd, the user clcik the
"submit" button in the user authentication page. The download
servlet then check the validity of the userid&passwd. If it's
a valid user, the download servlet sends user the required file.
I use res.redirect(zipfile) to send user zipfile.
3. After the user receives the zip file, close the authentication
window which asks userid &passwd
My problem is I don't know how to and when to close the authentication. Because after the download servlet redirect the
zipfile to the user, it can't receive request from user browser
any longer.
Can you tell me how to refine and realize the download-authentication-window close process?
Thanks a lot in advance.
Ma Di
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yeah, once u say response.redirect(zipfile) u cant access the request from browser unless u use other alternatives like
RequestDispatcher dispatcher =
dispatcher.include(request, response);
(Used for including the content generated by another server resource in the body of a response)
dispatcher.forward(request, response);
(Used for forwarding a request from this servlet to another resource on the server.)

In both ways u can get request object back.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!