I am newbie to the forum and the answer i am providing is from reading blog content but not sure whether this will helps you this is what i think would be the answer for your problem, you may place your file anywhere on the server where you deploy the application. If security permissions allows then you should be able to reference it by an absolute file path. Here is an example of a small Java service to read a logfile and return its contents in the form of a string:
Code:
package com.wavemaker;
import java.io.*;
public class LogReader {
public String readLog (String fileName) {
StringBuffer sb = new StringBuffer();
try {
BufferedReader is = new BufferedReader(new FileReader(fileName));
char[] b = new char[8192];
int n;
// Read a block. If it gets any chars, append them.
while ((n = is.read(b)) > 0) {sb.append(b, 0, n);}
is.close();
} catch (Exception ex) {
throw new RuntimeException(ex);
}
return sb.toString();
}
}
Bookmarks