• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Shridhar. Blr.
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic