* @param url
* @throws org.dbwiki.exception.WikiException
*/
protected void pasteURL(WikiDataRequest request, String url) throws org.dbwiki.exception.WikiException {
if (url != null) {
CopyPasteInputHandler ioHandler = new CopyPasteInputHandler();
String sourceURL = url;
if (sourceURL.indexOf("?") != -1) {
sourceURL = sourceURL + "&" + RequestParameter.ParameterCopyPasteExport;
} else {
sourceURL = sourceURL + "?" + RequestParameter.ParameterCopyPasteExport;
}
try {
new SAXCallbackInputHandler(ioHandler, false).parse(new URL(sourceURL).openStream(), false, false);
} catch (java.io.IOException ioException) {
throw new WikiFatalException(ioException);
} catch (org.xml.sax.SAXException saxException) {
throw new WikiFatalException(saxException);
}
/* TODO: The version parameter may be missing in the source URL when copying from
* an external source.
*/
this.database().paste(request.wri().resourceIdentifier(), ioHandler.getPasteNode(), url, request.user());
} else {
throw new WikiRequestException(WikiRequestException.InvalidUrl, "(null)");
}
}