Source:
public JobIdData submit(@HeaderParam("sessionid") String sessionId, @PathParam("path") PathSegment pathSegment, MultipartFormDataInput multipart, @Context UriInfo contextInfos) throws JobCreationRestException, NotConnectedRestException, PermissionRestException, SubmissionClosedRestException, IOException { try { Scheduler scheduler = checkAccess(sessionId, "submit"); Map<String, List<InputPart>> formDataMap = multipart.getFormDataMap(); String name = formDataMap.keySet().iterator().next(); File tmpJobFile = null; try { InputPart part1 = multipart.getFormDataMap().get(name).get(0); String fileType = part1.getMediaType().toString().toLowerCase(); if (!fileType.contains(MediaType.APPLICATION_XML.toLowerCase())) { throw new JobCreationRestException("Unknown job descriptor type: " + fileType); } InputStream is = part1.getBody(new GenericType<InputStream>() { }); tmpJobFile = File.createTempFile("job", "d"); JobId jobId; try (OutputStream outputStream = new FileOutputStream(tmpJobFile)) { IOUtils.copy(is, outputStream); Map<String, String> jobVariables = workflowVariablesTransformer.getWorkflowVariablesFromPathSegment(pathSegment); WorkflowSubmitter workflowSubmitter = new WorkflowSubmitter(scheduler); Map genericInfos = getMapWithFirstValues(contextInfos.getQueryParameters()); jobId = workflowSubmitter.submit(tmpJobFile, jobVariables, genericInfos); } return mapper.map(jobId, JobIdData.class); } finally { if (tmpJobFile != null) { FileUtils.deleteQuietly(tmpJobFile); } } } catch (IOException e) { throw new IOException("I/O Error: " + e.getMessage(), e); } }

Target:
public JobIdData submit(@HeaderParam("sessionid") String sessionId, @PathParam("path") PathSegment pathSegment, MultipartFormDataInput multipart, @Context UriInfo contextInfos) throws JobCreationRestException, NotConnectedRestException, PermissionRestException, SubmissionClosedRestException, IOException { try { Scheduler scheduler = checkAccess(sessionId, "submit"); Map<String, List<InputPart>> formDataMap = multipart.getFormDataMap(); String name = formDataMap.keySet().iterator().next(); File tmpJobFile = null; try { InputPart part1 = multipart.getFormDataMap().get(name).get(0); String fileType = part1.getMediaType().toString().toLowerCase(); if (!fileType.contains(MediaType.APPLICATION_XML.toLowerCase())) { throw new JobCreationRestException("Unknown job descriptor type: " + fileType); } InputStream is = part1.getBody(new GenericType<InputStream>() { }); tmpJobFile = File.createTempFile("job", "d"); JobId jobId; try (OutputStream outputStream = new FileOutputStream(tmpJobFile)) { IOUtils.copy(is, outputStream); Map<String, String> jobVariables = workflowVariablesTransformer.getWorkflowVariablesFromPathSegment(pathSegment); Map<String, String> genericInfos = null; if (contextInfos != null) genericInfos = getMapWithFirstValues(contextInfos.getQueryParameters()); WorkflowSubmitter workflowSubmitter = new WorkflowSubmitter(scheduler); jobId = workflowSubmitter.submit(tmpJobFile, jobVariables, genericInfos); } return mapper.map(jobId, JobIdData.class); } finally { if (tmpJobFile != null) { FileUtils.deleteQuietly(tmpJobFile); } } } catch (IOException e) { throw new IOException("I/O Error: " + e.getMessage(), e); } }