if (f
.copyFile(uploadedFile.getAbsolutePath(),
tempFilePath) == 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);
serverPath = tempFile.getAbsolutePath();
}
else
{
serverPath = uploadedFile.getAbsolutePath();
}
}
if ((!FileUtils.validDeployableSrr(serverPath))
&& (!FileUtils.validDeployableRealmDir(serverPath)))
{
return new FormResponse(
HttpServletResponse.SC_BAD_REQUEST,
"The realm could not be created because the path does not have a valid signature",
true);
}
RealmMgmt rlm = new RealmMgmt();
rlm.createRealm(serverPath);
if (Model.getDeploymentType().equals("JBOSS") == true)
{
servlet
.log("User "
+ request.getUserPrincipal().getName()
+ " initiated the creation of the J2EE realm with file "
+ new File(serverPath).getName());
try
{
Thread.sleep(10000L);
}
catch (InterruptedException e)
{
}
}
else
{
servlet.log("User " + request.getUserPrincipal().getName()
+ " created realm with file "
+ new File(serverPath).getName());
}
return new FormResponse(HttpServletResponse.SC_OK, "OK", true);
}
catch (Throwable e)
{
e.printStackTrace();
return new FormResponse(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getClass()
.getName()
+ ": " + e.getMessage(), true);
}
finally