my requirement is as follows:
INFO: icefaces upload component, uploads the files to relative folder and creates for each user a sub-directory in that folder with the sessionId.
Requirement: at the sessionDestroyed for each user, i want to get the real path, to delete current user folder.
i know how to get the real path with JSF as follows:
ServletContext ctx = (ServletContext) FacesContext.getCurrentInstance()
.getExternalContext().getContext();
String deploymentDirectoryPath = ctx.getRealPath("/");
Problem: if you try to get the real path in sessionDestroyed you will get null pointer exception, so i was wondering if there’s a way to initialize the variable deploymentDirectoryPath in the listener so i can use it in sessionDestroyed method, or maybe initialize the real path variable on application startup and use it here ?
please advise how to solve this issue.
Even though you haven’t posted the actual code that relates to the problem, the following gives me the real path:
Output