BASE Element Support - Resolving Relative URL's
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I'm having some difficulty using HttpUnit and specifically with web pages build
with Struts Modules (relative url causing difficulty).
The webpages have the <base> element set, I was wondering if it was supported in
httpunit?
http://www.w3.org/TR/1999/REC-html401-19991224/struct/links.html#h-12.4
Example of problem..
I have a webpage:
url = http://localhost:8080/webgui/administration/User.do?fn=list
<html>
<head>
<base href="http://localhost:8080/webgui/" />
..
</head>
<body>
<a id='addUser' href='administration/User.do?fn=add'>Add user...</a>
</body>
My test function looks like this:
public void testMainPageLinks () throws SAXException, IOException
{
WebConversation wc = new WebConversation();
java.net.URL urlBase = new java.net.URL( "http://localhost:8080/webgui/"
);
WebRequest req = new GetMethodWebRequest( urlBase, "administration/User.do?
fn=list" );
WebResponse resp = wc.getResponse( req );
WebLink link = resp.getLinkWithID( "addUser" );
LOG.info("Link URL = " + link.getURLString());
link.click();
}
>> Link URL = administration/User.do?fn=add
Click link is broken..
com.meterware.httpunit.HttpNotFoundException: Error on HTTP request: 404 Invalid
path was requested [http://localhost:8080/webgui/administration/administration/User.
do?fn=add]
at com.meterware.httpunit.WebClient.validateHeaders(WebClient.java:575)
Problem is duplicate /administration in the URL, thats why I think base isn't
been used
If anyone can point me in the direction of how I can fix the problem, it
would be much appreciated.
Thanks
Tony
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642