Hi Alex,

Regarding Finder, overriding find() should be just fine indeed, its behavior is 
very similar to findTarget() in Restlet 1.1. 

As for "targetClass", if you have you own custom way to find/create resources, 
you might safely ignore it indeed. It is essential only for the default 
behavior. I have just updated Finder's Javadocs.

Also, I've just fixed some broken test cases, so 2.0 snapshots should get 
automatically published again, including refreshed Javadocs later today.

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


-----Message d'origine-----
De : [email protected] [mailto:[email protected]] De la part de Alex 
Milowski
Envoyé : jeudi 20 mai 2010 15:34
À : [email protected]
Objet : Re: A Couple Restlet 2.0rc2 Documentation Comments

On Thu, May 20, 2010 at 8:31 AM, Jerome Louvel
<[email protected]> wrote:
> Hi Alex,
>
> 1. This design was already in place for the older Finder, with the
> findTarget() and createTarget() methods. The idea is that find() could
> potentially reuse instances of ServerResource subclasses created by the
> create() method, doing some sort of pooling.

OK.  In all of my current instances, I don't do that.  If I never override
the create() method, and always create within the find() method, is everything
going to be OK?


>
> The targetClass property points to the ServerResource subclass that must be
> instantiated. I'm not sure how to describe it better in the Javadocs. Any
> suggestion?

I most certainly don't use this feature.  I don't need that kind of
class abstraction
as I know the distinct ServerResource derived instances that I'll be
creating.  Is there any reason why I should be concerned about the targetClass
field of the Finder instance?

My basic confusing is the javadoc seems to make it like the "targe class"
is essential while the code seems to allow you to completely ignore that
facility.  If it is optional, it should be described as an optional
feature.  If it
is somehow essential, should my code really work?

Of course, I'd like my simple "finder" to work as it does now.  :)

> 2. Good points. Here is the updated Javadocs for ServerResource:
>
>  * Base class for server-side resources. It is a full replacement for the
>  * deprecated {...@link Resource} class. It acts as a wrapper to a given call,
>  * including the incoming {...@link Request} and the outgoing {...@link 
> Response}.
> <br>
>  * <br>
>  * It's life cycle is managed by a {...@link Finder} created either explicitly
> or
>  * more likely implicitly when your {...@link ServerResource} subclass is
> attached
>  * to a {...@link Filter} or a {...@link Router} via the {...@link
> Filter#setNext(Class)}
>  * or {...@link Router#attach(String, Class)} methods for example. After
>  * instantiation using the default constructor, the final
>  * {...@link #init(Context, Request, Response)} method is invoked, setting the
>  * context, request and response. You can intercept this by overriding the
>  * {...@link #doInit()} method. Then, if the response status is still a
> success,
>  * the {...@link #handle()} method is invoked to actually handle the call.
> Finally,
>  * the final {...@link #release()} method is invoked to do the necessary
> clean-up,
>  * which you can intercept by overriding the {...@link #doRelease()} method.
> During
>  * this life cycle, if any exception is caught, then the
>  * {...@link #doCatch(Throwable)} method is invoked.<br>

That's much better.

>
> I've also just added links from the API packages to the relevant section in
> the user guide (wiki). There is already a "How to" page in the wiki that
> should probably be expanded (contributors welcome):
> http://wiki.restlet.org/docs_2.0/13-restlet/333-restlet/338-restlet.html

Is this online?  The development snapshot doesn't seem to have this.  Does
it get automatically updated.

I've generally reverted to browsing the source code to understand certain
aspects of how 2.0 works.

--Alex Milowski

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

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

Reply via email to