You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jason Horne <Ja...@sas.com> on 2003/11/11 22:49:59 UTC
http authentication bug
I tried to send an authenticated HTTP request with the following code:
<j:new var="credentials"
className="org.apache.commons.httpclient.UsernamePasswordCredentials"/>
<j:parse text="${credentials.setUserName('jahorn')}"/>
<j:parse text="${credentials.setPassword('password')}"/>
<j:new var="httpclient" className="org.apache.commons.httpclient.HttpClient"/>
<j:parse text="${httpclient.getState().setCredentials('realm', 'sww.sas.com', credentials)}"/>
<j:parse text="${httpclient.getState().setAuthenticationPreemptive(true)}"/>
<http:session httpClient="${httpclient}">
<http:get var="foo" uri="http://sww.sas.com/"/>
</http:session>
<echo message="${foo.getResponseBodyAsString()}"/>
It didn't work, because it said it didn't have credentials for that realm, which it obviously did. I think I found a bug in the implementation of SessionTag in the jelly http tag library which was causing this behavior. Once I applied a fix to my local copy of the jelly http tag source, the above worked fine.
The bug is being tracked here:
http://jira.codehaus.org/secure/ViewIssue.jspa?key=JELLY-96
--
Jason Horne
Application Architecture Team/MIS/ISD
SAS Institute Inc.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org