/** * Execute service. * * @param path * the path * @return result of the execution of the service */ @GET @Path("/{path:.*}") @ApiOperation("Execute Server Side JavaScript Resource") @ApiResponses({ @ApiResponse(code = 200, message = "Execution Result") }) public Response executeService(@PathParam("path") String path) { try { processor.executeService(path); return Response.ok().build(); } catch (ScriptingDependencyException e) { logger.error(e.getMessage(), e); return Response.status(Response.Status.ACCEPTED).entity(e.getMessage()).build(); } catch (Throwable e) { String message = e.getMessage(); logger.error(message, e); sendErrorInternalServerError(response, message); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); } }
/** * Execute service. * * @param path * the path * @return result of the execution of the service */ @GET @Path("/{path:.*}") @ApiOperation("Execute Server Side JavaScript Resource") @ApiResponses({ @ApiResponse(code = 200, message = "Execution Result") }) public Response executeJavascriptServiceGet(@PathParam("path") String path) { try { processor.executeService(path); return Response.ok().build(); } catch (ScriptingDependencyException e) { logger.error(e.getMessage()); return Response.status(Response.Status.ACCEPTED).entity(e.getMessage()).build(); } catch (RepositoryNotFoundException e) { String message = e.getMessage() + ". Try to publish the service before execution."; logger.error(message); return Response.status(Response.Status.ACCEPTED).entity(message).build(); } catch (Throwable e) { String message = e.getMessage(); logger.error(message, e); sendErrorInternalServerError(response, message); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); } }