|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.xdoc.LinkChecker
public class LinkChecker
Checks an XHTML document to see that the links it references are valid URLs.
Constructor Summary | |
---|---|
LinkChecker(URL context,
boolean attemptExternal)
Constructs a new LinkChecker with a given home context. |
Method Summary | |
---|---|
boolean |
checkLinks(Source xsltSrc,
Source xmlSrc)
Checks the result of an XML transformation to see if the links in the result are OK or not. |
boolean |
checkLinks(Source xsltSrc,
Source xmlSrc,
Map params)
Checks the result of an XML transformation to see if the links in the result are OK or not, with an optional list of parameters. |
URLConnection |
followRedirectsWithTimeout(URLConnection conn)
Takes a URLConnection and repeatedly follows 303 redirects until a non-303 status is achieved. |
int |
getExternalFailures()
Returns the total number of external link resolution failures this checker has come across. |
int |
getLocalFailures()
Returns the total number of local link resolution failures this checker has come across. |
int |
getTimeout()
Returns the network timeout used for retrieving URLs. |
protected void |
logMessage(String msg)
Interface through which short messages about progress can be logged. |
static void |
main(String[] args)
Checks the links of the result of a given transformation to XHTML (or an HTML-like result). |
void |
setTimeout(int timeoutSecs)
Sets the network timeout used for retrieving URLs. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LinkChecker(URL context, boolean attemptExternal)
context
- document contextattemptExternal
- true if you want to check external (http)
links; if false, only local ones will be checkedMethod Detail |
---|
public boolean checkLinks(Source xsltSrc, Source xmlSrc) throws TransformerException, MalformedURLException
xsltSrc
- source for the XSLT stylesheet which converts to
HTML or an HTML-like output formatxmlSrc
- source for the XML document which will be
transformed by xsltSrc to produce the HTML to test
TransformerException
MalformedURLException
public boolean checkLinks(Source xsltSrc, Source xmlSrc, Map params) throws TransformerException, MalformedURLException
xsltSrc
- source for the XSLT stylesheet which converts to
HTML or an HTML-like output formatxmlSrc
- source for the XML document which will be
transformed by xsltSrc to produce the HTML to testparams
- stylesheet parameter map (or null)
TransformerException
MalformedURLException
public void setTimeout(int timeoutSecs)
timeoutSecs
- timeout in secondspublic int getTimeout()
public int getLocalFailures()
public int getExternalFailures()
getLocalFailures()
protected void logMessage(String msg)
msg
- message to logpublic URLConnection followRedirectsWithTimeout(URLConnection conn) throws IOException
conn
- initial URL connection
hconn
)
IOException
public static void main(String[] args) throws MalformedURLException, TransformerException
Usage: LinkChecker stylesheet xmldoc
args
- arguments
MalformedURLException
TransformerException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |