• 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

File uploading using Restlets

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,

I am trying to upload file using Restlets but I am facing some issues, I am using following code


// Launching a Sever

Component component = new Component();
component.getServers().add(Protocol.HTTP, 8182);

component.getDefaultHost().attach("/essai",
new MyApplication(component.getContext()));
component.start();

/* Launches a simple client */
FileRepresentation rep = new FileRepresentation(
"d:\\temp\\test.txt", MediaType.TEXT_ALL, 0);
EncodeRepresentation encodedRep = new
EncodeRepresentation(Encoding.GZIP,
rep);
Client client = new Client(Protocol.HTTP);
Response response =
client.put("http://localhost:8182/essai/";, encodedRep);
System.out.println("******" + response.getStatus());

component.stop();


I am not getting that what I should written in MyApplication Class.

All king of help will be appreciated.

Thanks,
Navneet



 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic