Hi...
I need to read a file from within an EJB. I don't want to have to put an
absolute path name to the file. Is there a way to get a reference to a file
like that?
For example,
@Stateless()
public class MyBean {
@PostConstruct()
private void init() {
File file = new File("path to file goes here");
// ...
}
// ...
}
I know that depending from where I start the domain or even if I changed the
domain, I would have to change the path.
I thought about putting that path in a variable that I resource inject into
the class and define the path inside ejb-jar.xml... But it doesn't entirely
solve the problem because I'd still need to change that file if the domain
name changed or if I started the AS from a different dir...
I guess another question is valid in this same issue. I had a web
application project in which I use facelets. I reference a .css from a file
in a template. On another file that uses the template, the .css file is not
found because the path is relative to the page including... Is there a way
to refer to this .css in an abstract way?
thanks,
Daniel.