• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

PDF Download not working in Production.

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my Spring MVC based application, I've implemented a PDF viewer functionality. This functionality is working in DEV, TEST, and STAGE, however it's not working in production.

Following are the details.

1 In web.xml the servlet is separately defined as :

<servlet>
<servlet-name>DowloadPDF</servlet-name>
<servlet-class>com.work.pa.DownloadPDF</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>DowloadPDF</servlet-name>
<url-pattern>/downloadPDF.do</url-pattern>
</servlet-mapping

2. Servlet code

httpSession = request.getSession();
byte[] pdfAsByteArray = (byte[]) httpSession.getAttribute("pdfObject");
response.setHeader("Pragma", "no-cache");
response.setHeader("Expires", "0");
response.setContentType("application/pdf");
response.setHeader("Content-disposition", "attachment; filename=document.pdf");
response.setContentLength(pdfAsByteArray.length);
OutputStream os = response.getOutputStream();
os.write(pdfAsByteArray);
os.flush();
os.close();
response.reset();


This works in DEV, TEST, and STAGE, however in Production it's not working.
Following is the URL for production:

https://bet.rab.com/Rabbit/downloadPDF.do
HOWEVER,
it works in production if change the URL to

http://dbnrt355:9081/Rabbit/downloadPDF.do

I've changed https to http and given the exact name of the server along with the port number.


Any help will be highly appreciated.





 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does qa use https? If not, your problem is the https setup. If so, what is different between the two.

There isn't really enough information here to be able to suggestion solutions.
 
Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic