开发者

how to create a file and write on it on URL

开发者 https://www.devze.com 2023-02-07 11:48 出处:网络
HI can anybody tell me how to create a file and write on it on the URl. Actually I am using an applet and from theat I want to create a file on

HI can anybody tell me how to create a file and write on it on the URl.

Actually I am using an applet and from theat I want to create a file on getCodebase(); so can any body tell me how can I do it

I have tried

URL url = new URL(/*url by codebase and the directory with file name*/);
URLConnection connection = url.openConnection开发者_JAVA技巧();
connection.setDoOutput(true);
OutputStream out = connection.getOutputStream();

but it not worked

Please help me


Actually I am using an applet and from theat I want to create a file on getCodebase();

Well that wouldn't be very secure if you could do that, would it?

I think the route you want to take is to configure your HTTP server to handle PUT requests, and then form a PUT in Java. That is described here:

  • How to send PUT, DELETE HTTP request in HttpURLConnection?

However, your applet probably needs elevated permissions (in other words, a signed applet that operates outside of the normal sandbox). I'm not sure about that though; some connections are allowed back to the host so you might be OK.

0

精彩评论

暂无评论...
验证码 换一张
取 消