By the way, I think you should change your "URI to Resource" mapping plan.

I think it's not the best practice to use a "getbycontact" and
"getbycontactx" attribute in your URI.
CMIIW.

On Fri, Mar 11, 2011 at 7:52 PM, Reza Lesmana <[email protected]>wrote:

> In Spring REST, you could use @Path annotation.
>
> But I don't think there is a @Path annotation in Restlet (CMIIW).
>
> However, I think the approach in Restlet is to map the URI to the
> corresponding resource in the main application.
> And then, in the resource (such as ContactResource) you could call the
> operation from your business layer.
>
> So, the "if else" part will only call the operation from your business
> layer, not from another method in your resource.
>
> On Fri, Mar 11, 2011 at 7:16 PM, Musa YUVACI <[email protected]>wrote:
>
>> Hi,
>>
>> I have been using restlet with spring. I have a resource
>> (ContactResource).
>> And I want to use @Get(or others, @Put,..) annotation for different
>> methods
>> at same resource.
>>
>> Now i am using this way,
>>
>> public class ContactResource() {
>>
>>        @Get
>>        public Representation seperator() {
>>
>>                String opretion = getRequestAttributes().get("operation");
>>
>>                if("getcontact".equals(operation)) {
>>
>>                        return getContact();
>>
>>                } else if("getcontactbyx".equals(operation)) {
>>
>>                        return getContactByX();
>>                }
>>        }
>>
>>        public Representation getContact() {
>>                //Some Code
>>        }
>>
>>        public Representation getContactByX() {
>>                //Some Code
>>        }
>> }
>>
>> But I dont want to use "if else" pairs for seperating every other methods.
>> So , does restlet have any solution for this issue.
>>
>> And restlet cofiguration part (at application-config.xml(Spring
>> configuration file))
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Thanks
>> Musa
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://restlet-discuss.1400322.n2.nabble.com/Using-Get-or-Put-annotation-for-different-methods-at-the-same-resource-tp6161197p6161197.html
>> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>>
>> ------------------------------------------------------
>>
>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2710907
>>
>
>

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

Reply via email to