Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

upload files in a directory

  Asked By: James    Date: Apr 05    Category: Java    Views: 1460
  

I want to upload files in a directory, for that I m using jsp:smart,
the problem is I want to send the Authorization header along with the
request to upload the file send from the browser.
There is no method provided in the HttpServletRequest.
And I dont want to use
http://username:password@m.../upload.jsp

How can I modify the request object before sedning it to the
upload.jsp.

Actually when using this approach
http://username:password@m.../upload.jsp doesnt work,
1) MY first JSP sends the request to the second JSP that adds the
username and password
(http://username:password@m.../upload.jsp ) and redirects the
page to the upload Jsp that requires Authorization header in her
request to upload the file in the protected directory.

2) if i use jsp:forward and change the url to relative i.e
<jsp:forward page ="username:password@u... "/> it does'nt
works. (Tomcat could not find the directory)

3) if I use response.sendRedirect
("http://username:password@m.../upload.jsp"); it successfully
redirect the JSP but when I see the Headers list in the upload JSP i
can not find the Authorization Header.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Hu Chalthoum     Answered On: Apr 05

I don't think you will be able to accomplish what you are trying to do
using authorization  headers because I don't think the request  headers
are mutable from within a servlet. The headers are supposed to be
supplied by the client. Thus, you will have to prompt your client for
authorization. Is this a problem?

Why do you need the Authorization header  anyhow? Is it a requirement
from jsp:smart when the file  is going to end up in a protected
directory?

 
Didn't find what you were looking for? Find more on upload files in a directory Or get search suggestion and latest updates.




Tagged: