02-05-2012 09:04 AM
my $json = '{"shortName": "'.$site.'"}';
$h->header ('Content-Type' => 'application/json', Accept=>'application/json');
my $GetReq = HTTP::Request->new
(
'POST',
"http://$host:$port/share/service/modules/delete-site?alf_ticket=$alfTicket",
$h,
$json
);
Error (500) : Error Interno del Servidor
{
"status" :
{
"code" : 500,
"name" : "Internal Error",
"description" : "An error inside the HTTP server which prevented it from fulfilling the request."
},
"message" : "01050031 Failed to execute script 'classpath*:alfresco\/site-webscripts\/org\/alfresco\/modules\/delete-site.post.json.js': 01050030 SyntaxError: syntax error (file:\/home\/isa\/alfresco-40b\/tomcat\/webapps\/share\/WEB-INF\/classes\/alfresco\/site-webscripts\/org\/alfresco\/modules\/delete-site.post.json.js#9(eval)#1)",
"exception" : "org.springframework.extensions.webscripts.WebScriptException - 01050031 Failed to execute script 'classpath*:alfresco\/site-webscripts\/org\/alfresco\/modules\/delete-site.post.json.js': 01050030 SyntaxError: syntax error (file:\/home\/isa\/alfresco-40b\/tomcat\/webapps\/share\/WEB-INF\/classes\/alfresco\/site-webscripts\/org\/alfresco\/modules\/delete-site.post.json.js#9(eval)#1)",
function main()
{
var req = json.toString();
var reqJSON = eval('(' + req + ')');
// Call the repo to delete the site
var conn = remote.connect("alfresco");
var res = conn.del("/api/sites/" + reqJSON.shortName);
var resJSON = eval('(' + res + ')');
// Check if we got a positive result
if (resJSON.success)
{
// Yes we did - now remove sitestore model artifacts…
// remove dashboard page instance
var dashboardURL = "site/" + reqJSON.shortName + "/dashboard";
var dashboardPage = sitedata.getPage(dashboardURL);
if (dashboardPage != null)
{
dashboardPage.remove();
}
// remove component instances
var components = sitedata.findComponents("page", null, dashboardURL, null);
for (var i=0; i < components.length; i++)
{
components[i].remove();
}
// the client will refresh on success
model.success = true;
}
else
{
// Error occured - report back to client with the status and message
status.setCode(resJSON.status.code, resJSON.message);
model.success = false;
}
}
main();
02-06-2012 07:29 AM
var resJSON = eval('(' + res + ')');
02-06-2012 03:00 PM
var req = json.toString();
status.getCode();
// var reqJSON = eval('(' + req + ')');
var reqJSON = req;
// Call the repo to delete the site
var conn = remote.connect("alfresco");
var res = conn.del("/api/sites/" + reqJSON.shortName);
//var resJSON = eval('(' + res + ')');
var resJSON = res;
// Check if we got a positive result
if (resJSON.success)
02-07-2012 02:36 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.