• 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

programmatic authentication

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have set form-based authentication on Websphere 5.1 and it works ok from the browser. Now I need to connect to the Web Container using a Java client to download protected resources.
The problem is that I cannot see the WASReqURL cookie. I could see the cookie in the browser after I have asked for a protected resource, but not with the Java client:

URLConnection conn = url.openConnection();
Iterator iterator = conn.getHeaderFields().entrySet().iterator();
while (iterator.hasNext()) {
System.out.println(iterator.next());
}

Any ideas?


PS:
Here is what the server returns:

Content-Length=[1526]
null=[HTTP/1.1 200 OK]
Content-Language=[en-US]
Date=[Thu, 24 Nov 2005 12:59:12 GMT]
Server=[WebSphere Application Server/5.1]
Content-Type=[text/html]
last-modified=[Tue, 25 Oct 2005 12:56:25 GMT]
 
Cristian Negresco
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Well, it worked.
Here is the post which solved the pb:
http://www.rgagnon.com/javadetails/java-0092.html.

HttpClient class and usage is to be found here:
http://jakarta.apache.org/commons/httpclient/tutorial.html.

Cristian.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic