* and writes it to a temporary file that's accessible via an external url ref.
* This can be used within the browser to download the currentXMLConfig
* @return
*/
public String getTempFileDownloadLinkForCurrentXMLConfig(){
DataHandler dh = new DataHandlerImpl();
String currXMLConfig = buildXMLConfigFromCurrentConfiguration();
if(currXMLConfig==null){
return null;
}
//save it's hashcode - for caching purposes
if((this.currXMLConfigHashCode!=-1)&&(this.currXMLConfigHashCode!=currXMLConfig.hashCode())){
this.currXMLConfigHashCode = currXMLConfig.hashCode();
try {
//get a temporary file
File f = dh.createTempFileInExternallyAccessableDir();
Writer out = new BufferedWriter( new OutputStreamWriter( new FileOutputStream(f), "UTF-8" ) );
out.write(currXMLConfig);
out.close();
currXMLConfigTempFileURI = ""+dh.getHttpFileRef(f);
return currXMLConfigTempFileURI;
} catch (Exception e) {
log.debug("Error getting TempFileDownloadLinkForCurrentXMLConfig "+e);
return null;
}