• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic