String data = (BASE64data == null) ? "" : BASE64data;
Identity requester = new Identity(id, identityAssertion, "");
logger.finest("Zaranuxlet.kernel.execute -> " + systemcall + " , " + path +" , " + parameterList + "," + isBase64 + "," + requester.getID());
Response output;
try
{
output = ( new Kernel()).execute(systemcall, path, parameterList, new ByteArrayInputStream(data.getBytes()), isBase64, requester);
}catch(UnauthorizedAccessException e)
{
output = new Response(e);
//response.getWriter().write(output.toString());
//response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
}catch(InvalidParameter e)
{
output = new Response(e);
//response.getWriter().write(output.toString());
//response.sendError(HttpServletResponse.SC_BAD_REQUEST);
}catch(SystemCallNotSupported e)
{
output = new Response(e);
//response.getWriter().write(output.toString());
//response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
}catch(ResourceNotFound e)
{
output = new Response(e);
//response.getWriter().write(output.toString());
//response.sendError(HttpServletResponse.SC_NOT_FOUND);
}catch(ResourceAccessFailed e)
{
output = new Response(e);
//response.getWriter().write(output.toString());
//response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}catch(NotDirectory e)
{
output = new Response(e);
//response.getWriter().write(output.toString());
//response.sendError(HttpServletResponse.SC_NOT_FOUND);
}catch(NotFile e)
{
output = new Response(e);
//response.getWriter().write(output.toString());
//response.sendError(HttpServletResponse.SC_NOT_FOUND);
}
try
{
final String jsCommand = "window['SUCCESS_CALLBACK']('" + callbackID + "' , '" + URLEncoder.encode(output.toString(),"UTF-8") + "')";
final JSObject win = JSObject.getWindow(Zaranuxlet.this);
win.eval(jsCommand);
}catch(JSException e)
{
logger.severe("callbackOnSuccess(): Unable to do window.eval : " + e.getMessage());