[jdom-interest] 401 unauthorized, SaxBuilder

Per Norrman per.norrman at austers.se
Mon Aug 1 14:28:50 PDT 2005


Hi,

This is really off-topic, but ...

you 'simply' need to programmatically employ the
same protocol as the browser does when it receives
the HTTP 401 response. You can read about the protocols
here:

http://www.ietf.org/rfc/rfc2617.txt

And for sure, jakarta HttpClient has some code already
written for you:

http://jakarta.apache.org/commons/httpclient/

/pmn


Espen Falkevik skrev:
> Hi. 
> I'm trying to read a HTML page on a server, and to
> parse it into a XML-dokument, so that I can use XPath
> to extract the elements I want from the page.
> 
> The following code does the trick when the server
> doesn't demand any authorizaiton:
> (The code is written in Jython)
> 
> builder2 = SAXBuilder("org.ccil.cowan.tagsoup.Parser")
> url = URL(http://10.0.0.1)
> doc2 = builder2.build(url)
> after this I can use XPath on doc2, to extract the
> input and select fields...
> 
> My problem is: how can I do the same when the server
> demands authentication? (when requesting the page in a
> browser I get a pop-up where I write my username and
> password). I don't want the user to get this popup, I
> only want to declare my username and password as
> strings in the program.....
> 
> 
> Hope someone can help me
> 
> -Espen-
> 
> 
> 	
> 	
> 		
> ___________________________________________________________
> 
> Yahoo! Messenger - NEW crystal clear PC to PC calling
> worldwide with voicemail http://uk.messenger.yahoo.com
> 
> 
> 		
> ___________________________________________________________ 
> How much free photo storage do you get? Store your holiday 
> snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
> 
> 



More information about the jdom-interest mailing list