@RequestMapping(value="/internal/jobs/{jobType}",method=POST) public void startJob(final @PathVariable String jobType,final HttpServletRequest request,final HttpServletResponse response) throws IOException {
  final Optional<String> jobId=jobService.startAsyncJob(jobType);
  if (jobId.isPresent()) {
    response.setHeader("Location",baseUriOf(request) + "/internal/jobs/" + jobId.get());
    response.setStatus(SC_NO_CONTENT);
  }
 else {
    response.sendError(SC_CONFLICT);
  }
}

@ RequestMapping ( value = "/internal/jobs/{jobType}" , method = POST ) public void startJob ( final @ PathVariable String jobType , final HttpServletRequest request , final HttpServletResponse response ) throws IOException { final Optional < String > jobId = jobService . startAsyncJob ( jobType ) ; if ( jobId . isPresent ( ) ) { response . setHeader ( "Location" , baseUriOf ( request ) + "/internal/jobs/" + jobId . get ( ) ) ; response . setStatus ( SC_NO_CONTENT ) ; } else { response . sendError ( SC_CONFLICT ) ; } }
starts a new job of the specified type , if no such job is currently running . < p > the method will return immediately , without waiting for the job to complete . < p > if a job with same type is running , the response will have http status 409 conflict , otherwise http 204 no content is returned , together with the response header ' location ' , containing the full url of the running job .
