Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

File uploading using Restlets  RSS feed

 
navneet rajput
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • 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



 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!