aspose file tools*
The moose likes Tomcat and the fly likes How to authenticate a web application using web.xml file?Client is java standalone pr Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How to authenticate a web application using web.xml file?Client is java standalone pr" Watch "How to authenticate a web application using web.xml file?Client is java standalone pr" New topic
Author

How to authenticate a web application using web.xml file?Client is java standalone pr

Shridhar. Blr.
Ranch Hand

Joined: Nov 23, 2000
Posts: 45
Hi All,
Is it possible to use "<security-constraint>" for a standalone client, not a web client.
What i want is:
I will make a call to a html/jsp page which is defined inside Tomcat/web.xml's security-constraint. when i make a http call to these pages, i want to pop-up the username/password dialog ( security constraint dialog box), where the user can enter the username/password, which will be validated against the database (JDBC Realm).
I know how to do the same for web-client, but i am not able to simulate the same for standalone client. When i hit to the jsp/html, using
// Code ::
String urlString = "http://localhost/test/view/test.html";
URL url = new URL(urlString);
HttpURLConnection urlConn = (HttpURLConnection)
url.openConnection();
it is showing the following Error :
java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost/test/view/test.html
, i thought i would popup the window???
why it is not showing the username/password window,??? where as it works if i give the same URL in the browser ....
Any help would be highly appreciated..
Thanks in Advance,,
~Shridhar..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to authenticate a web application using web.xml file?Client is java standalone pr