•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 391,558 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,739 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 954 | Replies: 0 | Solved
![]() |
•
•
Join Date: Aug 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi I have a web Application which uses servlets. As soon as any user Logs i create a folder for the user and the files uploaded by the user are stored in that folder. Now when the users Logs out of the Application I am supposed to delete the folder and all its content.
I used File API to achieve this But I get a
[Inline]
java.security.AccessControlException: access denied (java.io.FilePermission C:\Sun\ApplicationServer\nodeagents\SPINE-POD03\AppServer1\applications\j2ee-apps\harness\simulator_war\temp\guest1\input\ACFHasResourcePermissionsRequest.xml delete)
[/inline]
I use SJAS 8.1 as my application server the code is as follows
Please can any one help me out with this issue..
Thanks in Advance
I used File API to achieve this But I get a
[Inline]
java.security.AccessControlException: access denied (java.io.FilePermission C:\Sun\ApplicationServer\nodeagents\SPINE-POD03\AppServer1\applications\j2ee-apps\harness\simulator_war\temp\guest1\input\ACFHasResourcePermissionsRequest.xml delete)
[/inline]
I use SJAS 8.1 as my application server the code is as follows
protected void doGet(
HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
HttpSession session = request.getSession();
File userDir = new File((String)session.getAttribute(WEB_USER_FOLDER));
recursivelyDeleteDirectory(userDir);
session.invalidate();
System.out.println("Session Destroyed ");
response.sendRedirect(WEB_LOGIN_URL);
}
private void recursivelyDeleteDirectory(File dir) throws IOException {
if ((dir == null) || !dir.isDirectory()) throw new IllegalArgumentException(dir + " not a directory");
final File[] files = dir.listFiles();
final int size = files.length;
System.out.println("Files size = " + size);
for (int i = 0; i < size; i++) {
if(files[i].isDirectory()) {
recursivelyDeleteDirectory(files[i]);
} else files[i].delete();
}
dir.delete();
}Please can any one help me out with this issue..
Thanks in Advance
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JSP Marketplace
Similar Threads
- Deleting Uploaded Files? (PHP)
- A question about deleting Temp files (Windows NT / 2000 / XP / 2003)
- Use Java to remove a block of html from a number of files? (Java)
- how to delete ALL temp internet files, etc. (Windows NT / 2000 / XP / 2003)
- Set, View, Change, or Remove Special Permissions for Files and Folders in Windows XP (Windows tips 'n' tweaks)
Other Threads in the JSP Forum
- Previous Thread: download file on portals jsr 168
- Next Thread: generating account balances with JDBC in mySql


Linear Mode