NdsBeisEsb/src/main/java/com/northgateps/nds/beis/esb/adapter/PrintExemptionDetailsAdapter.java
/**
     * Set up the response details for the produced file, including content type, name and content.
     *
     * @param exchange the Camel message exchange to set the response on.
     * @throws NdsApplicationException if {@link ByteArrayOutputStream} doesn't exist.
     */
Set up the response details for the produced file, including content type, name and content.
@param exchange the Camel message exchange to set the response on.
Set up the response details for the produced file including content type name and content . @param exchange the Camel message exchange to set the response on .
public void processResponse(Exchange exchange) throws NdsApplicationException {
        NdsSoapRequestAdapterExchangeProxyImpl ndsExchange = new NdsSoapRequestAdapterExchangeProxyImpl(exchange);
        PrintExemptionDetailsNdsResponse response = new PrintExemptionDetailsNdsResponse();
        try
        {
            ByteArrayOutputStream baos = (ByteArrayOutputStream) ndsExchange.getRequestMessageBody(
                    ByteArrayOutputStream.class);
            response.setContentType("application/pdf");
            response.setFileName("exemption-details.pdf");
            response.setSource(baos.toByteArray());
            response.setFileSize(response.getSource().length);
            response.setSuccess(true);
        } catch (ClassNotFoundException e) {
            logger.error("Request failed due to : " + e.getMessage(), e);
            throw new NdsApplicationException("Request failed due to : " + e.getMessage());
        }
        ndsExchange.setResponseMessageBody(response);
    }
public void processResponse ( Exchange exchange ) throws NdsApplicationException { NdsSoapRequestAdapterExchangeProxyImpl ndsExchange = new NdsSoapRequestAdapterExchangeProxyImpl ( exchange ) ; PrintExemptionDetailsNdsResponse response = new PrintExemptionDetailsNdsResponse ( ) ; try { ByteArrayOutputStream baos = ( ByteArrayOutputStream ) ndsExchange . getRequestMessageBody ( ByteArrayOutputStream . class ) ; response . setContentType ( "application/pdf" ) ; response . setFileName ( "exemption-details.pdf" ) ; response . setSource ( baos . toByteArray ( ) ) ; response . setFileSize ( response . getSource ( ) . length ) ; response . setSuccess ( true ) ; } catch ( ClassNotFoundException e ) { logger . error ( "Request failed due to : " + e . getMessage ( ) , e ) ; throw new NdsApplicationException ( "Request failed due to : " + e . getMessage ( ) ) ; } ndsExchange . setResponseMessageBody ( response ) ; }
Set up the response details for the produced file, including content type, name and content.
Set up the response details for the produced file including content type name and content .