comparison OrthancServer/OrthancRestApi/OrthancRestSystem.cpp @ 2976:cb5d75143da0

Asynchronous generation of ZIP archives and DICOM medias
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 06 Dec 2018 12:23:46 +0100
parents 4767d36679ed
children 4e43e67f8ecf
comparison
equal deleted inserted replaced
2970:eea66afed0db 2976:cb5d75143da0
323 call.GetOutput().AnswerJson(json); 323 call.GetOutput().AnswerJson(json);
324 } 324 }
325 } 325 }
326 326
327 327
328 static void GetJobOutput(RestApiGetCall& call)
329 {
330 std::string job = call.GetUriComponent("id", "");
331 std::string key = call.GetUriComponent("key", "");
332
333 std::string value;
334 MimeType mime;
335
336 if (OrthancRestApi::GetContext(call).GetJobsEngine().
337 GetRegistry().GetJobOutput(value, mime, job, key))
338 {
339 call.GetOutput().AnswerBuffer(value, mime);
340 }
341 else
342 {
343 throw OrthancException(ErrorCode_InexistentItem,
344 "Job has no such output: " + key);
345 }
346 }
347
348
328 enum JobAction 349 enum JobAction
329 { 350 {
330 JobAction_Cancel, 351 JobAction_Cancel,
331 JobAction_Pause, 352 JobAction_Pause,
332 JobAction_Resubmit, 353 JobAction_Resubmit,
390 Register("/jobs/{id}", GetJobInfo); 411 Register("/jobs/{id}", GetJobInfo);
391 Register("/jobs/{id}/cancel", ApplyJobAction<JobAction_Cancel>); 412 Register("/jobs/{id}/cancel", ApplyJobAction<JobAction_Cancel>);
392 Register("/jobs/{id}/pause", ApplyJobAction<JobAction_Pause>); 413 Register("/jobs/{id}/pause", ApplyJobAction<JobAction_Pause>);
393 Register("/jobs/{id}/resubmit", ApplyJobAction<JobAction_Resubmit>); 414 Register("/jobs/{id}/resubmit", ApplyJobAction<JobAction_Resubmit>);
394 Register("/jobs/{id}/resume", ApplyJobAction<JobAction_Resume>); 415 Register("/jobs/{id}/resume", ApplyJobAction<JobAction_Resume>);
416 Register("/jobs/{id}/{key}", GetJobOutput);
395 } 417 }
396 } 418 }