Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

File uploading using Restlets

 
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



 
I will suppress my every urge. But not this shameless plug:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!