Hi there,

The ServerResource class is very lightweight and there is no special penalty
in creating a new instance of it for each request. Its memory footprint is
small as it contains only those member variables:
 - context : Context
 - request : Request
 - response: Response 

 - annotated  :  boolean
 - conditional:  boolean
 - existing:     boolean
 - negotiated:   boolean

 - variants: Map<Method, Object>

We even have a plan to go without the "variants" member variable.

"Enhance ServerResource design"
http://restlet.tigris.org/issues/show_bug.cgi?id=462

By extending Restlet instead, you will lose automatic content negotiation,
conditional processing, automatic conversion between objects and
representation and the ability to use annotated methods (@Get, @Put, etc.).
You will also have to take care of multi-threading.

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com

-----Message d'origine-----
De : [email protected] [mailto:[email protected]] 
Envoyé : mercredi 26 août 2009 22:35
À : [email protected]
Objet : ServerResource

I'm evaluating Restlet for my next project and would like clarification on
some design desicions.

ServerResource is the preferred way to expose resources in Restlet, but is
there a penalty to creating a new instance for each request?

We will be using Scala and most of the code will follow an
immutable/functional style.

What are the downsides of just extending the Restlet class for handling
requests?

Thanks

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=23877
17

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2388195

Reply via email to