FileUtils f = new FileUtils();
String tempFilePath = uploadedFile.getAbsolutePath();
if (f.copyFile(tempFilePath, tempFilePath
+ FileUtils.SPR_EXTENSION) == false)
{
return new FormResponse(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"There was an error executing your request - the uploaded file copy failed",
true);
}
tempFile = new File(tempFilePath + FileUtils.SPR_EXTENSION);
serverContextPath = tempFile.getAbsolutePath();
}
else
{
serverContextPath = uploadedFile.getAbsolutePath();
}
}
if ((!FileUtils.validDeployableSpr(serverContextPath))
&& (!FileUtils.validDeployableJipletDir(serverContextPath)))
{
return new FormResponse(
HttpServletResponse.SC_BAD_REQUEST,
"The context could not be created because the path does not have a valid signature",
true);
}
String cmap = getContextCriteriaXML(domainName, selectedConnector,
contextCriteria, new_name);
try
{
ContainerMgmt cont = new ContainerMgmt();
if ((override_name != null) && (override_name.length() > 0))
{
cont.createContext(serverContextPath, override_name, cmap);
}
else
{
cont.createContext(serverContextPath, null, cmap);
}
if (Model.getDeploymentType().equals("JBOSS") == true)
{
servlet.log("User " + request.getUserPrincipal().getName()
+ " initiated the creation of the J2EE context "
+ new_name);
try
{
Thread.sleep(10000L);
}
catch (InterruptedException e)
{
}
}
else
{
servlet.log("User " + request.getUserPrincipal().getName()
+ " created context " + new_name);
}
return new FormResponse(HttpServletResponse.SC_OK, "OK", true);
}
catch (Throwable e)
{
servlet.log("Failure creating context: " + e.getClass().getName()
+ ": " + e.getMessage());
return new FormResponse(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"Failure creating context: " + e.getMessage(), true);
}
finally
{