InputStream inputStream,
@Suspended AsyncResponse asyncResponse,
@HeaderParam(HttpHeaders.CONTENT_TYPE) String inputType,
@HeaderParam(HttpHeaders.ACCEPT) String responseType,
@DefaultValue("" + IConverter.JOB_PRIORITY_NORMAL) @HeaderParam(ConverterNetworkProtocol.HEADER_JOB_PRIORITY) int priority) {
DocumentType targetType = new DocumentType(responseType);
// The received input stream does not need to be closed since the underlying channel is automatically closed with responding.
// If the stream was closed manually, this would in contrast lead to a NullPointerException since the channel was already detached.
webConverterConfiguration.getConverter()
.convert(inputStream, false).as(new DocumentType(inputType))
.to(AsynchronousConversionResponse.to(asyncResponse, targetType, webConverterConfiguration.getTimeout())).as(targetType)
.prioritizeWith(priority)
.schedule();
}