%@ page language = "java" import = "java.net.*, java.io.*"%>
<%
String url = request.getRequestURL().toString();
URL toParse = new URL(url);
String host = toParse.getAuthority();
host = "http://"+host+"/r2q2/";
String basePath = System.getProperty("R2Q2_HOME");
if (basePath==null) {
basePath = System.getenv("R2Q2_HOME");
if (basePath == null) {
basePath = System.getProperty("catalina.home");
basePath += "/webapps/r2q2/";
}
}
String sysslash;
if (System.getProperty("os.name").toUpperCase().indexOf("WINDOWS") == 0){
sysslash="\\\\";
StringBuffer pathBuff = new StringBuffer(basePath);
for(int i=0; i < pathBuff.length(); i++){
if(pathBuff.charAt(i)=='\\'){
pathBuff.insert(i,'\\');
i++;
}
}
basePath = pathBuff.toString();
}else{
sysslash="/";
}
if(basePath!=null){
try {
File outfile = new File(basePath+"r2q2.properties");
outfile.createNewFile();
BufferedWriter output = new BufferedWriter(new FileWriter(outfile));
output.write("##r2q2.properites file generated by R2Q2 Installation Script\n");
output.write("##Script Authored by Rob Blowers\n");
output.write("##rwb104@ecs.soton.ac.uk\n\n");
output.write("r2q2.xml.xsdLocation="+basePath+"schemas"+sysslash+"imsqti_v2p0.xsd\n\n");
output.write("r2q2.content.ws.location="+host+"services/ContentUnpacker\n");
output.write("r2q2.initialisation.ws.location="+host+"services/InitialisationEngine\n");
output.write("r2q2.rendering.ws.location="+host+"services/RenderingEngine\n");
output.write("r2q2.processing.ws.location="+host+"services/ProcessingEngine\n");
output.write("r2q2.router.ws.location="+host+"services/Router\n\n");
output.write("r2q2.rendering.xhtml.graphicInteraction.supportedObjectTypes=image/png image/gif image/jpg image/jpeg image/pjpeg image/pjpg image/bmp image/x-windows-bmp\n");
output.write("r2q2.rendering.xhtml.postURL=r2q2response.jsp\n\n");
output.write("r2q2.processing.responsetemplates.matchCorrect="+basePath+"schemas"+sysslash+"match_correct.xml\n");
output.write("r2q2.processing.responsetemplates.mapResponse="+basePath+"schemas"+sysslash+"map_response.xml\n");
output.write("r2q2.processing.responsetemplates.mapResponsePoint="+basePath+"schemas"+sysslash+"map_response_point.xml\n\n");
output.write("##Ensure that the trailing / or \\ is included\n");
output.write("r2q2.router.content.localBasePath="+basePath+"content"+sysslash+"\n");
output.write("r2q2.router.content.httpBasePath="+host+"content/\n");
output.write("r2q2.router.sessiontimeout=50000\n");
output.write("r2q2.qti.namespace=http://www.imsglobal.org/xsd/imsqti_v2p0");
output.close();
out.println("");
out.println("
Properties file sucessfully generated. We suggest deleting the jsp's r2q2install.jsp and scriptrun.jsp now installation is complete
"); out.println("Go to Demonstrator"); } catch (IOException e) { } }else{ out.println("catalina.home property variable or R2Q2_HOME enviroment variable not set. Unable to continue
"); } %>