0

I cannot understand how to use org.restlet.Server class for handling different kinds of ServerResource's.

I want run:

new Server(Protocol.HTTP, 8182, SomeNotYetReady.class).start();

and I want to get a different Resource according to the URL entered. For example, browsing to

http://myserver:8182/rest/new-customer

could be used for inserting a new customer in server database, while

http://myserver:8182/rest/new-order

could be used for creating a new customer's order, and

http://myserver:8182/rest/get-order

could be used for orders retrieval.

Is my approach correct? If so, what classes should I write for this purpose, and which class has to be passed to Server constructor?

Thank you.

EDIT:

I have realized that this question is related to Restlet - trouble attaching Resource class with Router, and there is a perfect answer there.

Community
  • 1
  • 1
user1922691
  • 119
  • 1
  • 2
  • 6

1 Answers1

0

actually launching a Server is fine only for quick code. It is not appropriate for real application. I suggest you to have a look at this http://restlet.com/learn/tutorial/2.2/ and for a full example application deployed on GAE: http://restlet.com/learn/guide/2.2/introduction/first-steps/first-application

Basically, you define an Application which can be seen as a container for a set of ServerResource. Then you host this application inside a Component which can be seen as a container for Application. A Component provides some common services such as a HTTP server connector.

user229044
  • 232,980
  • 40
  • 330
  • 338
Thierry Boileau
  • 866
  • 5
  • 8
  • Problem is that I don't even know what GAE is. Is it a webserver, such as tomcat? is there any good tutorial online for setting it up? – user1922691 Jun 04 '14 at 11:17