return badRequest(Status.CLIENT_ERROR_NOT_FOUND, "no pipeline: " + pipelineUri(id), variant.getMediaType());
}
PipelineConfiguration pipeconfig = getPipelines().get(id);
XPipeline xpipeline = pipeconfig.pipeline;
XProcRuntime runtime = pipeconfig.runtime;
if (pipeconfig.ran) {
pipeconfig.reset();
xpipeline.reset();
}
try {
if (MediaType.MULTIPART_FORM_DATA.equals(entity.getMediaType(), true)) {
processMultipartForm(pipeconfig, entity, variant);
} else {
if (pipeconfig.definput == null) {
return badRequest(Status.CLIENT_ERROR_BAD_REQUEST, "No primary input port", variant.getMediaType());
}
if (pipeconfig.documentCount(pipeconfig.definput) == 0) {
xpipeline.clearInputs(pipeconfig.definput);
}
pipeconfig.writeTo(pipeconfig.definput);
XdmNode doc = null;
if (isXml(entity.getMediaType())) {
doc = runtime.parse(new InputSource(entity.getStream()));
logger.debug("Posting XML document to " + pipeconfig.definput + " for " + id);
} else {
ReadablePipe pipe = null;
pipe = new ReadableData(runtime, XProcConstants.c_data, entity.getStream(), entity.getMediaType().toString());
doc = pipe.read();