Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > send login and password to tomcat

Reply
Thread Tools

send login and password to tomcat

 
 
seb
Guest
Posts: n/a
 
      09-29-2003
Hello! I want to protect a directory in my Web Application. Protected
directory: http://localhost:8080/sample/protected/ I did the necessary
things with the „tomcat-user.xml" and „web.xml" file. It works fine.
If the user wants to access a file in the protected directory, a
dialog appears and asks for login and password. With the right
login/password the user can access the files in this directory. But
what I have to do, if I want to access a file in this directory from a
Java program? Naturally a normal access returns a 401 Error code. How
can I send login/password from a Java program? I do not want, that a
dialog box appears.

Thanks

Sebastien
 
Reply With Quote
 
 
 
 
David Zimmerman
Guest
Posts: n/a
 
      09-29-2003


seb wrote:

> Hello! I want to protect a directory in my Web Application. Protected
> directory: http://localhost:8080/sample/protected/ I did the necessary
> things with the „tomcat-user.xml" and „web.xml" file. It works fine.
> If the user wants to access a file in the protected directory, a
> dialog appears and asks for login and password. With the right
> login/password the user can access the files in this directory. But
> what I have to do, if I want to access a file in this directory from a
> Java program? Naturally a normal access returns a 401 Error code. How
> can I send login/password from a Java program? I do not want, that a
> dialog box appears.
>


Two ways.
1 - put the userid/passwd into the URI. EG
http://userasswd@localhost:8080/sample/protected

2 - Put the userid/passwd into the Authorization HTTP header. Study the
HttpURLConnection API to find out how.


 
Reply With Quote
 
 
 
 
seb
Guest
Posts: n/a
 
      10-16-2003
> Two ways.
> 1 - put the userid/passwd into the URI. EG
> http://userasswd@localhost:8080/sample/protected
>


Thank you, this way works fine. But is it possible to use this way
when there is not password, only a login?
I have try :http://user:@localhost:8080/sample/protected
and http://user@localhost:8080/sample/protected
but it doesn't work

Thank you for your help
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lost Windows login Password? 6 Ways to Recover and Recover windows Password jamesstevn General Computer Support 0 03-10-2010 03:18 AM
Change a users password without knowing the old password nor the answer to the password question AAaron123 ASP .Net 1 01-16-2009 02:56 PM
Changing a users password without knowing the old password nor the answer to the password question AAaron123 ASP .Net 2 01-16-2009 02:08 PM
Login Controls - Force user to change password at next login pj ASP .Net 2 10-31-2006 12:16 AM
servlet/jsp question: tomcat 4 and login (about session, forward and get/set attribute) Mladen Adamovic Java 3 11-16-2003 04:54 PM



Advertisments