Hi Jerome,

looks like a copy of JAX-RS to me.

best regards
   Stephan

Jerome Louvel schrieb:
> Hi again,
>  
> I've just played with the annotations idea. I have to confess that 
> used in this restricted way (only on methods), I'm starting to like it.
>  
> Here is how a sample resource would look like with the refactored API. 
> Note that both extension names and full MIME type would be supported. 
> Extensions can be updated via the MetadataService.
> import java.io.InputStream;
> import org.restlet.ext.atom.Feed;
> import org.restlet.resource.Accepts;
> import org.restlet.resource.Removes;
> import org.restlet.resource.Representation;
> import org.restlet.resource.Represents;
> import org.restlet.resource.ServerResource;
> import org.restlet.resource.Stores;
>
> public class TestResource extends ServerResource {
>
>     @Represents("atom")
>     public Feed getAsAtom() throws Exception {
>         // ...
>         return null;
>     }
>
>     @Represents("application/custom+xml")
>     public Representation getAsXml() throws Exception {
>         // ...
>         return null;
>     }
>
>     @Accepts
>     public void post(Representation entity) throws Exception {
>         // ...
>     }
>
>     @Stores("atom")
>     public void putAtom(Feed feed) throws Exception {
>         // ...
>     }
>
>     @Stores("application/custom+xml")
>     public void putXml(InputStream stream) throws Exception {
>         // ...
>     }
>
>     @Removes
>     public void delete() throws Exception {
>         // ...
>     }
>
> }
> What is nice is that we would keep the higher-level terminology that 
> we have in Restlet 1.1 (accept, store, etc.) but make it available in 
> a more flexible and declarative way.
>  
> The new ServerResource would only have lower-level methods, but with a 
> more flexible signature than in Restlet 1.1:
>
>     * void handle()
>     * Representation handleGet()
>     * Representation handleGet(Variant)
>     * Representation handleHead()
>     * Representation handlePost(Representation)
>     * Representation handlePut(Representation)
>     * Representation handleDelete()
>
> I think we are getting somewhere this time. Looking forward to your 
> feed-back.
>  
> Best regards,
> Jerome Louvel

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

Reply via email to