DownLoad Shippo label through controller
<p>After filling necessary package info, I manage to create a responsed Transaction object through goShippo API call: Transaction.create(Map, apiKey). Form the responsed Transaction object, I can get the shipping label as a Url: transaction.getObjectId(). </p>

<p>The problem that I have is how can I enable my client to download the shipping label.</p>

<p>My current code is:</p>

<pre><code>fileName= "https://shippo-delivery-east.s3.amazonaws.com/b1b0e6af.pdf?xxxxxx";

File file = new File(fileName);
String mineType = URLConnection.guessContentTypeFromName(file.getName());
    if(mineType == null) {
        System.out.println("mineType is not detectable");
        mineType = "application/octet-stream";
    }

    response.setContentType(mineType);
    response.setHeader("Content-Disposition"
            , String.format("inline; filename=\"" + file.getName() +"\""));


    response.setContentLength((int)file.length());

    InputStream inputStream = new BufferedInputStream(new FileInputStream(file));

    FileCopyUtils.copy(inputStream, response.getOutputStream());
</code></pre>

<p>The error that I have is that the file is not found, but when I pass the fileName on browser, I can see the shipping label. </p>