Hi,
I have a simple requirement where on click of a link/button in my ADF page I need to display an html page stored in network location (e.g. //<hostname>/folder1/folder2/demofile.htm)
I only have the file path and only a substring of the file name so I have to search for the file in the network directory using that substring. Once i have the file name I use af:goLink to navigate to the network path and display the file in the browser.
Here is the piece of code from Managed bean and the jspx
FindFilebean.java
.
.
path = "\\\\<hostname>\\folder1\\folder2"
File f = new File(path);
File[] filelist = f.listFiles();
File latestFile;
for(File file : filelist){
if(file.toString().contains(fileNameSubstring){
if(latestFile==null || (latestFile!=null && latestFile.lastModified() < file.lastModified())){
latestFile= file;}
}
}
path = latestFile;
.
.
FindFile.jspx
<af:goLink text="Traveler Print" id="gl1"
destination="#{viewScope.FindFilebean.path}" targetFrame="_blank"/>
<af:popup childCreation="deferred" autoCancel="disabled" id="p1"
This works perfectly fine when I run it local integrated server, but i get a null pointer exception on accessing f.listFiles(); when deployed on weblogic managed server.
I have also tried the following:
1. Created a servlet and tried to read the file using Buffered output stream and display in an inlineFrame
2. FiledownloadActionListener to read the file and display/download it
Both these approaches work fine locally but display/download a blank page on the server.
Please suggest what I am missing here and if there is another way to achieve this.
JDev version: 11.1.2.4.0
Weblogic Server version: 10.3.6.0
Thanks in advance.