I have a file on my application server. And I have http permissions on it.
So, I am able to read the file using the following piece of code. url = new java.net.URL("http://devapp/devreports/Anand.pdf"); inputStream = url.openStream(); printInputStream (inputStream);
Is there a way, I can delete this particular file with the http permission I have?
Everything is possible; not everything is a good idea. You could for example implement a servlet that accepts a HTTP DELETE request.
But if you do that, you are not the only one that will be able to delete files. HTTP is quite a public thing you know. So perhaps you will want to ask yourself a question: do I really WANT to be able to remove a file when you have only HTTP access?
Thank you for your response.
Is there a way without servlets. URL url = new URL("http://devapp/Anand.pdf"); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); httpCon.setDoOutput(true); httpCon.setRequestProperty(
+"Content-Type", "application/x-www-form-urlencoded" );+ httpCon.setRequestMethod("DELETE"); httpCon.connect();
I tried the above, but got a method not allowed 404 response.