JBoss Community

Re: Give permission to write to a folder?

created by Chris Williams in Beginner's Corner - View the full discussion

1) To be truthful, it's JBoss EWP 5.1 not the community edition (I didn't think that it might be a version specific issue, hence asking here. I do have a question out to our reseller as well). Win 7. Java 6 update 23.

2) I'm starting it on the command line.

3) JBoss is being run as myself (chris.williams). If I start it as an Administrator, then it's run as my Admin account.

4) There is no exception since java.io.File.delete() just returns a boolean rather than throwing an exception.

5) ->

 

 

 

                    String resFolder = getInitParameter("resources.folder");

 

                    if (request.getParameter("page_action") != null) {

                              if (request.getParameter("page_action").compareTo("delete") == 0) {

                                        File f = new File(resFolder + request.getParameter("filename"));

                                        if (!f.delete()) {

                                                  ServletOutputStream out = response.getOutputStream();

                                                  out.print("Couldn't delete");

                                                  out.close();

                                                  return;

                                        }

 

                                        response.sendRedirect("Resources.html");

                                        return;

                              }

                    }

 

6) Yes, a standalone application is able to delete from the target folder, even while JBoss is still running. I also tried setting the scan folder for the servlet to C:\ and was able to delete a file there, just not a file from the target folder.

Reply to this message by going to Community

Start a new discussion in Beginner's Corner at Community