Hi Fabio

On Jan 6, 2009, at 1:46 AM, fmancinelli (SVN) wrote:

> Author: fmancinelli
> Date: 2009-01-06 01:46:26 +0100 (Tue, 06 Jan 2009)
> New Revision: 15087
>
> Added:
>   sandbox/xwiki-core-rest/src/main/java/components/
>   sandbox/xwiki-core-rest/src/main/java/components/org/
>   sandbox/xwiki-core-rest/src/main/java/components/org/xwiki/
>   sandbox/xwiki-core-rest/src/main/java/components/org/xwiki/rest/
>   sandbox/xwiki-core-rest/src/main/java/components/org/xwiki/rest/ 
> SpacesResource.java
>   sandbox/xwiki-core-rest/src/main/java/components/org/xwiki/rest/ 
> XWikiResource.java
>   sandbox/xwiki-core-rest/src/main/java/components/org/xwiki/rest/ 
> XWikiResourceFinder.java
>   sandbox/xwiki-core-rest/src/main/java/components/org/xwiki/rest/ 
> XWikiResourceRepresenter.java
>   sandbox/xwiki-core-rest/src/main/java/components/org/xwiki/rest/ 
> XWikiRestApplication.java
>   sandbox/xwiki-core-rest/src/main/java/components/org/xwiki/rest/ 
> XWikiRestletServlet.java
>   sandbox/xwiki-core-rest/src/main/java/components/org/xwiki/rest/ 
> internal/
>   sandbox/xwiki-core-rest/src/main/java/components/org/xwiki/rest/ 
> internal/PlainTextSpacesRepresenter.java
>   sandbox/xwiki-core-rest/src/main/java/components/org/xwiki/rest/ 
> internal/XmlTextSpacesRepresenter.java
> Modified:
>   sandbox/xwiki-core-rest/src/main/resources/META-INF/plexus/ 
> components.xml
> Log:
> Added a fully componentized version of the REST infrastructure.
>
> Now resources and "representers" (i.e., objects that are in charge  
> for representing a given resource for a given media type) are  
> declared through components.xml and automatically registered:
>
> 1) At the application level routes are created for all the  
> components declaring the org.xwiki.rest.XWikiResource role. The role  
> hint defines the uri template.
>
> 2) Representers components are associated to resource components by  
> looking at the role hint (which should reflect the resource a given  
> representer is associated to)

[snip]

> +            restApplication = (XWikiRestApplication)  
> componentManager.lookup(applicationClass);
> +
> +             
> restApplication.setName(getServletConfig().getServletName());
> +            restApplication.setContext(new  
> ServletContextAdapter(this, context));
> +             
> restApplication 
> .getContext().setLogger(restApplication.getClass().getName());

Looks good in general.

Just making sure: is createApplication() and hence the code above  
executed only once?

All components you've created are singletons so you need to be careful  
that they don't hold state or if they do (as above) then this needs to  
be a state that is common for all threads and thus only initialized  
once for the entire app lifetime.

[snip]

Thanks
-Vincent





_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to