• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Filename as url.

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic