descriptor.getInputParameters(), config);
icsBuilder.overlayEnvironmentParameters(
descriptor.getInputParameters(), envParams);
// @todo perform check for supported operation type here.
ImageProcessor processor =
ImageProcessorFactory.getInstance().
createImageProcessor(ToolFactory.getInstance(),
ImageWriterFactory.getInstance());
Representation representation =
ImageLoader.load(descriptor.getInputParameters().getParameterValue(ParameterNames.SOURCE_URL),
retriever, request, descriptor);
inputStream = new NoCloseSeekableInputStream(representation.getSeekableInputStream());
new PreservationParamsBuilder().process(request, descriptor);
// now get the input stream for the watermark image.
// @todo later this could probably be cached.
if (descriptor.getInputParameters().containsName(
ParameterNames.WATERMARK_URL)) {
Representation watermarkRepresentation =
ImageLoader.load(descriptor.getInputParameters().getParameterValue(ParameterNames.WATERMARK_URL),
retriever, request, descriptor);
watermarkStream =
new NoCloseSeekableInputStream(watermarkRepresentation.getSeekableInputStream());
descriptor.getInputParameters().setObject(
ParameterNames.WATERMARK_INPUT_STREAM, watermarkStream);
}
outputData =
new NoFlushSeekableOutputStream(response.getOutputStream());
processor.process(new NoCloseSeekableInputStream(inputStream),
outputData,
descriptor.getInputParameters());
// Set the expiry header for the cache
setCacheData(response, representation.getCacheInfo());