Hi Enrico, On Mon, Nov 21, 2011 at 10:43 AM, Enrico Daga <[email protected]> wrote: ... >> 2) Watch for job completion >> >> GET /jobs/1234 ... >> Body contains a link to the job output, for example /jobs/1234/output.txt ...
> In the current implementation the Future<?> object used to monitor the > status cannot access the Job/Result object before it is complete, so > it cannot know the location of the response before. I have thought a > solution, anyway, to let the JobManager manage a mapping between > ID/Locations delegating to a Job.buildResponseLocation(String jobId) > before starting the job... Ok, at the interface design level I'd say "I don't care" ;-) As you say, the job manager should keep a mapping that allows for output.txt to point to the right data, and if needed output.txt can also do an http redirect to the right location. > ...So, the info should include: > - Status (running|finished) > - Location > - Accept > - Delete info... Ok, for Location and Accept I suggest (example): link rel=job-output type=text/plain href=/jobs/1234/output.txt link rel=job-output type=application/json href=/jobs/1234/output.json etc.. > >> >> 3) Read job output >> GET to the path returned in 2), /jobs/1234/output.txt in this example. >> Might return 404 as long as the job is not finished, with HTML or JSON >> content that points to the parent job resource, /jobs/1234. > In this we can distinguish non existent resources and non complete > jobs only by parsing the content. Could make sense add a > Content-Location[1] header pointing to the job, if it is not ready? > That should provide information about the job status (in the future > progress monitoring, for example) and could help distinguish non ready > jobs output and non existent resources... I'm not a fan of http headers to indicate application-level state...that's not browser-friendly. How about this: GET /jobs/1234 returns job info with a link rel=output to /jobs/1234/output.txt GET /jobs/1234/output.txt returns 404 if job not finished GET /jobs/1234/output.txt returns 204 if job finished but produced no output This will work both from a browser and from better http clients, WDYT? Ciao, -Bertrand > [1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.14
