• Post Reply Bookmark Topic Watch Topic
  • New Topic

Filename as url.  RSS feed

 
Sonara Rahul
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello sir,
Pl.. help me to convert file name as url that is given as

FileOutputStream output = new FileOutputStream("F:\\hello.xml");
OutputFormat format = new OutputFormat(hello);
XMLSerializer serializer = new XMLSerializer(output, format);
This file is placed in server as "http://pepsi/hello.xml"
How can i specify the url path in the o/p stream.
Pl.. help me as soon as possible.
with regards,
Sonara.
 
Lewin Chan
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can probably do something like this
HttpURLConnection http = new HttpURLConnection("http://pepsi/hello.xml");
http.setRequestMethod("POST");
OutputStream output = http.getOutputStream();
OutputFormat format = new OutputFormat(hello);
XMLSerializer serializer = new XMLSerializer(output, format);
output.close();
this assumes that you have sufficient rights on your http server to POST data into hello.xml
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!