This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi All, Thanks a lot in advance. We will deploy the application on websphere server through URL which is at remote place by creating ear file. Now, I have on pdf file which is a fixed one and it wont be changed in future also and I am opening this pdf on click of a link. Due to this large pdf my ear size become very high and some times I am facing deployment problem while uploading this large file. Is there any way to keep the file some where in server and later we can open?.
Yes, you can write a servlet that streams binary files from the server to the browser. Then, using a context init param, you can configure the location of the file so that your streaming servlet can find it.
In this example, the files are being read using ServletContext.getResourceAsStream because they are located within the web app's directory structure. In your case, you would want to use a FileReader so you can read the file from disk using java.io.File. It shouldn't be hard to convert the example servlet to do that.